I'm learning how to use an RTOS (FreeRTOS in this case) and I have a couple of questions about its interoperability with HAL. So now I have a project generated by STM32CubeMX v4.22.1 with FreeRTOS selected and some options tuned.
1. The stm32l0xx_hal_conf.h contains a definition "#define USE_RTOS 0U", when I change it to 1U HAL fails to compile on this line: "#error "USE_RTOS should be 0 in the current HAL release"". What does it mean? Is HAL ready to work with an RTOS?
2. For example the default (weakly defined) HAL_Delay function will not work well with FreeRTOS, I think it would be better to redefine it in the generated freertos.c file to use the osDelay function instead of wasting cycles and preventing the RTOS kernel to switch to another task. Or am I wrong?
Redefining HAL_Delay isn't very straightforward because all the clocks and peripherals initialization in main.c is done before initializing the RTOS, so osDelay won't work in the beginning.
It seems internally HAL_Delay is only called in the stm32l0xx_hal_pcd_ex.c module of the HAL (at least in STM32CubeL0), so that's not that much bad.