This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bug in FreeRTOS Max System Call Priority Check

I found a bug in the FreeRTOS port provided by Nordic for the nRF52832 in SDK v11.0.0. This bug only applies if configASSERT_DEFINED is equal to 1, as the affected code is used to check that an ISR safe FreeRTOS API function is not being called from an interrupt priority that is too high.

The highest interrupt priority that an ISR safe FreeRTOS function can be called from is defined by configMAX_SYSCALL_INTERRUPT_PRIORITY in FreeRTOSConfig.h. At line 245 in port_cmsis.c, this definition is used to set ucMaxSysCallPriority to the proper value. However, the definition is not shifted to the correct position in the byte, as it is done at other places in the port.

Original (line 245 in port_cmsis.c)

ucMaxSysCallPriority = configMAX_SYSCALL_INTERRUPT_PRIORITY & ucMaxPriorityValue;

New (line 245 in port_cmsis.c)

ucMaxSysCallPriority = (configMAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) & ucMaxPriorityValue;
Related