#pragma section IntPRG // Exception(Supervisor Instruction) void Excep_SuperVisorInst(void){/* brk(); */} // Exception(Undefined Instruction) void Excep_UndefinedInst(void){/* brk(); */} // Exception(Floating Point) void Excep_FloatingPoint(void){/* brk(); */} // NMI void NonMaskableInterrupt(void){/* brk(); */} // Dummy void Dummy(void){/* brk(); */}
#pragma section C FIXEDVECT void* const Fixed_Vectors[] = { //;0xffffffd0 Exception(Supervisor Instruction) (void*) Excep_SuperVisorInst, //;0xffffffd4 Reserved Dummy, //;0xffffffd8 Reserved Dummy, //;0xffffffdc Exception(Undefined Instruction) (void*) Excep_UndefinedInst, //;0xffffffe0 Reserved Dummy, //;0xffffffe4 Exception(Floating Point) (void*) Excep_FloatingPoint, //;0xffffffe8 Reserved Dummy, //;0xffffffec Reserved Dummy, //;0xfffffff0 Reserved Dummy, //;0xfffffff4 Reserved Dummy, //;0xfffffff8 NMI (void*) NonMaskableInterrupt, //;0xfffffffc RESET PowerON_Reset_PC };
初始化PSW寄存器
#pragma stacksize su=0x300 #pragma stacksize si=0x100
#pragma unpack #pragma section C C$DSEC extern const struct { _UBYTE *rom_s; /* Start address of the initialized data section in ROM */ _UBYTE *rom_e; /* End address of the initialized data section in ROM */ _UBYTE *ram_s; /* Start address of the initialized data section in RAM */ } _DTBL[] = { { __sectop("D"), __secend("D"), __sectop("R") }, { __sectop("D_2"), __secend("D_2"), __sectop("R_2") }, { __sectop("D_1"), __secend("D_1"), __sectop("R_1") } }; #pragma section C C$BSEC extern const struct { _UBYTE *b_s; /* Start address of non-initialized data section */ _UBYTE *b_e; /* End address of non-initialized data section */ } _BTBL[] = { { __sectop("B"), __secend("B") }, { __sectop("B_2"), __secend("B_2") }, { __sectop("B_1"), __secend("B_1") } }; #pragma section /* ** CTBL prevents excessive output of L1100 messages when linking. ** Even if CTBL is deleted, the operation of the program does not change. */ _UBYTE * const _CTBL[] = { __sectop("C_1"), __sectop("C_2"), __sectop("C"), __sectop("W_1"), __sectop("W_2"), __sectop("W") }; #pragma packoption
#define PSW_init 0x00010000 #define FPSW_init 0x00000100 #pragma section ResetPRG #pragma entry PowerON_Reset_PC void PowerON_Reset_PC(void) { set_intb((unsigned long)__sectop("C$VECT")); set_fpsw(FPSW_init); _INITSCT(); nop(); set_psw(PSW_init); main(); }
至此,RX62N初始化完成, 并执行main函数。