Everything
8.2.4 Stack area allocation, stack pointer setting, and stack area initialization

The start (__STACK_ADDR_END) and end (__STACK_ADDR_START) of the stack area are determined by the linker. Since the CC-RL stack area is extended in the direction of address 0x0, set the end (__STACK_ADDR_START) of the stack area used by the system to the stack pointer. For __STACK_ADDR_START and __STACK_ADDR_END, see "6.2.2 Symbols generated by option specifications".

 

To set the SP in the startup routine, write the code as follows.

MOVW    SP,#LOWW(__STACK_ADDR_START)

 

Next, initialize the stack area. The start (__STACK_ADDR_END) of the stack area is passed as an argument. To detect parity errors in response to reading from non-initialized RAM areas, enable the processing for initializing the stack area. If you do not intend to detect parity errors in response to reading from non-initialized RAM areas or the device does not support this facility, the stack area does not need to be initialized. In such cases, comment out the code for initializing the stack area.

MOVW    AX,#LOWW(__STACK_ADDR_END)
CALL    !!_stkinit