It’s OpenOCD’s duty in this case to create thread-awareness. For that, the -rtos auto
(or -rtos FreeRTOS
) option must be given in the OpenOCD config file.
Unfortunately it doesn’t seem to to be possible to just give OpenOCD some commandline option to turn on FreeRTOS support.
With
You should have the file C:\Users\<user>\.platformio\packages\tool-openocd\scripts\target\stm32h7x.cfg
, where, line 86 says
$_CHIPNAME.cpu0 configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
at the end of that line append -rtos auto
.
Note that OpenOCD in the debug console may still complain about
Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around
in which case you need to follow this and create the needed variable while making sure it’s not optimized away. I e.g. achieved this by alternatively by doing
volatile int uxTopUsedPriority;
//in main():
uxTopUsedPriority = configMAX_PRIORITIES - 1;