_ISR_STARTADDRESS EQU 0xC7FF000 UserStack EQU _ISR_STARTADDRESS SVCStack EQU _ISR_STARTADDRESS+256 UndefStack EQU _ISR_STARTADDRESS+256*2 AbortStack EQU _ISR_STARTADDRESS+256*3 IRQStack EQU _ISR_STARTADDRESS+256*4 FIQStack EQU _ISR_STARTADDRESS+256*5 UserMode EQU 0x10 FIQMode EQU 0x11 IRQMode EQU 0x12 SVCMode EQU 0x13 AbortMode EQU 0x17 UndefMode EQU 0x1B SYSMode EQU 0x1F ModeMask EQU 0x1F AREA Stack_Init, CODE, READONLY ENTRY start MRS R0, CPSR BIC R0, #ModeMask ; 设置系统模式的SP(用户模式共用SP) ORR R1, R0, #SYSMode MSR CPSR_c, R1 LDR SP, = UserStack ; 设置快中断模式的SP ORR R1, R0, #FIQMode MSR CPSR_c, R1 LDR SP, = FIQStack ; 设置中断模式的SP ORR R1, R0, #IRQMode MSR CPSR_c, R1 LDR SP, = IRQStack ; 设置管理模式的SP ORR R1, R0, #SVCMode MSR CPSR_c, R1 LDR SP, = SVCStack ; 设置中止模式的SP ORR R1, R0, #AbortMode MSR CPSR_c, R1 LDR SP, = AbortStack ; 设置未定义模式的SP ORR R1, R0, #UndefMode MSR CPSR_c, R1 LDR SP, = UndefStack Stop B Stop END