942 B
942 B
NeoECU Firmware Coding Guidelines
These rules apply to the CM7 engine-control firmware.
Style
- Functions:
camelCase - Variables:
python_case - Constants and macros:
UPPER_CASE - Types:
python_case_t
Real-Time Code
- Do not allocate from the heap in the engine-control path.
- Prefer static task, buffer, and control-structure allocation.
- Keep ISRs short: capture data, update the minimum state, wake a task, return.
- Keep heavy validation, filtering, and scheduling logic in task context.
- Avoid avoidable copies, indirection, and generic
void *plumbing.
Structure
- Keep one source file per feature or subsystem where practical.
- Put shared engine state in
global_state.h. - Put shared helper macros in
macros.h. - Prefer explicit state machines over implicit control flow.
- Make ISR-to-task ownership obvious from names and file placement.
- Use named constants and enums instead of magic numbers.