As you know, I'm playing with STM32 and CubeMX autogeneration code tool. I don't like ST HAL libraries generated by CubeMX, but this is my first approach to STM32 MCUs and CubeMX tool lets me have a fully-functional project in minutes. Maybe I will rewrite some HAL drivers in the future, but at the moment I'd like to leave with them.
Now I have to add FreeRTOS and this is very simple with CubeMX. However I have some doubts.
First of all CubeMX strongly suggests to change hw timer for ST HAL, because Systick is already used by FreeRTOS. I understood the problem is with interrupt priority: ST HAL needs the highest priority (because ticks counting must continue during whatever ISR, because some ISR code could wait for some time... how bad!!!); FreeRTOS needs the lowest priority (sincerely I couldn't understand why).
If you don't call ST HAL functions that uses ticks from ISR, you can leave with both modules (ST HAL and FreeRTOS) using Systick. I'm not going to block an ISR waiting for ms, so this limitation is acceptable to me. However I suspect some ST HAL ISR (USB? SD?) call HAL delay functions, so I can't be sure I will respect the limitation.
At the moment, it seems the only solution is to use two different hw timers (systick and another timer) for ST HAL and FreeRTOS. It's a waste of resources, but there isn't another immediate solution.
I know I can rewrite ST HAL drivers to avoid delays in ISR, but this can be done with UART, SPI and similar simple peripherals. But it takes time and anyway I will never rewrite USB or other complex driver.
What is your solution?