Sin memoria dinámica tras el arranque, watchdog siempre activo, reglas al estilo MISRA.
Constitution — Embedded firmware in C
Version 1.0.0 · Ratified 2026-11-10
These principles hold for every spec, plan and task of the firmware. A spec may add rules; it never weakens these.
-
No dynamic allocation after boot. Memory is allocated statically or during initialization only; after the scheduler starts,
mallocandfreeare not called. FreeRTOS objects are created with the static APIs, and the linker map is checked in CI for heap use. -
Watchdog always on. The hardware watchdog is enabled before the scheduler starts and is never disabled in a release build. It is fed by a supervisor task only when every monitored task has checked in within its deadline.
-
MISRA-style rules. The code follows MISRA C:2012 with the deviations listed in the plan, checked by a static analyser in CI. A new violation without a recorded deviation fails the build.
-
Warnings are errors. The firmware builds with
-Wall -Wextra -Werrorand the same compiler version locally and in CI. No warning is silenced with a pragma without a note in the deviation list. -
Interrupts stay short. Interrupt handlers only capture data and hand it to a task through a queue or notification; they never block, allocate or call non-ISR-safe APIs. The worst-case handler time is measured and stays under the budget in the plan.
-
Stack and timing budgets are measured. Every task has a stack size checked with the high-water mark and a margin of at least 25%, and every periodic task has a deadline. Stack overflow detection is enabled in every build.
-
Hardware is behind a thin layer. Peripheral access goes through a hardware abstraction layer so the application logic compiles and is unit tested on the host with Unity or CppUTest. Logic tests run in CI without a board.
-
Safe updates. Firmware updates are signed and verified by the bootloader, written to a second slot and booted only after the check passes, with automatic rollback if the new image does not confirm itself.