|
TB2026-YDS Firmware
|
Runtime diagnostics: FreeRTOS stack occupancy, run-time stats, heap usage. More...
#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | DIAG_ENABLED 0 |
| #define | DIAG_ALERT_PCT 75 |
| #define | DIAG_DUMP_MS 10000 |
Runtime diagnostics: FreeRTOS stack occupancy, run-time stats, heap usage.
Measurement instrument for the characterisation campaign, not a product feature. The whole module hangs off DIAG_ENABLED below: left at 0, every entry point is an empty inline stub, diag.c compiles to an empty translation unit, and the linker emits nothing — zero bytes of flash, RAM and CPU in the final build.
The API is deliberately free of FreeRTOS types so this header can be included anywhere (including from the UI layer, where pulling in freertos/FreeRTOS.h clashes with picolibc's on_exit). The handle of a registering task is read from inside the module with xTaskGetCurrentTaskHandle().
Enabling this requires the FreeRTOS trace/stats options in sdkconfig.defaults (see the "Diagnostics" block there); diag.c fails the build loudly if they are off. Those options carry their own permanent cost (a bigger TCB, a run-time counter read on every context switch), so they belong in the final build no more than this module does — turn them off together.