Continuing the discussion from Using linker-defined symbols in `const` context as integers:
I'm exploring development of Rust embedded code (a crate), which when invoked at any point in one's Rust code will scan (read-only) the current stack memory contents and returns the stack's high-water' mark (depth), and how much remaining available stack space in bytes exists beyond the current 'high-water' mark. My initial target is the STM32 family of ARM processors. As envisioned it relies upon some initial startup code filling the app's (currently) unused remaining stack ram-space with a distinct six byte repeating byte-pattern very early after the embedded Rust code launches following a hard reset or power-up. It allows an embedded Rust developer to assess how much stack space has actually been used (high-water mark), and correspondingly how much more free stack-space remains following the high-water mark. May require a small amount of assembly or 'c' FFI code. Will likely only be plausible/useful for embedded boards with at least 32K of SRAM ... Currently I can only ascertain the board's stack region (high/low address) from the Rust link map, so I've linked this post to an associated post which asked how to use link map symbols programmatically. I'm hoping that someone might have some useful tips or information or suggestions (and not just on the link map aspect). Thanks in advance!