rtel wrote on Saturday, November 01, 2014:
configMAX_SYSCALL_INTERRUPT_PRIORITY is probably a full 8 bit value, whereas NVIC_SetPriority() requires a shifted priority. I know this is complex but it is how the Cortex-M works. I tried explaining it on this page: http://www.freertos.org/RTOS-Cortex-M3-M4.html
Most newer projects have a conversion in the FreeRTOSConfig.h file, something like the following:
/* Cortex-M specific definitions. */
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
#define configPRIO_BITS __NVIC_PRIO_BITS
#define configPRIO_BITS 4 /* 15 priority levels */
/* The lowest interrupt priority that can be used in a call to a “set priority”
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf
/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. /
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/ !!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
So in that case configLIBRARY_LOWEST_INTERRUPT_PRIORITY is set by hand as a shifted value (and therefore easier to understand for a human) and configKERNEL_INTERRUPT_PRIORITY is then generated automatically. Likewise configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY.
The ‘LIBRARY’ prefix denoting that it is the version to be used in library function calls. So in your code you want to use configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY to prevent the assert triggering.