mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 01:57:13 +02:00
Add GDB as alternative uploader to ststm32 platform // Resolve #175
This commit is contained in:
@ -6,25 +6,46 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
from os.path import join
|
from os.path import isfile, join
|
||||||
|
|
||||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||||
DefaultEnvironment, SConscript)
|
DefaultEnvironment, Exit, SConscript)
|
||||||
|
|
||||||
env = DefaultEnvironment()
|
env = DefaultEnvironment()
|
||||||
|
|
||||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
||||||
|
|
||||||
env.Replace(
|
if "gdb" in env['UPLOAD_PROTOCOL']:
|
||||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"),
|
if not isfile(join(env.subst("$PROJECT_DIR"), "upload.gdb")):
|
||||||
UPLOADERFLAGS=[
|
Exit(
|
||||||
"write", # write in flash
|
"You are using GDB as firmware uploader. "
|
||||||
"$SOURCES", # firmware path to flash
|
"Please specify upload commands in upload.gdb "
|
||||||
"0x08000000" # flash start adress
|
"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(
|
env.Append(
|
||||||
|
Reference in New Issue
Block a user