Add "extra" command (st-util) before arm-none-eabi-gdb run

I use STM32F4Discovery board with gdb upload. But I have tu run st-util every time before upload in a different command line.
Anyone know an easy method how to add this to the upload method,

By the way I use GDB because I not use the flash of the MCU and upload entire program to RAM and found simplies way to upload to proper address with gdb.

Please take a look at 4-th example Redirecting...

I temporary hacked with custom script:

from os.path import isfile, join

from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
                          DefaultEnvironment, SConscript)

env = DefaultEnvironment()

SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "")))
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "")))

    UPLOADCMD='start /b %HOMEDRIVE%%HOMEPATH%\.platformio\packages\\tool-stlink\st-util & "$UPLOADER" $UPLOADERFLAGS'

Do you use extra_script?

Yes, here is the full platformio.ini file:

platform = ststm32
framework = cmsis
board = disco_f407vg
build_flags = -Wl,-TH:/mcu/test/stm32_ram.ld

extra_script =

upload.dbg file:

target remote localhost:4242
1 Like


Happy Coding with PlatformIO! :blush:


Now just have to reduce warings… :slight_smile: