我使用STM32F103VC的芯片跑UCOS。但是执行了如下的代码就是进入不了PendSV_Handler。用软件仿真还是可以的,但是烧到板上就不可以了。执行这段 代码的时候BASEPRI = 0,PRIMASK = 0.这应该没有关中断吧。为什么就是进入不了呢?
NVIC_INT_CTRL EQU 0xE000ED04 ; Interrupt control state register NVIC_SYSPRI2 EQU 0xE000ED20 ; System priority register (2) NVIC_PENDSV_PRI EQU 0xFFFF0000 ; PendSV and system tick priority(Both are lowest,0xff) NVIC_PENDSVSET EQU 0x10000000 ; Value to trigger PendSV exception 触发软件中断的值
OSStartHighRdy
LDR R4, =NVIC_SYSPRI2 ; set the PendSV exception priority 设置PendSV优先级 LDR R5, =NVIC_PENDSV_PRI STR R5, [R4] MOV R4, #0 ; set the PSP to 0 for initial context switch call 使PSP等于0 MSR PSP, R4
LDR R4, =OSRunning ; OSRunning = TRUE MOV R5, #1 STRB R5, [R4]
LDR R4, =NVIC_INT_CTRL ; trigger the PendSV exception 触发软件中断 LDR R5, =NVIC_PENDSVSET STR R5, [R4]
CPSIE I ; enable interrupts at processor level 使能所有优先级的中断 OSStartHang B OSStartHang
|