You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue was discovered in the MAX32690 BLE FreeRTOS example project. Other FreeRTOS projects across all MCUs should be evaluated.
In the FreeRTOSConfig.h file for this project, configMAX_PRIORITIES is redefined to be associated with the number of interrupt priorities. This is incorrect. configMAX_PRIORITIES is used to define the number of available task priorities in the FreeRTOS kernel, and unrelated to interrupts.
/* # of priority bits (configured in hardware) is provided by CMSIS */
#define configPRIO_BITS __NVIC_PRIO_BITS
#define configMAX_PRIORITIES ((0x1 << configPRIO_BITS) - 1)
/* Only the top three bits are implemented. This is the lowest priority. */
#define configKERNEL_INTERRUPT_PRIORITY \
((unsigned char)configMAX_PRIORITIES << (8 - configPRIO_BITS))
From that redefinition, stack_dats.c uses configMAX_PRIORITIES to assign the IRQ priorities for the system. This works in the example project because of the redefinition of configMAX_PRIORITIES to be related to configPRIO_BITS. IRQ Priority Assignment.
/* Interrupts using FreeRTOS functions must have priorities between configMAX_PRIORITIES and
configMAX_SYSCALL_INTERRUPT_PRIORITY, lower priority number is higher priority */
/* Setup BLE hardware interrupt priorities */
NVIC_SetPriority(BTLE_TX_DONE_IRQn, (configMAX_PRIORITIES - 2));
NVIC_SetPriority(BTLE_RX_RCVD_IRQn, (configMAX_PRIORITIES - 2));
NVIC_SetPriority(BTLE_RX_ENG_DET_IRQn, (configMAX_PRIORITIES - 2));
However, if FreeRTOSConfig.h is changed or a "stock" FreeRTOSConfig.h is used without repurposing the configMAX_PRIORITIES definition, the IRQs will likely be assigned the wrong priority due to the shifting and masking done in the NVIC code.
All FreeRTOS projects should be revisited to ensure coherence with the intended use of these definitions.
The text was updated successfully, but these errors were encountered:
This issue was discovered in the MAX32690 BLE FreeRTOS example project. Other FreeRTOS projects across all MCUs should be evaluated.
In the FreeRTOSConfig.h file for this project, configMAX_PRIORITIES is redefined to be associated with the number of interrupt priorities. This is incorrect. configMAX_PRIORITIES is used to define the number of available task priorities in the FreeRTOS kernel, and unrelated to interrupts.
FreeRTOS Documentation
Project's FreeRTOSConfig.h
From that redefinition, stack_dats.c uses configMAX_PRIORITIES to assign the IRQ priorities for the system. This works in the example project because of the redefinition of configMAX_PRIORITIES to be related to configPRIO_BITS. IRQ Priority Assignment.
However, if FreeRTOSConfig.h is changed or a "stock" FreeRTOSConfig.h is used without repurposing the configMAX_PRIORITIES definition, the IRQs will likely be assigned the wrong priority due to the shifting and masking done in the NVIC code.
All FreeRTOS projects should be revisited to ensure coherence with the intended use of these definitions.
The text was updated successfully, but these errors were encountered: