armcortex-miarmemory-size

How to check SRAM usage for cortex m3 for an application


For Cortex-M3, how to check maximum SRAM usage by an embedded application running on it. Should we check linker map file and stack usage generated by IAR or should we try with writing a function which check current SRAM and call it in application at various place at runtime. Which method should be used.


Solution

  • Not easily, because stack usage differs by quite a lot, and can not be known at compile time, unless you have some restrictions (no proper recursion for example).

    That said, there are some tools that might help you get worst-case stack usage:

    (There's also some development on this topic in Rust: https://blog.japaric.io/stack-analysis/)