I want to measure Stack and heap usage while certain mathematical algorithm is running on my Renesas S3A7 ARM M3 based controller. Is there any way or procedure how I can measure the maximum memory utilized while executing certain functionality?
Asked
Active
Viewed 710 times
0
-
why would you have heap on a microcontroller? sounds like a broken design. For stack usage, you can use a valgrind like approach – old_timer Aug 21 '17 at 12:54
-
your compiler might provide a setting to check or log the deepest the stack has reached. if you are using a heap you can go into your malloc/sbrk code and add something to track the furthest into memory you have allocated. – old_timer Aug 21 '17 at 12:58
-
what is a cortex-m5? – old_timer Aug 21 '17 at 12:59
-
Thanks old_timer for your reply. I am using ARM Cortex M3. – Justin J Aug 22 '17 at 05:27
-
I mean to say M7. Did typo saying M3. – Justin J Aug 22 '17 at 06:22
1 Answers
0
To measure the stack or heap usage you have to initialize this area with a padding value before usage, you can choose one listed below
https://en.wikipedia.org/wiki/Hexspeak
For example: 0xBAADF00D or 0xDEADBEEF.
The idea is to count the number of padding value left to estimate the maximum usage.

leaumonte
- 49
- 2