cancel
Showing results for 
Search instead for 
Did you mean: 

Wouldn't it be much safer to initialize FreeRTOS before enabling interrupts?

Philipp Legrum
Associate II

Using FreeRTOS on a STM32L476RG we get unreliable boot behaviour because CubeMX generates:

...

 /* Initialize interrupts */

 MX_NVIC_Init();

 /* USER CODE BEGIN 2 */

 /* USER CODE END 2 */

 /* Call init function for freertos objects (in freertos.c) */

 MX_FREERTOS_Init();

...

Some assertion within the ISR hadler will fail because we sometimes get interrupts between MX_NVIC_Init(); and MX_FREERTOS_Init() -> Chip does not boot reliably. Classical race condition. (I our case there is no way we can prevent the interrupt from happening once our device is powered up.)

Wouldn't it be a better default to change the relative orders of the calls?

0 REPLIES 0