**** Advance Notice ****

This site will be closed on 31 December 2015,

Important Information for users of NXP LPCXpresso

This site is for users of Code Red branded products.

NXP LPCXpresso users should visit the LPCXpresso FAQ's for up-to-date information relevant to that product.

Stack problems

There is no stack checking on the Cortex-M families, so you have to be careful where you place the stack, program data, and the heap (e.g. malloc() space).

If you are using the standard (provided) linker scripts, the stack is placed at the top of RAM, program data is at the bottom on RAM, and the heap immediately after that.

If you are using a lot of stack, it can grow into the heap or even the program data space. If the stack has 'overflowed' into those spaces, when you write to the heap/program data it can overwrite values on the stack and thus corrupt it.

The stack is used for both your application AND any interrupts that may be firing (including nested interrupt), so you need to ensure there is enough space for the worst-case scenario.

Also, check that you are not allocating large amounts of data on the stack (e.g. allocating a local array, as this will be placed on the stack).

StackProblems (last edited 2010-09-20 16:30:37 by CrSupportAb)