Skip to main content

Module stack

Module stack 

Source
Expand description

The main stack’s high-water, by paint and scan.

Identical in m5stack-core and korvo1-bsp on purpose, as monitor is: change it in one, change it in the other, and cmp them.

esp_rtos::stack_usage reports heap-allocated task stacks only; the main stack is linker-provided (.stack) and already in use when the scheduler starts, so nothing reports it unless it is painted before it is used. A margin read off .stack’s size is not a margin: on these chips the region is the linker’s slack, and nothing but a reading separates a comfortable build from one that faults mid-session.

Functions§

main_stack_margin
Bytes between the bottom of the main stack and its deepest use so far, or None if it was never painted.
main_stack_size
The main stack’s size: .stack, as linked.
paint_main_stack
Paint the main stack below the stack pointer.