Skip to content

Commit

Permalink
Merge pull request #187 from valeros/develop
Browse files Browse the repository at this point in the history
Add GDB as alternative uploader to ststm32 platform // Resolve #175
  • Loading branch information
ivankravets committed Apr 27, 2015
2 parents 2198e31 + 2206ec5 commit 5a162b6
Showing 1 changed file with 33 additions and 12 deletions.
45 changes: 33 additions & 12 deletions platformio/builder/scripts/ststm32.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],

UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
)
if env['UPLOAD_PROTOCOL'] == "gdb":
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"
)
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(
Expand Down

0 comments on commit 5a162b6

Please sign in to comment.