Unable to debug FreeRTOS tasks in SW4STM32 on STM32H7 processors
Hello,
I am unable to debug FreeRTOS tasks. A bit of information first:
Windows 10
SW4STM32 Version: 2.9.1
Board: NUCLEO-H745ZI-Q
Project created with STm32CubeMX version 5.5.0 with SW4STM32 as the specified toolchain / IDE
I can run and debug code on both the M4 and M7 core fine. However, after adding FreeRTOS (CMSIS v1) to the M4 core project using STM32CubeMX, I cannot step through the StartDefaultTask(). I can step through main() up until the task is created. After the first breakpoint is hit within the task, the debugger locks up and I cannot do anything. Also the Eclipse Debug tab “breaks” when this happens (See screenshot).
I have tried adding “$_TARGETNAME configure -rtos FreeRTOS” to the bottom of my debug configuration file, but when I try to debug after doing so I am presented with the following:
-------------------
Error in final launch sequence
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
localhost:3333: The system tried to join a drive to a directory on a joined drive.
localhost:3333: The system tried to join a drive to a directory on a joined drive.
-------------------
UPDATE:
I was finally able to get past the first part of letting Eclipse / OpenOCD debugger know this is a FreeRTOS project by adding the following to the bottom of my configuration file:
$_CHIPNAME.cpu1 configure -rtos FreeRTOS
Note the differences from “$_TARGETNAME configure -rtos FreeRTOS”.
cpu1 in this case is the M4 core, and cpu0 is the M7 core.
Now I am getting the following error when trying to debug the M4 core:
---------------------
Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around
---------------------
I have tried adding “#define uxTopUsedPriority xTopReadyPriority” to FreeRTOSConfig.h and also tried adding “FreeRTOS-openocd.c” to CM4/Src and refreshed my project window. The compiler still complains with the above error.
UPDATE 2:
Well I was able to get the uxTopUsedPriority error to go away by including “FreeRTOS-openocd.c” in my project and specifying ‘-Wl,--undefined=uxTopUsedPriority’ in my linker flags.
Linker flag location: Project -> Properties -> C/C++ Build -> Settings -> MCU GCC Linker -> Miscellaneous -> Link flags
The project now builds and the debugger starts without errors, but only the M7 core debugger starts. The M4 core debugger does not start.
What am I missing?
Thanks!