**** 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.

How do I increase the Stack Size?

If you are using a Red Suite generated startup and linker script, there is no need to increase the stack size. This is because we do not allocate a fixed size for the stack. Instead we automatically place the start of the stack into the highest available RAM location.

As the stack grows 'down' the available space for the stack is the space between the top of Data (and Heap). You will only run into problems when the space for your data and heap grows too large, leaving little space for the stack.

If you are using the LMI method of creating the stack (allocating a fixed-size array called static unsigned long pulStack[xx] in the startup.c file), then you can just increase the size.

Both methods are equally valid and have their own advantages and disadvantages. The advantage with the Code Red method is that you do not need to allocate the space. The disadvantage is that if your application is close to using all available RAM, the linker will not help you. The advantage of the LMI method is that in tight-memory situations, the linker will inform you that you have exceeded the available RAM. The disdvantages are that when you overflow the stack, you will immediately start overwriting data, and if you need to increase the stack size you have to do it manually.

Note that the Cortex-M3 has no stack checking and thus, whichever method you use for creating the the stack, if it overflows then it will just start to overwrite data and you will not know - until your application starts to behave in strange ways!

StackSize (last edited 2010-09-29 14:58:01 by CrSupportAb)