For example, is it at the beginning of RAM, user or silicon vendor defined?
I'd like to know such that I can identify the stack boundaries in memory and therefore know if I've caused a stack overflow in my code.
My device is an LPC1778, and Im using keil uvusion v4.
Many thanks!
Additionally, the compiler/linker work together to decide the stack starting address. A linker script normally defines the available regions of RAM memory that are present on the MCU and available for storing data. In case of LPCXpresso, the template linker script defines:
PROVIDE(${heap_symbol} = .);
PROVIDE(_vStackTop = __top_${DATA} - ${STACK_OFFSET});
You can refer to this link for a bit of additional info, as well.
The linker will also typically define symbols for the available memory regions, such as __top_RAM0 which is the end address of the first RAM block. This, and similar labels, can also be used in a startup code to set the stack.
Happy programming!