forked from platformio/platformio-core
Refactor build scripts for development platforms
This commit is contained in:
@ -8,108 +8,11 @@
|
||||
from os.path import join
|
||||
from time import sleep
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||
DefaultEnvironment, Exit)
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
DefaultEnvironment, Exit, SConscript)
|
||||
|
||||
from platformio.util import get_serialports
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
AR="avr-ar",
|
||||
AS="avr-gcc",
|
||||
CC="avr-gcc",
|
||||
CXX="avr-g++",
|
||||
OBJCOPY="avr-objcopy",
|
||||
RANLIB="avr-ranlib",
|
||||
SIZETOOL="avr-size",
|
||||
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
ASFLAGS=[
|
||||
"-c",
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-x", "assembler-with-cpp",
|
||||
"-mmcu=$BOARD_MCU"
|
||||
],
|
||||
|
||||
CCFLAGS=[
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-Os", # optimize for size
|
||||
# "-Wall", # show warnings
|
||||
"-ffunction-sections", # place each function in its own section
|
||||
"-fdata-sections",
|
||||
"-MMD", # output dependency info
|
||||
"-mmcu=$BOARD_MCU"
|
||||
],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-fno-exceptions",
|
||||
"-fno-threadsafe-statics"
|
||||
],
|
||||
|
||||
CPPDEFINES=[
|
||||
"F_CPU=$BOARD_F_CPU"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Os",
|
||||
"-mmcu=$BOARD_MCU",
|
||||
"-Wl,--gc-sections"
|
||||
],
|
||||
|
||||
SIZEPRINTCMD='"$SIZETOOL" --mcu=$BOARD_MCU -C -d $SOURCES',
|
||||
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
|
||||
UPLOADERFLAGS=[
|
||||
"-q", # suppress progress output
|
||||
"-D", # disable auto erase for flash memory
|
||||
"-p", "$BOARD_MCU",
|
||||
"-C",
|
||||
'"%s"' % join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude.conf"),
|
||||
"-c", "$UPLOAD_PROTOCOL"
|
||||
],
|
||||
UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS -U flash:w:$SOURCES:i',
|
||||
UPLOADEEPCMD='"$UPLOADER" $UPLOADERFLAGS -U eeprom:w:$SOURCES:i'
|
||||
)
|
||||
|
||||
if "UPLOAD_SPEED" in env:
|
||||
env.Append(UPLOADERFLAGS=["-b", "$UPLOAD_SPEED"])
|
||||
if env.subst("$UPLOAD_PROTOCOL") != "usbtiny":
|
||||
env.Append(UPLOADERFLAGS=["-P", "$UPLOAD_PORT"])
|
||||
|
||||
env.Append(
|
||||
BUILDERS=dict(
|
||||
ElfToEep=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-O",
|
||||
"ihex",
|
||||
"-j",
|
||||
".eeprom",
|
||||
'--set-section-flags=.eeprom="alloc,load"',
|
||||
"--no-change-warnings",
|
||||
"--change-section-lma",
|
||||
".eeprom=0",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".eep"
|
||||
),
|
||||
|
||||
ElfToHex=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-O",
|
||||
"ihex",
|
||||
"-R",
|
||||
".eeprom",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".hex"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def before_upload(target, source, env): # pylint: disable=W0613,W0621
|
||||
|
||||
@ -155,13 +58,32 @@ def before_upload(target, source, env): # pylint: disable=W0613,W0621
|
||||
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
|
||||
|
||||
|
||||
env = DefaultEnvironment()
|
||||
env = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py")),
|
||||
exports="env")
|
||||
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
|
||||
UPLOADERFLAGS=[
|
||||
"-q", # suppress progress output
|
||||
"-D", # disable auto erase for flash memory
|
||||
"-p", "$BOARD_MCU",
|
||||
"-C",
|
||||
'"%s"' % join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude.conf"),
|
||||
"-c", "$UPLOAD_PROTOCOL"
|
||||
],
|
||||
|
||||
UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS -U flash:w:$SOURCES:i',
|
||||
UPLOADEEPCMD='"$UPLOADER" $UPLOADERFLAGS -U eeprom:w:$SOURCES:i'
|
||||
)
|
||||
|
||||
CORELIBS = env.ProcessGeneral()
|
||||
|
||||
#
|
||||
# Target: Build executable and linkable firmware
|
||||
#
|
||||
|
||||
target_elf = env.BuildFirmware(CORELIBS + ["m"])
|
||||
target_elf = env.BuildFirmware(["m"] + CORELIBS)
|
||||
|
||||
#
|
||||
# Target: Extract EEPROM data (from EEMEM directive) to .eep file
|
||||
@ -175,9 +97,9 @@ target_eep = env.Alias("eep", env.ElfToEep(join("$BUILD_DIR", "firmware"),
|
||||
#
|
||||
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_hex = join("$BUILD_DIR", "firmware.hex")
|
||||
target_firm = join("$BUILD_DIR", "firmware.hex")
|
||||
else:
|
||||
target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
target_firm = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
|
||||
#
|
||||
# Target: Print binary size
|
||||
@ -190,7 +112,7 @@ AlwaysBuild(target_size)
|
||||
# Target: Upload by default .hex file
|
||||
#
|
||||
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_hex, [
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_firm, [
|
||||
before_upload, "$UPLOADHEXCMD"])
|
||||
AlwaysBuild(upload)
|
||||
|
||||
@ -206,4 +128,4 @@ AlwaysBuild(uploadeep)
|
||||
# Setup default targets
|
||||
#
|
||||
|
||||
Default([target_hex, target_size])
|
||||
Default([target_firm, target_size])
|
||||
|
@ -7,69 +7,16 @@
|
||||
|
||||
from os.path import join
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||
DefaultEnvironment)
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
DefaultEnvironment, SConscript)
|
||||
|
||||
from platformio.util import get_serialports
|
||||
|
||||
env = DefaultEnvironment()
|
||||
env = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")),
|
||||
exports="env")
|
||||
|
||||
env.Replace(
|
||||
AR="arm-none-eabi-ar",
|
||||
AS="arm-none-eabi-gcc",
|
||||
CC="arm-none-eabi-gcc",
|
||||
CXX="arm-none-eabi-g++",
|
||||
OBJCOPY="arm-none-eabi-objcopy",
|
||||
RANLIB="arm-none-eabi-ranlib",
|
||||
SIZETOOL="arm-none-eabi-size",
|
||||
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
ASFLAGS=[
|
||||
"-c",
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-x", "assembler-with-cpp",
|
||||
"-Wall",
|
||||
"-mthumb",
|
||||
"-mcpu=${BOARD_OPTIONS['build']['mcu']}"
|
||||
],
|
||||
|
||||
CPPFLAGS=[
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-Os", # optimize for size
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections", # place each function in its own section
|
||||
"-Wall",
|
||||
"-MMD", # output dependancy info
|
||||
"-mcpu=${BOARD_OPTIONS['build']['mcu']}",
|
||||
"-mthumb",
|
||||
"-ffunction-sections", # place each function in its own section
|
||||
"-fdata-sections",
|
||||
"-nostdlib"
|
||||
],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-fno-rtti",
|
||||
"-felide-constructors",
|
||||
"-fno-exceptions"
|
||||
],
|
||||
|
||||
CPPDEFINES=[
|
||||
"F_CPU=$BOARD_F_CPU",
|
||||
"printf=iprintf"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Os",
|
||||
"-Wl,--gc-sections",
|
||||
"-mcpu=${BOARD_OPTIONS['build']['mcu']}",
|
||||
"-mthumb",
|
||||
"-Wl,--entry=Reset_Handler",
|
||||
"-Wl,--start-group"
|
||||
],
|
||||
|
||||
SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES',
|
||||
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_UPLOADER", "bossac"),
|
||||
UPLOADERFLAGS=[
|
||||
"--info",
|
||||
@ -84,17 +31,14 @@ env.Replace(
|
||||
)
|
||||
|
||||
env.Append(
|
||||
BUILDERS=dict(
|
||||
ElfToBin=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-O",
|
||||
"binary",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".bin"
|
||||
)
|
||||
)
|
||||
CPPDEFINES=[
|
||||
"printf=iprintf"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Wl,--entry=Reset_Handler",
|
||||
"-Wl,--start-group"
|
||||
]
|
||||
)
|
||||
|
||||
CORELIBS = env.ProcessGeneral()
|
||||
@ -103,16 +47,16 @@ CORELIBS = env.ProcessGeneral()
|
||||
# Target: Build executable and linkable firmware
|
||||
#
|
||||
|
||||
target_elf = env.BuildFirmware(CORELIBS + ["m", "gcc"])
|
||||
target_elf = env.BuildFirmware(["m", "gcc"] + CORELIBS)
|
||||
|
||||
#
|
||||
# Target: Build the .bin file
|
||||
#
|
||||
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_bin = join("$BUILD_DIR", "firmware.bin")
|
||||
target_firmware = join("$BUILD_DIR", "firmware.bin")
|
||||
else:
|
||||
target_bin = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
target_firmware = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
|
||||
#
|
||||
# Target: Print binary size
|
||||
@ -125,7 +69,8 @@ AlwaysBuild(target_size)
|
||||
# Target: Upload by default .bin file
|
||||
#
|
||||
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_bin, ("$UPLOADBINCMD"))
|
||||
upload = env.Alias(
|
||||
["upload", "uploadlazy"], target_firmware, ("$UPLOADBINCMD"))
|
||||
AlwaysBuild(upload)
|
||||
|
||||
#
|
||||
@ -151,4 +96,4 @@ if is_uptarget:
|
||||
# Setup default targets
|
||||
#
|
||||
|
||||
Default([target_bin, target_size])
|
||||
Default([target_firmware, target_size])
|
||||
|
97
platformio/builder/scripts/basearm.py
Normal file
97
platformio/builder/scripts/basearm.py
Normal file
@ -0,0 +1,97 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
"""
|
||||
Base for ARM microcontrollers.
|
||||
"""
|
||||
|
||||
from SCons.Script import Builder, Import, Return
|
||||
|
||||
env = None
|
||||
Import("env")
|
||||
|
||||
env.Replace(
|
||||
AR="arm-none-eabi-ar",
|
||||
AS="arm-none-eabi-gcc",
|
||||
CC="arm-none-eabi-gcc",
|
||||
CXX="arm-none-eabi-g++",
|
||||
OBJCOPY="arm-none-eabi-objcopy",
|
||||
RANLIB="arm-none-eabi-ranlib",
|
||||
SIZETOOL="arm-none-eabi-size",
|
||||
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
ASFLAGS=[
|
||||
"-c",
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-x", "assembler-with-cpp",
|
||||
"-Wall",
|
||||
"-mthumb",
|
||||
"-mcpu=${BOARD_OPTIONS['build']['cpu']}"
|
||||
],
|
||||
|
||||
CPPFLAGS=[
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-Os", # optimize for size
|
||||
"-ffunction-sections", # place each function in its own section
|
||||
"-fdata-sections",
|
||||
"-Wall",
|
||||
"-mthumb",
|
||||
"-mcpu=${BOARD_OPTIONS['build']['cpu']}",
|
||||
"-nostdlib",
|
||||
"-MMD" # output dependancy info
|
||||
],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-fno-rtti",
|
||||
"-fno-exceptions"
|
||||
],
|
||||
|
||||
CPPDEFINES=[
|
||||
"F_CPU=$BOARD_F_CPU"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Os",
|
||||
"-Wl,--gc-sections",
|
||||
"-mthumb",
|
||||
"-mcpu=${BOARD_OPTIONS['build']['cpu']}"
|
||||
],
|
||||
|
||||
SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES'
|
||||
)
|
||||
|
||||
if env.get("BOARD_OPTIONS", {}).get("build", {}).get("cpu")[-2:] == "m4":
|
||||
env.Append(
|
||||
ASFLAGS=[
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-fsingle-precision-constant"
|
||||
],
|
||||
CCFLAGS=[
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-fsingle-precision-constant"
|
||||
],
|
||||
LINKFLAGS=[
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-fsingle-precision-constant"
|
||||
]
|
||||
)
|
||||
|
||||
env.Append(
|
||||
BUILDERS=dict(
|
||||
ElfToBin=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-O",
|
||||
"binary",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".bin"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Return("env")
|
96
platformio/builder/scripts/baseavr.py
Normal file
96
platformio/builder/scripts/baseavr.py
Normal file
@ -0,0 +1,96 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
"""
|
||||
Base for Atmel AVR series of microcontrollers
|
||||
"""
|
||||
|
||||
from SCons.Script import Builder, Import, Return
|
||||
|
||||
env = None
|
||||
Import("env")
|
||||
|
||||
env.Replace(
|
||||
AR="avr-ar",
|
||||
AS="avr-gcc",
|
||||
CC="avr-gcc",
|
||||
CXX="avr-g++",
|
||||
OBJCOPY="avr-objcopy",
|
||||
RANLIB="avr-ranlib",
|
||||
SIZETOOL="avr-size",
|
||||
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
ASFLAGS=[
|
||||
"-c",
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-x", "assembler-with-cpp",
|
||||
"-mmcu=$BOARD_MCU"
|
||||
],
|
||||
|
||||
CCFLAGS=[
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-Os", # optimize for size
|
||||
"-Wall", # show warnings
|
||||
"-ffunction-sections", # place each function in its own section
|
||||
"-fdata-sections",
|
||||
"-MMD", # output dependency info
|
||||
"-mmcu=$BOARD_MCU"
|
||||
],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-fno-exceptions",
|
||||
"-fno-threadsafe-statics"
|
||||
],
|
||||
|
||||
CPPDEFINES=[
|
||||
"F_CPU=$BOARD_F_CPU"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Os",
|
||||
"-mmcu=$BOARD_MCU",
|
||||
"-Wl,--gc-sections"
|
||||
],
|
||||
|
||||
SIZEPRINTCMD='"$SIZETOOL" --mcu=$BOARD_MCU -C -d $SOURCES'
|
||||
)
|
||||
|
||||
if "UPLOAD_SPEED" in env:
|
||||
env.Append(UPLOADERFLAGS=["-b", "$UPLOAD_SPEED"])
|
||||
if env.subst("$UPLOAD_PROTOCOL") != "usbtiny":
|
||||
env.Append(UPLOADERFLAGS=["-P", "$UPLOAD_PORT"])
|
||||
|
||||
env.Append(
|
||||
BUILDERS=dict(
|
||||
ElfToEep=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-O",
|
||||
"ihex",
|
||||
"-j",
|
||||
".eeprom",
|
||||
'--set-section-flags=.eeprom="alloc,load"',
|
||||
"--no-change-warnings",
|
||||
"--change-section-lma",
|
||||
".eeprom=0",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".eep"
|
||||
),
|
||||
|
||||
ElfToHex=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-O",
|
||||
"ihex",
|
||||
"-R",
|
||||
".eeprom",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".hex"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Return("env")
|
@ -7,129 +7,16 @@
|
||||
|
||||
from os.path import join
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||
DefaultEnvironment)
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
DefaultEnvironment, SConscript)
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
if env.get("BOARD_OPTIONS", {}).get("build", {}).get("mcu") != "cortex-m3":
|
||||
if "cortex" in env.get("BOARD_OPTIONS").get("build").get("cpu", ""):
|
||||
env = SConscript(
|
||||
env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")),
|
||||
exports="env")
|
||||
env.Replace(
|
||||
AR="avr-ar",
|
||||
AS="avr-gcc",
|
||||
CC="avr-gcc",
|
||||
CXX="avr-g++",
|
||||
OBJCOPY="avr-objcopy",
|
||||
RANLIB="avr-ranlib",
|
||||
SIZETOOL="avr-size",
|
||||
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
CPPFLAGS=[
|
||||
"-mmcu=$BOARD_MCU"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-mmcu=$BOARD_MCU"
|
||||
],
|
||||
|
||||
SIZEPRINTCMD='"$SIZETOOL" --mcu=$BOARD_MCU -C -d $SOURCES'
|
||||
)
|
||||
|
||||
else:
|
||||
env.Replace(
|
||||
AR="arm-none-eabi-ar",
|
||||
AS="arm-none-eabi-gcc",
|
||||
CC="arm-none-eabi-gcc",
|
||||
CXX="arm-none-eabi-g++",
|
||||
OBJCOPY="arm-none-eabi-objcopy",
|
||||
RANLIB="arm-none-eabi-ranlib",
|
||||
SIZETOOL="arm-none-eabi-size",
|
||||
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
ASFLAGS=[
|
||||
"-mcpu=${BOARD_OPTIONS['build']['mcu']}",
|
||||
"-mthumb"
|
||||
# "-nostdlib"
|
||||
],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-fno-rtti",
|
||||
],
|
||||
|
||||
CPPFLAGS=[
|
||||
"-mcpu=${BOARD_OPTIONS['build']['mcu']}",
|
||||
"-mthumb",
|
||||
"-ffunction-sections", # place each function in its own section
|
||||
"-fdata-sections"
|
||||
# "-nostdlib"
|
||||
],
|
||||
|
||||
CPPDEFINES=[
|
||||
"printf=iprintf"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-mcpu=cortex-m3",
|
||||
"-mthumb",
|
||||
"-Wl,--gc-sections",
|
||||
"-Wl,--entry=Reset_Handler"
|
||||
# "-nostartfiles",
|
||||
# "-nostdlib",
|
||||
],
|
||||
|
||||
SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES'
|
||||
)
|
||||
|
||||
env.Append(
|
||||
BUILDERS=dict(
|
||||
ElfToHex=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-O",
|
||||
"ihex",
|
||||
"-R",
|
||||
".eeprom",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".hex"
|
||||
)
|
||||
),
|
||||
|
||||
ASFLAGS=[
|
||||
"-c",
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-x", "assembler-with-cpp",
|
||||
"-Wall"
|
||||
],
|
||||
|
||||
CPPFLAGS=[
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-Os", # optimize for size
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections", # place each function in its own section
|
||||
"-Wall",
|
||||
"-MMD" # output dependancy info
|
||||
],
|
||||
|
||||
CPPDEFINES=[
|
||||
"F_CPU=$BOARD_F_CPU"
|
||||
],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-felide-constructors",
|
||||
"-fno-exceptions"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Os",
|
||||
"-Wl,--start-group"
|
||||
|
||||
]
|
||||
)
|
||||
|
||||
if env.get("BOARD_OPTIONS", {}).get("build", {}).get("mcu") == "cortex-m3":
|
||||
env.Append(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_UPLOADER", "bossac"),
|
||||
UPLOADERFLAGS=[
|
||||
"--info",
|
||||
@ -142,8 +29,21 @@ if env.get("BOARD_OPTIONS", {}).get("build", {}).get("mcu") == "cortex-m3":
|
||||
],
|
||||
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES'
|
||||
)
|
||||
else:
|
||||
|
||||
env.Append(
|
||||
CPPDEFINES=[
|
||||
"printf=iprintf"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Wl,--entry=Reset_Handler",
|
||||
"-Wl,--start-group"
|
||||
]
|
||||
)
|
||||
else:
|
||||
env = SConscript(env.subst(
|
||||
join("$PIOBUILDER_DIR", "scripts", "baseavr.py")), exports="env")
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
|
||||
UPLOADERFLAGS=[
|
||||
"-q", # suppress progress output
|
||||
@ -164,16 +64,22 @@ CORELIBS = env.ProcessGeneral()
|
||||
# Target: Build executable and linkable firmware
|
||||
#
|
||||
|
||||
target_elf = env.BuildFirmware(CORELIBS + ["m"])
|
||||
target_elf = env.BuildFirmware(["m"] + CORELIBS)
|
||||
|
||||
#
|
||||
# Target: Build the .hex file
|
||||
# Target: Build the firmware file
|
||||
#
|
||||
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_hex = join("$BUILD_DIR", "firmware.hex")
|
||||
if "cortex" in env.get("BOARD_OPTIONS").get("build").get("cpu", ""):
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_firm = join("$BUILD_DIR", "firmware.bin")
|
||||
else:
|
||||
target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
else:
|
||||
target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_firm = join("$BUILD_DIR", "firmware.hex")
|
||||
else:
|
||||
target_firm = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
|
||||
#
|
||||
# Target: Print binary size
|
||||
@ -183,14 +89,14 @@ target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD")
|
||||
AlwaysBuild(target_size)
|
||||
|
||||
#
|
||||
# Target: Upload by default .hex file
|
||||
# Target: Upload by default firmware file
|
||||
#
|
||||
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_hex, ("$UPLOADCMD"))
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_firm, ("$UPLOADCMD"))
|
||||
AlwaysBuild(upload)
|
||||
|
||||
#
|
||||
# Target: Define targets
|
||||
#
|
||||
|
||||
Default([target_hex, target_size])
|
||||
Default([target_firm, target_size])
|
||||
|
@ -28,7 +28,7 @@ if env.get("PLATFORM") == "digistump":
|
||||
PLATFORMFW_DIR = join(
|
||||
"$PIOPACKAGES_DIR",
|
||||
"framework-arduino%s" % (
|
||||
"sam" if BOARD_BUILDOPTS.get("mcu") == "cortex-m3" else "avr")
|
||||
"sam" if BOARD_BUILDOPTS.get("cpu") == "cortex-m3" else "avr")
|
||||
)
|
||||
|
||||
env.Replace(PLATFORMFW_DIR=PLATFORMFW_DIR)
|
||||
@ -98,12 +98,6 @@ if env.subst("${PLATFORMFW_DIR}")[-3:] == "sam":
|
||||
join("$BUILD_DIR", "FrameworkDeviceInc", "sam3xa", "include")
|
||||
]
|
||||
)
|
||||
env.Append(
|
||||
LINKFLAGS=[
|
||||
"-T", join("$PIOHOME_DIR", "packages", "ldscripts",
|
||||
"${BOARD_OPTIONS['build']['ldscript']}")
|
||||
]
|
||||
)
|
||||
|
||||
# search relative includes in lib SAM directories
|
||||
core_dir = join(env.subst("$PLATFORMFW_DIR"), "system", "libsam")
|
||||
|
@ -8,63 +8,14 @@
|
||||
|
||||
from os.path import join
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||
DefaultEnvironment)
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
DefaultEnvironment, SConscript)
|
||||
|
||||
env = DefaultEnvironment()
|
||||
env = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")),
|
||||
exports="env")
|
||||
|
||||
env.Replace(
|
||||
AR="arm-none-eabi-ar",
|
||||
AS="arm-none-eabi-gcc",
|
||||
CC="arm-none-eabi-gcc",
|
||||
CXX="arm-none-eabi-g++",
|
||||
OBJCOPY="arm-none-eabi-objcopy",
|
||||
RANLIB="arm-none-eabi-ranlib",
|
||||
SIZETOOL="arm-none-eabi-size",
|
||||
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
ASFLAGS=[
|
||||
"-c",
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-x", "assembler-with-cpp",
|
||||
"-Wall",
|
||||
"-mthumb",
|
||||
"-mcpu=${BOARD_OPTIONS['build']['mcu']}"
|
||||
],
|
||||
|
||||
CCFLAGS=[
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-Os", # optimize for size
|
||||
"-ffunction-sections", # place each function in its own section
|
||||
"-fdata-sections",
|
||||
"-Wall",
|
||||
"-mthumb",
|
||||
"-mcpu=${BOARD_OPTIONS['build']['mcu']}",
|
||||
"-MMD" # output dependancy info
|
||||
],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-fno-rtti",
|
||||
"-fno-exceptions"
|
||||
],
|
||||
|
||||
CPPDEFINES=[
|
||||
"F_CPU=$BOARD_F_CPU",
|
||||
"${BOARD_OPTIONS['build']['variant'].upper()}"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Os",
|
||||
"-nostartfiles",
|
||||
"-nostdlib",
|
||||
"-Wl,--gc-sections",
|
||||
"-mthumb",
|
||||
"-mcpu=${BOARD_OPTIONS['build']['mcu']}"
|
||||
],
|
||||
|
||||
SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES',
|
||||
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"),
|
||||
UPLOADERFLAGS=[
|
||||
"write", # write in flash
|
||||
@ -75,37 +26,16 @@ env.Replace(
|
||||
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
|
||||
)
|
||||
|
||||
if env.get("BOARD_OPTIONS", {}).get("build", {}).get("mcu")[-2:] == "m4":
|
||||
env.Append(
|
||||
ASFLAGS=[
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-fsingle-precision-constant"
|
||||
],
|
||||
CCFLAGS=[
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-fsingle-precision-constant"
|
||||
],
|
||||
LINKFLAGS=[
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-fsingle-precision-constant"
|
||||
]
|
||||
)
|
||||
|
||||
env.Append(
|
||||
BUILDERS=dict(
|
||||
ElfToBin=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-O",
|
||||
"binary",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".bin"
|
||||
)
|
||||
)
|
||||
CPPDEFINES=[
|
||||
"${BOARD_OPTIONS['build']['variant'].upper()}"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-nostartfiles",
|
||||
"-nostdlib"
|
||||
]
|
||||
)
|
||||
|
||||
CORELIBS = env.ProcessGeneral()
|
||||
@ -114,16 +44,16 @@ CORELIBS = env.ProcessGeneral()
|
||||
# Target: Build executable and linkable firmware
|
||||
#
|
||||
|
||||
target_elf = env.BuildFirmware(CORELIBS + ["c", "gcc", "m", "nosys"])
|
||||
target_elf = env.BuildFirmware(["c", "gcc", "m", "nosys"] + CORELIBS)
|
||||
|
||||
#
|
||||
# Target: Build the .bin file
|
||||
#
|
||||
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_bin = join("$BUILD_DIR", "firmware.bin")
|
||||
target_firm = join("$BUILD_DIR", "firmware.bin")
|
||||
else:
|
||||
target_bin = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
|
||||
#
|
||||
# Target: Print binary size
|
||||
@ -136,11 +66,11 @@ AlwaysBuild(target_size)
|
||||
# Target: Upload by default .bin file
|
||||
#
|
||||
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_bin, ("$UPLOADCMD"))
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_firm, ("$UPLOADCMD"))
|
||||
AlwaysBuild(upload)
|
||||
|
||||
#
|
||||
# Target: Define targets
|
||||
#
|
||||
|
||||
Default([target_bin, target_size])
|
||||
Default([target_firm, target_size])
|
||||
|
@ -7,113 +7,21 @@
|
||||
|
||||
from os.path import isfile, join
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||
DefaultEnvironment)
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
DefaultEnvironment, SConscript)
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
if env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy":
|
||||
env.Replace(
|
||||
AR="avr-ar",
|
||||
AS="avr-gcc",
|
||||
CC="avr-gcc",
|
||||
CXX="avr-g++",
|
||||
OBJCOPY="avr-objcopy",
|
||||
RANLIB="avr-ranlib",
|
||||
SIZETOOL="avr-size",
|
||||
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-std=c++0x"
|
||||
],
|
||||
|
||||
CPPFLAGS=[
|
||||
"-mmcu=$BOARD_MCU"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-mmcu=$BOARD_MCU"
|
||||
],
|
||||
|
||||
SIZEPRINTCMD='"$SIZETOOL" --mcu=$BOARD_MCU -C -d $SOURCES'
|
||||
)
|
||||
env = SConscript(env.subst(
|
||||
join("$PIOBUILDER_DIR", "scripts", "baseavr.py")), exports="env")
|
||||
|
||||
elif env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy3":
|
||||
env.Replace(
|
||||
AR="arm-none-eabi-ar",
|
||||
AS="arm-none-eabi-gcc",
|
||||
CC="arm-none-eabi-gcc",
|
||||
CXX="arm-none-eabi-g++",
|
||||
OBJCOPY="arm-none-eabi-objcopy",
|
||||
RANLIB="arm-none-eabi-ranlib",
|
||||
SIZETOOL="arm-none-eabi-size",
|
||||
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
ASFLAGS=[
|
||||
"-mcpu=cortex-m4",
|
||||
"-mthumb",
|
||||
# "-nostdlib"
|
||||
],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-std=gnu++0x",
|
||||
"-fno-rtti",
|
||||
],
|
||||
|
||||
CPPFLAGS=[
|
||||
"-mcpu=cortex-m4",
|
||||
"-mthumb",
|
||||
"-ffunction-sections", # place each function in its own section
|
||||
"-fdata-sections",
|
||||
# "-nostdlib"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-mcpu=cortex-m4",
|
||||
"-mthumb",
|
||||
"-Wl,--gc-sections",
|
||||
# "-nostartfiles",
|
||||
# "-nostdlib",
|
||||
],
|
||||
|
||||
SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES'
|
||||
)
|
||||
env = SConscript(env.subst(
|
||||
join("$PIOBUILDER_DIR", "scripts", "basearm.py")), exports="env")
|
||||
|
||||
env.Append(
|
||||
BUILDERS=dict(
|
||||
ElfToHex=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-O",
|
||||
"ihex",
|
||||
"-R",
|
||||
".eeprom",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".hex"
|
||||
)
|
||||
),
|
||||
|
||||
ASFLAGS=[
|
||||
"-c",
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-x", "assembler-with-cpp",
|
||||
"-Wall"
|
||||
],
|
||||
|
||||
CPPFLAGS=[
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-Os", # optimize for size
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections", # place each function in its own section
|
||||
"-Wall",
|
||||
"-MMD" # output dependancy info
|
||||
],
|
||||
|
||||
CPPDEFINES=[
|
||||
"F_CPU=$BOARD_F_CPU",
|
||||
"USB_PID=null",
|
||||
"USB_VID=null",
|
||||
"USB_SERIAL",
|
||||
@ -121,19 +29,15 @@ env.Append(
|
||||
],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-felide-constructors",
|
||||
"-fno-exceptions"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Os"
|
||||
"-std=gnu++0x"
|
||||
]
|
||||
)
|
||||
|
||||
if isfile(env.subst(join(
|
||||
"$PIOPACKAGES_DIR", "tool-teensy", "teensy_loader_cli"))):
|
||||
env.Append(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-teensy", "teensy_loader_cli"),
|
||||
UPLOADER=join(
|
||||
"$PIOPACKAGES_DIR", "tool-teensy", "teensy_loader_cli"),
|
||||
UPLOADERFLAGS=[
|
||||
"-mmcu=$BOARD_MCU",
|
||||
"-w", # wait for device to apear
|
||||
@ -159,16 +63,22 @@ CORELIBS = env.ProcessGeneral()
|
||||
# Target: Build executable and linkable firmware
|
||||
#
|
||||
|
||||
target_elf = env.BuildFirmware(CORELIBS + ["m"])
|
||||
target_elf = env.BuildFirmware(["m"] + CORELIBS)
|
||||
|
||||
#
|
||||
# Target: Build the .hex file
|
||||
# Target: Build the firmware file
|
||||
#
|
||||
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_hex = join("$BUILD_DIR", "firmware.hex")
|
||||
if "cortex" in env.get("BOARD_OPTIONS").get("build").get("cpu", ""):
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_firm = join("$BUILD_DIR", "firmware.bin")
|
||||
else:
|
||||
target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
else:
|
||||
target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_firm = join("$BUILD_DIR", "firmware.hex")
|
||||
else:
|
||||
target_firm = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
|
||||
#
|
||||
# Target: Print binary size
|
||||
@ -178,14 +88,14 @@ target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD")
|
||||
AlwaysBuild(target_size)
|
||||
|
||||
#
|
||||
# Target: Upload by default .hex file
|
||||
# Target: Upload by default firmware file
|
||||
#
|
||||
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_hex, ("$UPLOADHEXCMD"))
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_firm, ("$UPLOADHEXCMD"))
|
||||
AlwaysBuild(upload)
|
||||
|
||||
#
|
||||
# Target: Define targets
|
||||
#
|
||||
|
||||
Default([target_hex, target_size])
|
||||
Default([target_firm, target_size])
|
||||
|
@ -85,16 +85,16 @@ CORELIBS = env.ProcessGeneral()
|
||||
# Target: Build executable and linkable firmware
|
||||
#
|
||||
|
||||
target_elf = env.BuildFirmware(CORELIBS + ["m"])
|
||||
target_elf = env.BuildFirmware(["m"] + CORELIBS)
|
||||
|
||||
#
|
||||
# Target: Build the .hex
|
||||
#
|
||||
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_hex = join("$BUILD_DIR", "firmware.hex")
|
||||
target_frim = join("$BUILD_DIR", "firmware.hex")
|
||||
else:
|
||||
target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
target_frim = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
|
||||
#
|
||||
# Target: Print binary size
|
||||
@ -107,11 +107,11 @@ AlwaysBuild(target_size)
|
||||
# Target: Upload firmware
|
||||
#
|
||||
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_hex, "$UPLOADCMD")
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_frim, "$UPLOADCMD")
|
||||
AlwaysBuild(upload)
|
||||
|
||||
#
|
||||
# Target: Define targets
|
||||
#
|
||||
|
||||
Default([target_hex, target_size])
|
||||
Default([target_frim, target_size])
|
||||
|
@ -8,88 +8,23 @@
|
||||
|
||||
from os.path import join
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||
DefaultEnvironment)
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
DefaultEnvironment, SConscript)
|
||||
|
||||
env = DefaultEnvironment()
|
||||
env = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")),
|
||||
exports="env")
|
||||
|
||||
env.Replace(
|
||||
AR="arm-none-eabi-ar",
|
||||
AS="arm-none-eabi-gcc",
|
||||
CC="arm-none-eabi-gcc",
|
||||
CXX="arm-none-eabi-g++",
|
||||
OBJCOPY="arm-none-eabi-objcopy",
|
||||
RANLIB="arm-none-eabi-ranlib",
|
||||
SIZETOOL="arm-none-eabi-size",
|
||||
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
ASFLAGS=[
|
||||
"-c",
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-x", "assembler-with-cpp",
|
||||
"-Wall",
|
||||
"-mthumb",
|
||||
"-mcpu=cortex-m4",
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-fsingle-precision-constant"
|
||||
],
|
||||
|
||||
CCFLAGS=[
|
||||
"-g", # include debugging info (so errors include line numbers)
|
||||
"-Os", # optimize for size
|
||||
# "-Wall", # show warnings
|
||||
"-ffunction-sections", # place each function in its own section
|
||||
"-fdata-sections",
|
||||
"-Wall",
|
||||
"-mthumb",
|
||||
"-mcpu=cortex-m4",
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-fsingle-precision-constant",
|
||||
"-MMD" # output dependancy info
|
||||
],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-fno-rtti",
|
||||
"-fno-exceptions"
|
||||
],
|
||||
|
||||
CPPDEFINES=[
|
||||
"F_CPU=$BOARD_F_CPU"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Os",
|
||||
"-nostartfiles",
|
||||
"-nostdlib",
|
||||
"-Wl,--gc-sections",
|
||||
"-mthumb",
|
||||
"-mcpu=cortex-m4",
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-fsingle-precision-constant"
|
||||
],
|
||||
|
||||
SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES',
|
||||
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-lm4flash", "lm4flash"),
|
||||
UPLOADCMD="$UPLOADER $SOURCES"
|
||||
)
|
||||
|
||||
env.Append(
|
||||
BUILDERS=dict(
|
||||
ElfToBin=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-O",
|
||||
"binary",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".bin"
|
||||
)
|
||||
)
|
||||
LINKFLAGS=[
|
||||
"-nostartfiles",
|
||||
"-nostdlib"
|
||||
]
|
||||
)
|
||||
|
||||
CORELIBS = env.ProcessGeneral()
|
||||
@ -98,16 +33,16 @@ CORELIBS = env.ProcessGeneral()
|
||||
# Target: Build executable and linkable firmware
|
||||
#
|
||||
|
||||
target_elf = env.BuildFirmware(CORELIBS + ["c", "gcc", "m"])
|
||||
target_elf = env.BuildFirmware(["c", "gcc", "m"] + CORELIBS)
|
||||
|
||||
#
|
||||
# Target: Build the .bin file
|
||||
#
|
||||
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_bin = join("$BUILD_DIR", "firmware.bin")
|
||||
target_file = join("$BUILD_DIR", "firmware.bin")
|
||||
else:
|
||||
target_bin = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
target_file = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
|
||||
#
|
||||
# Target: Print binary size
|
||||
@ -120,11 +55,11 @@ AlwaysBuild(target_size)
|
||||
# Target: Upload firmware
|
||||
#
|
||||
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_bin, "$UPLOADCMD")
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_file, "$UPLOADCMD")
|
||||
AlwaysBuild(upload)
|
||||
|
||||
#
|
||||
# Target: Define targets
|
||||
#
|
||||
|
||||
Default([target_bin, target_size])
|
||||
Default([target_file, target_size])
|
||||
|
@ -49,7 +49,7 @@ class DigistumpPlatform(BasePlatform):
|
||||
continue
|
||||
_, board = v.split("=")
|
||||
bdata = get_boards(board)
|
||||
if bdata['build']['mcu'] == "cortex-m3":
|
||||
if "cpu" in bdata['build']:
|
||||
tpackage = "toolchain-gccarmnoneeabi"
|
||||
tuploader = "tool-bossac"
|
||||
else:
|
||||
|
Reference in New Issue
Block a user