Stack bottom

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Stack bottom

215 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ronkrem on Sun Dec 22 06:01:04 MST 2013
I can find the stack top from the memory map, but how do I find the address of the bottom of the available stack area in an LPCXpresso program? I need these addresses to implement a stack usage monitor within my program.
Regards
0 Kudos
2 Replies

191 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ronkrem on Sun Jan 05 06:15:42 MST 2014
After some more map file searching I can now setup the stack for background monitoring. Here is the setup code:

#ifdef DEBUG_STACK
    StackBottom = (uint8_t*)((__heaps     & 0xfffffff0) + 0x20);
    StackTop    = (uint8_t*)((__get_MSP() & 0xfffffff0) - 0x20);
    StackPtr = StackTop;
    StackSize = StackTop - StackBottom;
    memset(StackBottom, FLAG_BYTE, StackSize);
#endif


Regards, Ron
0 Kudos

191 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Sun Dec 22 10:11:22 MST 2013
This may help you...
http://www.lpcware.com/content/faq/lpcxpresso/heap-checking-redlib
0 Kudos