This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Stack overflow protection: How to allocate the stack at the start of the RAM?

Other Parts Discussed in Thread: MSP430F5309

Hi

I'm developping on MSP430, which as a stack growing downward. 

To prevent the stack to overflow on data and code running in RAM (in case of occurrence), I would like to allocate the stack in the start of the RAM.

How should I edit my cmd linker file, so the .stack is located at the start of the RAM?

In my cmd file, I have a MEMORY block named RAM and here is a copy of the SECTIONS part allocating code to RAM: 

SECTIONS

{

.bss : {} > RAM             /* GLOBAL & STATIC VARS */
.data : {} > RAM           /* GLOBAL & STATIC VARS */
.sysmem : {} > RAM    /* DYNAMIC MEMORY ALLOCATION AREA */
.stack : {} > RAM (HIGH)     /* SOFTWARE SYSTEM STACK */

[...]

Are the sections allocated in this order?

I tried to set .stack first, but it didn't change any in the "Memory Allocation view" window.

Thank you for help,

M.