mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Add GDB as alternative uploader to ststm32 platform // Resolve #175
This commit is contained in:
@ -6,25 +6,46 @@
|
||||
"""
|
||||
|
||||
import platform
|
||||
from os.path import join
|
||||
from os.path import isfile, join
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
DefaultEnvironment, SConscript)
|
||||
DefaultEnvironment, Exit, SConscript)
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
||||
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"),
|
||||
UPLOADERFLAGS=[
|
||||
"write", # write in flash
|
||||
"$SOURCES", # firmware path to flash
|
||||
"0x08000000" # flash start adress
|
||||
],
|
||||
if "gdb" in env['UPLOAD_PROTOCOL']:
|
||||
if not isfile(join(env.subst("$PROJECT_DIR"), "upload.gdb")):
|
||||
Exit(
|
||||
"You are using GDB as firmware uploader. "
|
||||
"Please specify upload commands in upload.gdb "
|
||||
"file in project directory!"
|
||||
)
|
||||
env.Replace(
|
||||
UPLOADER=join(
|
||||
"$PIOPACKAGES_DIR", "toolchain-gccarmnoneeabi",
|
||||
"bin", "arm-none-eabi-gdb"
|
||||
),
|
||||
UPLOADERFLAGS=[
|
||||
join("$BUILD_DIR", "firmware.elf"),
|
||||
"-batch",
|
||||
"-x", join("$PROJECT_DIR", "upload.gdb")
|
||||
],
|
||||
|
||||
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
|
||||
)
|
||||
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
|
||||
)
|
||||
else:
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"),
|
||||
UPLOADERFLAGS=[
|
||||
"write", # write in flash
|
||||
"$SOURCES", # firmware path to flash
|
||||
"0x08000000" # flash start adress
|
||||
],
|
||||
|
||||
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
|
||||
)
|
||||
|
||||
|
||||
env.Append(
|
||||
|
Reference in New Issue
Block a user