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!
I think I've found this.
As stated in the M3 general user guide, its whatever address is at 0x0000 0000 when the program starts... I was getting confused because I mistakenly read that as the address 0x0000 0000 and found that weird.
This is a platform-specific question, as you said, silicon vendor defined.
Normally stack goes downwards. So, I expect it to be at certain high address of your board. But it is definitely not at address 0x000000. That is where normally vector table is located.
It's not vendor-defined in any way other than the vendor/manufacturer will provide some suitable memory at a particular location. In a Cortex-M3, RAM can only be located at certain specific address ranges in t he address map so you will always find the stack located in one of these.
The exact starting address of the stack pointer (the top of the stack) is defined by the startup code in the program which runs at reset. As you found, the processor reads the first two words of memory on startup. The first word is used for the initial stack pointer value and the second word for the address of the reset handler.
Hope this helps.
Chris