Skip to the content.
« Previous Index Next »

Firmware Coding Standard — Style & Documentation (FreeRTOS)

1) Purpose

Ensure all firmware code is consistent, readable, and maintainable. Define conventions for naming, formatting, and documenting FreeRTOS-based firmware so developers can quickly understand and modify the system.


2) Principles


3) Naming Conventions


4) Formatting


5) Comments & Documentation


6) Documentation Deliverables


7) Doxygen & API Docs


8) Anti-Patterns


9) Review Checklist (Style & Docs)


10) CI/Lint Gates


11) Example Patterns

Task header

/**
 * @brief   Logger task
 * @period  100 ms
 * @prio    Low
 * @stack   512 words
 * @desc    Periodically flushes logs to UART.
 */
static void task_logger(void *arg);

Queue declaration

static StaticQueue_t q_comms_tcb;
static uint8_t q_comms_storage[QUEUE_LEN * sizeof(msg_t)];
static QueueHandle_t q_comms;

Driver README excerpt

Driver: UART
Provides async RX/TX with DMA and ISR fallback.
Concurrency: Single writer, single reader.
Error handling: Returns FW_ERR_TIMEOUT on TX timeout, FW_ERR_HW on DMA error.

« Previous Index Next »