Skip to content

Commit

Permalink
Merge branch 'release/v1.5.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Aug 11, 2018
2 parents 93ad2e7 + b42f662 commit f72a748
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 34 deletions.
71 changes: 38 additions & 33 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
DefaultEnvironment)

env = DefaultEnvironment()
board_config = env.BoardConfig()

env.Replace(
AR="pic32-ar",
Expand All @@ -30,6 +31,30 @@

ARFLAGS=["rc"],

SIZEPROGREGEXP=r"^(?:\.reset|\.image_ptr_table|\.app_excpt|\.vector\S*|\.startup|\.init|\.fini|\.ctors|\.dtors|\.header_info|\.dinit|\.text\S*|\.rodata\S*|\.data)\s+([0-9]+).*",
SIZEDATAREGEXP=r"^(?:\.ram_exchange_data|\.dbg_data|\.sdata|\.sbss|\.data\S*|\.stack|\.bss|\.comment.__use_force_isr_install|\.eh_frame|\.jcr)\s+([0-9]+).*",
SIZECHECKCMD="$SIZETOOL -A -d $SOURCES",
SIZEPRINTCMD='$SIZETOOL -B -d $SOURCES',

UPLOADER="pic32prog",
UPLOADERFLAGS=[
"-d", '"$UPLOAD_PORT"',
"-b", "$UPLOAD_SPEED"
],
UPLOADCMD='$UPLOADER $UPLOADERFLAGS $SOURCES',

PROGSUFFIX=".elf"
)

# Allow user to override via pre:script
if env.get("PROGNAME", "program") == "program":
env.Replace(PROGNAME="firmware")

# append LD script manually
if "LDSCRIPT_PATH" in env:
del env['LDSCRIPT_PATH']

env.Append(
ASFLAGS=[
"-O2",
"-Wa,--gdwarf-2",
Expand Down Expand Up @@ -69,37 +94,6 @@

LIBS=["m"],

SIZEPROGREGEXP=r"^(?:\.reset|\.image_ptr_table|\.app_excpt|\.vector\S*|\.startup|\.init|\.fini|\.ctors|\.dtors|\.header_info|\.dinit|\.text\S*|\.rodata\S*|\.data)\s+([0-9]+).*",
SIZEDATAREGEXP=r"^(?:\.ram_exchange_data|\.dbg_data|\.sdata|\.sbss|\.data\S*|\.stack|\.bss|\.comment.__use_force_isr_install|\.eh_frame|\.jcr)\s+([0-9]+).*",
SIZECHECKCMD="$SIZETOOL -A -d $SOURCES",
SIZEPRINTCMD='$SIZETOOL -B -d $SOURCES',

UPLOADER="pic32prog",
UPLOADERFLAGS=[
"-d", '"$UPLOAD_PORT"',
"-b", "$UPLOAD_SPEED"
],
UPLOADCMD='$UPLOADER $UPLOADERFLAGS $SOURCES',

PROGSUFFIX=".elf"
)

# Allow user to override via pre:script
if env.get("PROGNAME", "program") == "program":
env.Replace(PROGNAME="firmware")

if int(env.BoardConfig().get("upload.maximum_ram_size", 0)) < 65535:
env.Append(
ASFLAGS=["-G1024"],
CCFLAGS=["-G1024"]
)

# append LD script manually
if "LDSCRIPT_PATH" in env:
del env['LDSCRIPT_PATH']


env.Append(
BUILDERS=dict(
ElfToHex=Builder(
action=env.VerboseAction(" ".join([
Expand Down Expand Up @@ -127,6 +121,17 @@
)
)

if int(board_config.get("upload.maximum_ram_size", 0)) < 65535:
env.Append(
ASFLAGS=["-G1024"],
CCFLAGS=["-G1024"]
)

if board_config.get("build.mcu").startswith("32MX"):
env.Append(CPPDEFINES=["__PIC32MX__"])
elif board_config.get("build.mcu").startswith("32MZ"):
env.Append(CPPDEFINES=["__PIC32MZ__"])

#
# Target: Build executable and linkable firmware
#
Expand All @@ -137,9 +142,9 @@
target_elf = env.BuildProgram()

env.Append(LINKFLAGS=[
"-Wl,--script=%s" % env.BoardConfig().get("build.ldscript", ""),
"-Wl,--script=%s" % board_config.get("build.ldscript", ""),
"-Wl,--script=chipKIT-application-COMMON%s.ld" %
("-MZ" if "MZ" in env.BoardConfig().get("build.mcu", "") else "")
("-MZ" if "MZ" in board_config.get("build.mcu", "") else "")
])

target_firm = env.ElfToHex(join("$BUILD_DIR", "${PROGNAME}"), target_elf)
Expand Down
2 changes: 1 addition & 1 deletion platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "git",
"url": "https://github.com/platformio/platform-microchippic32.git"
},
"version": "1.5.2",
"version": "1.5.3",
"packageRepositories": [
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
"http://dl.platformio.org/packages/manifest.json"
Expand Down

0 comments on commit f72a748

Please sign in to comment.