Debugging STM32F407 + FreeRTOS, can't break point other threads

Hi all,

I’m trying to debug some STM32F407 code generated by STM32CubeIDE, that includes FreeRTOS and LwIP. Because it seems to have different behavior when I compile and upload via STM32CubeIDE vs PlatformIO.

But I’m not able to break point in some driver code for LwIP. I think this piece code runs in another thread. I got this error when I try to put breakpoint:

Unable to get thread information: Cannot execute this command while the target is running.
Use the “interrupt” command to stop the target
and then try again. (from thread-info 1)

This is my configuration in platformio.ini:

platform = ststm32
board = genericSTM32F407VET6
framework = stm32cube
board_build.stm32cube.custom_config_header = yes
board_build.stm32cube.custom_system_setup = yes
board_build.stm32cube.startup_file = startup_stm32f407vgtx.s

platform_packages =
    framework-stm32cubef4 @

upload_protocol = stlink    

build_type = release
build_flags = -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -DHSE_VALUE=16000000L -fstack-usage -O0 -fdata-sections -MMD -MP -g3

build_type = debug
debug_tool = stlink
debug_build_flags = -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -DHSE_VALUE=16000000L -fstack-usage -O0 -fdata-sections -MMD -MP -g3 -Og
debug_init_break = tbreak main
debug_init_cmds =
  target extended-remote $DEBUG_PORT
  monitor reset halt
  monitor init
  monitor reset halt

Is also notice that STM32CubeIDE uses ST-Link GDB server where PlatformIO uses OpenOCD. Is this related? There is a way to use ST-Link GDB server in PlatformIO?

Same when you first press the pause button and then set the breakpoint?

yes, same issue.

I also noticed this message in the logs:

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread 

Might be the reason why the breakpoint on stops on main?