A.5.1 Allocating Stack Areas

Since the PowerON_Reset_PC function in the resetprg.c file of the startup routine is declared by "#pragma entry", the compiler and optimizing linkage editor automatically generate the initialization code for the user stack USP and interrupt stack ISP at the top of the function, based on the settings below.

(1)

Setting the User Stack

Specify the size of the stack area by #pragma stacksize su=0xXXX in the stacksct.h file, and specify the location of the SU section by the -start option of the optimizing linkage editor.

(2)

Setting the Interrupt Stack

Specify the size of the stack area by #pragma stacksize si=0xXXX in the stacksct.h file, and specify the location of the SI section by the -start option of the optimizing linkage editor.

[Example]

<resetprg.c>
...
#pragma section ResetPRG
#pragma entry PowerON_Reset_PC
void PowerON_Reset_PC(void)
{
...
<stacksct.h>
#pragma stacksize su=0x300
#pragma stacksize si=0x100

 

[Generated code example]

When // -start=SU,SI/01000 is specified
_PowerON_Reset_PC	        MVTC        #00001300H,USP
                         MVTC        #00001400H,ISP
...