Sorry, you need to enable JavaScript to visit this website.

Heap and Stack Usage and Locations

3 posts / 0 new
patmicom's picture
Heap and Stack Usage and Locations

I have a bare metal, dual processor application. Code appears to work well after changing the lscript.ld files to increase the stack and heap allocation on both processors. Picked heap and stack sizes based on experimentation until it worked.

Few question:
1) I want to make sure I have allocated enough heap and stack. When my program is running, how do I tell exactly how much stack and heap space is unused and still available? I want to make sure I have margin.

2) I believe I could figure out the previous problem if I knew the pyhsical address that the stack and space are mapped to. When specifying the sizes in the lscript.ld, how do you know the exact physical memory locations that they are mapped to?


TroutChaser's picture
If you open the .elf file for

If you open the .elf file for your application, in the SDK Project Explorer pane under 'your_application_name' > Binaries > 'your_application_name.elf', you should be able to determine the physical address that the stack and heap are mapped to.
I don't know of any utility to check how much stack or heap memory are actually used, but a crude way to check would be to fill the stack and heap area with a known data pattern prior to running your application and then checking how much of the area was actually overwritten when your application has run.

sourajitjash's picture
have you found how to determine required stack and heap size?

I am having the same type of problem. As my code size is large, it is tough for me to set proper stack and heap size. For small programs I did using some hit and trial. So did you figure any effective procedure? Thank you