To locate a stack area at specified addresses, the stack area must be allocated to a section other than .bss.
This can be done by specifying the most significant address of the section + 1 (must be arranged at a 4-byte boundary)
to the sp register (r3 register) in the startup routine, and specifying the address of the section with a link directive.
Example:
To create a stack area of a 0x200-byte section from address 0x3ffee00 in the section name of .stack
[Allocating stack area in assembler source]
.set STACKSIZE, 0x200
.section ".stack", bss
.lcomm __stack, STACKSIZE, 4
[sp register setting in startup routine]
mov #__stack+STACKSIZE, sp
[Specifying by link directive]
STACK : !LOAD ?RW V0x3ffee00 {
.stack = $NOBITS ?AW .stack;
};