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.
Next, initialize the stack area. The start (__STACK_ADDR_END) of the stack area is passed as an argument. If parity error detection by reading uninitialized RAM is not performed, the stack area does not have to be initialized.