Skip to the content.
« Previous Index Next »

Firmware Coding Standard — Security, OTA/DFU & Versioning (FreeRTOS)

1) Purpose

Define best practices for secure firmware operation, over-the-air updates (OTA) or device firmware upgrades (DFU), and versioning strategy. Ensure devices are updatable, traceable, and protected against tampering.


2) Principles


3) Secure Boot & Verification


4) OTA/DFU Rules


5) Versioning & Build Metadata


6) Rollback & Recovery


7) Security Rules


8) Anti-Patterns


9) Review Checklist


10) CI/Lint Gates


11) Example Patterns

Version info in firmware

const fw_version_t fw_version __attribute__((section(".version"))) = {
    .major = 1,
    .minor = 4,
    .patch = 2,
    .git_hash = GIT_HASH,
    .build_date = __DATE__,
    .build_time = __TIME__,
};

Bootloader validation

if (!verify_signature(image_addr, image_len, public_key)) {
    LOG_CRIT("BOOT", "Signature check failed, reverting...");
    boot_select_backup();
}

OTA commit flag

void ota_commit_success(void) {
    storage_write_flag(OTA_VALID_IMAGE, 1);
}

« Previous Index Next »