Monitoring Stack Size

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

Monitoring Stack Size

1,860 Views
historysmistory
Contributor I

I am developing an application for the LPC4088 using the LPC-Link2 probe and I am looking for ways to monitor the size of the stack ideally in real time. Any suggestions?

Labels (1)
0 Kudos
2 Replies

948 Views
lpcware
NXP Employee
NXP Employee
bump
0 Kudos

948 Views
lpcxpresso_supp
NXP Employee
NXP Employee

There are a number of ways this might be done.

One idea is to capture the stack pointer from an interrupt routine such as systick. LPCXpresso IDE creates projects using a single stack model for exceptions - but take care that you monitor the intended stack.  Code like the example below could be used the capture the stack:

__STATIC_INLINE uint32_t __get_MSP(void)

{

  register uint32_t __regMainStackPointer     __ASM("msp");

  return(__regMainStackPointer);

}

Once the data has been captured, it could be saved into a global variable, then within LPCXpresso IDE this global variable could be monitored using SWO Datatrace.

Overview of Trace support in LPCXpresso IDE

Yours,

LPCXpresso-support

0 Kudos