I am writing C code for an MSP430 microcontroller and I want to lock a global variable to a specific address in RAM.
The reason is because I have a stack at the end of the RAM address and grows downwards towards lower addresses. When the stack overflows, it starts overwriting global variables stored in RAM right next to the stack. So I want to write a watermark that is right next to the stack and check it for overflows.
If you know where the end of the stack should be on your MSP430 device, you could do this, for example:
Here’s someone that has your same question, on the TI forums… it looks helpful: http://e2e.ti.com/support/development_tools/compiler/f/343/t/92002.aspx