@@ -95,13 +95,15 @@ typedef void ( * portISR_t )( void );
9595#define portPERIPHERALS_START_ADDRESS 0x40000000UL
9696#define portPERIPHERALS_END_ADDRESS 0x5FFFFFFFUL
9797
98- /* Constants required to access and manipulate the SysTick. */
98+ /* Constants required to access and manipulate the SysTick and other FreeRTOS
99+ * interrupts. */
99100#define portNVIC_SYSTICK_CLK ( 0x00000004UL )
100101#define portNVIC_SYSTICK_INT ( 0x00000002UL )
101102#define portNVIC_SYSTICK_ENABLE ( 0x00000001UL )
102103#define portMIN_INTERRUPT_PRIORITY ( 255UL )
103104#define portNVIC_PENDSV_PRI ( ( ( uint32_t ) portMIN_INTERRUPT_PRIORITY ) << 16UL )
104105#define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) portMIN_INTERRUPT_PRIORITY ) << 24UL )
106+ #define portNVIC_SVC_PRI ( ( ( uint32_t ) configMAX_SYSCALL_INTERRUPT_PRIORITY - 1UL ) << 24UL )
105107
106108/* Constants required to manipulate the VFP. */
107109#define portFPCCR ( ( volatile uint32_t * ) 0xe000ef34UL ) /* Floating point context control register. */
@@ -966,12 +968,11 @@ BaseType_t xPortStartScheduler( void )
966968 }
967969 #endif /* configASSERT_DEFINED */
968970
969- /* Make PendSV and SysTick the same priority as the kernel, and the SVC
970- * handler highest priority so it can be used to exit a critical section
971- * (where lower priorities are masked). */
971+ /* Make PendSV and SysTick the lowest priority interrupts, and configure
972+ * SVCall for sufficient preemption priority. */
972973 portNVIC_SHPR3_REG |= portNVIC_PENDSV_PRI ;
973974 portNVIC_SHPR3_REG |= portNVIC_SYSTICK_PRI ;
974- portNVIC_SHPR2_REG = 0 ;
975+ portNVIC_SHPR2_REG = portNVIC_SVC_PRI ;
975976
976977 /* Configure the regions in the MPU that are common to all tasks. */
977978 prvSetupMPU ();
0 commit comments