CMSIS-RTOS can't function properly due to issue in FreeRTOSConfig.h in FW 1.10.0
I’m trying to run a class on getting started in embedded systems, working up to using an RTOS and I’m having a few issues with the CMSIS-RTOS implementation in openSTM32.
I am working with the STM32F401C-Disco board and the HAL.
I create a new project using the “Ac6 STM32 MCU Project” Project type. Give it a name. Choose the STM32F401C-DISCO board. Tell it to use the Cube HAL. “As sources in the application project” and choose FreeRTOS to be included.
The version of the HAL firmware that it downloaded is “STM32Cube_FW_F4_V1.10.0” which is odd as this is not available in Cube from ST yet, ST still are only offering V1.9.0. Then I create the project.
In startup/startup_stm32f401xc.s we see that on line 158 it installs the symbol for “SysTick_Handler”. In Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOSConfig.h we see on lines 167-169 that the symbol USE_RTOS_SYSTICK has been defined and that the line:
”# define xPortSysTickHandler Systick_Handler” becomes active.
Problem, the vector table contains SysTick_Handler (with 3 capital letters) and the tick handler symbol is Systick_Handler (with 2 capital letters). The tick handler routine is never installed except for a weak routine.
The point, Tick is not the same as tick. There is a capitalization problem in the symbols.
Putting together a simple app, will always lead it to fail as soon as the first tick happens, right around the time that osKernelStart tries to start the first task.
Fixing the reference in FreeRTOSConfig.h gives a program that runs for a very short time before it corrupts the stack.
Generating a base program in CubeMX and importing it into Eclipse gives a set of base code, using firmware 1.9.0, with the same tasks, will happily run 3 tasks for days.