Skip to main content
Philipp Legrum
Visitor II
September 4, 2019
Question

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

  • September 4, 2019
  • 0 replies
  • 481 views

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?

This topic has been closed for replies.