Hi guys,
I found in armv8-arch ref manual that when PRIS bit in the AIRCR is set, the priority of non-secure handler is mapped to the bottom of the priority range. So I did an experiment.
I configured two exceptions, systick and svc. The priority are 2 and 1 respectively.
Then I set the PRIS bit in the AIRCR register in secure world, and called svc in the non-secure world. But I found the secure systick interrupt can't preempt the non-secure svc handler.
I don't know why. Anyone can help? Thanks!
Wenchuan
Codes are below:
main_s.c:
/*=======================================* config systick prio 2*=====================================*/
SysTick_Config(0xff); NVIC_SetPriority(SysTick_IRQn, 2); /*=======================================* config svc prio 1 *=====================================*/ NVIC_SetPriority(SVCall_IRQn, 1); SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_PRIS_Msk);
main_ns.c
svcall();
void svcall(){ __asm("SVC 0");}
non-secure interrupt handler
int flag = 0;
void SVC_Handler(void){ volatile int i = 0; flag = 0; for(; i < 0xFFFFFFF; i ++); flag = 1;}