5555#define portNVIC_PEND_SYSTICK_SET_BIT ( 1UL << 26UL )
5656#define portNVIC_PEND_SYSTICK_CLEAR_BIT ( 1UL << 25UL )
5757
58- #define portNVIC_PENDSV_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )
59- #define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )
58+ #define portMIN_INTERRUPT_PRIORITY ( 255UL )
59+ #define portNVIC_PENDSV_PRI ( ( ( uint32_t ) portMIN_INTERRUPT_PRIORITY ) << 16UL )
60+ #define portNVIC_SYSTICK_PRI ( ( ( uint32_t ) portMIN_INTERRUPT_PRIORITY ) << 24UL )
6061
6162/* Constants required to check the validity of an interrupt priority. */
6263#define portFIRST_USER_INTERRUPT_NUMBER ( 16 )
8687 * have bit-0 clear, as it is loaded into the PC on exit from an ISR. */
8788#define portSTART_ADDRESS_MASK ( ( StackType_t ) 0xfffffffeUL )
8889
89- /* For backward compatibility, ensure configKERNEL_INTERRUPT_PRIORITY is
90- * defined. The value 255 should also ensure backward compatibility.
91- * FreeRTOS.org versions prior to V4.3.0 did not include this definition. */
92- #ifndef configKERNEL_INTERRUPT_PRIORITY
93- #define configKERNEL_INTERRUPT_PRIORITY 255
94- #endif
95-
9690/* Let the user override the default SysTick clock rate. If defined by the
9791 * user, this symbol must equal the SysTick clock rate when the CLK bit is 0 in the
9892 * configuration register. */
@@ -214,10 +208,6 @@ static void prvTaskExitError( void )
214208 */
215209BaseType_t xPortStartScheduler ( void )
216210{
217- /* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0.
218- * See https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
219- configASSERT ( configMAX_SYSCALL_INTERRUPT_PRIORITY );
220-
221211 #if ( configASSERT_DEFINED == 1 )
222212 {
223213 volatile uint32_t ulOriginalPriority ;
@@ -242,6 +232,14 @@ BaseType_t xPortStartScheduler( void )
242232 /* Use the same mask on the maximum system call priority. */
243233 ucMaxSysCallPriority = configMAX_SYSCALL_INTERRUPT_PRIORITY & ucMaxPriorityValue ;
244234
235+ /* Check that the maximum system call priority is nonzero after
236+ * accounting for the number of priority bits supported by the
237+ * hardware. A priority of 0 is invalid because setting the BASEPRI
238+ * register to 0 unmasks all interrupts, and interrupts with priority 0
239+ * cannot be masked using BASEPRI.
240+ * See https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
241+ configASSERT ( ucMaxSysCallPriority );
242+
245243 /* Calculate the maximum acceptable priority group value for the number
246244 * of bits read back. */
247245 ulMaxPRIGROUPValue = portMAX_PRIGROUP_BITS ;
0 commit comments