How to disable debug_init_break?

Is there a way to disable debug_init_break such that when running under the debugger, the program will run with no initial breakpoint?

My platformio.ini is as follows and I am using a STM32H750 with STLinkV2.


[env:my_env]
build_type = debug
; build_type = release
platform = ststm32
extra_scripts = extra_script.py
board = my_genericSTM32H750VBT6
; Linker file is from cube ide.
board_build.ldscript = STM32H750VBTX_FLASH.ld
debug_tool = stlink
upload_protocol = stlink
debug_build_flags = -Os -g3 -ggdb3
debug_init_break = tbreak app_main
test_framework = custom
; test_port = COM6
monitor_port = COM6
lib_archive = no
check_skip_packages = yes
lib_deps = 
  adc
  data_recorder
  host_link
  io
  misc
  printer_link
  controller
  cube_ide
  serial_packets
  system
  ; unity
build_flags =
  -fmax-errors=5
  -Werror
  -mfpu=fpv5-sp-d16 
  -mfloat-abi=hard 
  -Wl,-Map,${BUILD_DIR}/firmware.map
  -mthumb 
  -D DEBUG
  -D USE_HAL_DRIVER
  -DSTM32_THREAD_SAFE_STRATEGY=4
  -fstack-usage
  -std=gnu11
  -Ilib/cube_ide/Core/Inc
  -Ilib/cube_ide/Core/ThreadSafe
  -Ilib/cube_ide/Drivers/CMSIS/Device/ST/STM32H7xx/Include
  -Ilib/cube_ide/Drivers/CMSIS/Include
  -Ilib/cube_ide/Drivers/STM32H7xx_HAL_Driver/Inc
  -Ilib/cube_ide/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
  -Ilib/cube_ide/Middlewares/ST/STM32_USB_Device_Library/Core/Inc
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/Include
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/include
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F
  -Ilib/cube_ide/Middlewares/Third_Party/FatFs/src
  -Ilib/cube_ide/USB_DEVICE/App
  -Ilib/cube_ide/USB_DEVICE/Target
  -Ilib/cube_ide/FATFS/App
  -Ilib/cube_ide/FATFS/Target
  -D CONFIG_MAX_PACKET_DATA_LEN=1000
  -D CONFIG_MAX_PENDING_COMMANDS=5

Setting it to an empty value should mean nothing is executed.

debug_init_break =

Thanks @maxgerhardt. With an empty debug_init_break it breaks at the starting address. Any suggestions?

I guess a workaround would be to set a breakpoint at some non reachable statement but I hope there is a cleaner solution. E.g, to set it to ‘none’.

… actually, if I try the line below (‘none’ is a non existing symbol), it does run the program with no initial breakpoint, but it doesn’t switch to the debug tab on the right.

  1. Will it be possible to switch the to the debug tab when debugging?

  2. Also, I think that platformio should also switch earlier to the debug console tab, as soon as the debug build starts to output there its log. Otherwise there is a long period where nothing happens on the screen.

[stm32h7x.cpu0] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08003564 msp: 0x24080000
Start address 0x8003564, load size 74008
Transfer rate: 40 KB/sec, 6728 bytes/write.
[stm32h7x.cpu0] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08003564 msp: 0x24080000
[stm32h7x.cpu0] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08003564 msp: 0x24080000
Function "none" not defined.   <<<##################
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
PlatformIO: Initialization completed
[New Thread 604059680]
[New Thread 604056512]

Do you want to attach to the device, without resetting or halting it? I think the “PIO Debug (without Uploading)” is that then?

Alternatively you need to disable some debug_init_cmds to to prevent a monitor reset

@maxgerhardt , I would like to do the normal build/upload/debug but just without the initial temporary break. That is, the normal full debug but the program breaks just on the breakpoints I marked in the source code.

As at Aug 2023, this line worked for me:

debug_init_break = tbreak

The documentation page here lists a bunch of options. The first line may be a little out of date.

Thanks James. When I try tbreak with no value and all breakpoints removed, it immediately breaks , somewhere in the Idle task of FreeRTOS.

debug_init_break = tbreak