Skip to content

System Health

Runtime/health and reset reporting.

Boot-time counters held in the .cw_reboot_safe RAM section (survives soft-reset, lost on cold-boot or sub-retention brown-out) plus a latched reset-cause from the HAL reset driver. Intended for cloud-reportable device-health metrics.

Functions Overview

Name
uint32_tosGetFreeHeapSize(void )
Current free heap (bytes) — thin wrapper for xPortGetFreeHeapSize().
uint32_tosGetMinimumEverFreeHeapSize(void )
Lowest free-heap watermark since boot (bytes).
uint32_tosGetRebootCount(void )
Number of boots since the last cold-start. Increments once per boot in cw_health_init_early(). Resets to 1 on power-on / sub-retention brown-out (when the .cw_reboot_safe blob fails magic+checksum check).
uint32_tosGetCrashCount(void )
Number of crashes (HardFault / UsageFault / MemManage / BusFault) since the last cold-start.
uint8_tosGetResetCause(void )
Latched reset cause for the current boot. SW-intent (set by the crash handlers / watchdog / osReboot before the actual reset) takes precedence over the HW cause. Values mirror libcoldwave CW_RESET_* constants.
voidcw_stack_telemetry_dump(void )

Function Details

function osGetFreeHeapSize

cpp
uint32_t osGetFreeHeapSize(
    void 
)

Current free heap (bytes) — thin wrapper for xPortGetFreeHeapSize().

function osGetMinimumEverFreeHeapSize

cpp
uint32_t osGetMinimumEverFreeHeapSize(
    void 
)

Lowest free-heap watermark since boot (bytes).

function osGetRebootCount

cpp
uint32_t osGetRebootCount(
    void 
)

Number of boots since the last cold-start. Increments once per boot in cw_health_init_early(). Resets to 1 on power-on / sub-retention brown-out (when the .cw_reboot_safe blob fails magic+checksum check).

function osGetCrashCount

cpp
uint32_t osGetCrashCount(
    void 
)

Number of crashes (HardFault / UsageFault / MemManage / BusFault) since the last cold-start.

function osGetResetCause

cpp
uint8_t osGetResetCause(
    void 
)

Latched reset cause for the current boot. SW-intent (set by the crash handlers / watchdog / osReboot before the actual reset) takes precedence over the HW cause. Values mirror libcoldwave CW_RESET_* constants.

Return: uint8_t value in the CW_RESET_* domain.

function cw_stack_telemetry_dump

cpp
void cw_stack_telemetry_dump(
    void 
)

Logs one line per thread with its stack high-watermark (minimum ever remaining headroom in bytes). Useful from shells / support dumps to right-size stacks empirically.