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", "basearm.py")))
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "ststm32.py")))
env.Replace(
UPLOADCMD='start /b %HOMEDRIVE%%HOMEPATH%\.platformio\packages\\tool-stlink\st-util & "$UPLOADER" $UPLOADERFLAGS'
)
Yes, here is the full platformio.ini file:
[env:disco_f407vg]
platform = ststm32
framework = cmsis
board = disco_f407vg
build_flags = -Wl,-TH:/mcu/test/stm32_ram.ld
UPLOAD_PROTOCOL = gdb
extra_script = stutil.py
upload.dbg file:
target remote localhost:4242
load
quit
1 Like
Cool!
Happy Coding with PlatformIO! 
Thx
Now just have to reduce warings… 