In my FreeRTOS project, I have found that vPortStartFirstTask will either run or app-fault depending on the value of
configMAX_SYSCALL_INTERRUPT_PRIORITY. With configMAX_SYSCALL_INTERRUPT_PRIORITY=8 (on the STM32 scale of 0…15 where 0 is highest prio), the code runs; with configMAX_SYSCALL_INTERRUPT_PRIORITY=7, the code app-faults at “svc 0” in vPortStartFirstTask .
There are 4 priority levels in use:
15: systick, pendsv
0: all other system interrupts
8: some NVIC interrupts
11: some other NVIC interrupts
Here are two questions.
1. A CM3 question: I do not understand how there can be distinct behaviour with BASEPRI 7 versus BASEPRI 8. There is no interrupt at prio==7, and besides “success” in this case means successfully doing a ctx from vPortStartFirstTask . What is a possible mechanism here?
2. A FreeRTOS question: There are a few forum threads that tweak vPortStartFirstTask to solve CM3 issues. In one “cpsie i” was added to turn on global interrupts before “svc 0”. But I notice that when I step to “svc 0” in vPortStartFirstTask , that the CPU register BASEPRI is non-zero. That is, vPortSetInterruptMask has been called but not cleared. Is this intentional, or should I modify vPortStartFirstTask to clear the interrupt mask?
Thanks for your suggestions.
Setup : FreeRTOS V7.0.2, STM32, IAR EWARM 5.30 .