Skip to content

Commit

Permalink
Merge pull request platformio#6 from platformio/develop
Browse files Browse the repository at this point in the history
merge upstream
  • Loading branch information
tsandmann authored Feb 9, 2019
2 parents dd6c855 + 828436f commit f2d4bab
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 6 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: python
python:
- "2.7"
- "3.6"

env:
- PLATFORMIO_PROJECT_DIR=examples/arduino-blink
Expand Down
65 changes: 63 additions & 2 deletions builder/frameworks/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
ASFLAGS=["-x", "assembler-with-cpp"],

CCFLAGS=[
"-Os", # optimize for size
"-Wall", # show warnings
"-ffunction-sections", # place each function in its own section
"-fdata-sections",
Expand All @@ -142,7 +141,6 @@
RANLIBFLAGS=["-s"],

LINKFLAGS=[
"-Os",
"-Wl,--gc-sections,--relax",
"-mthumb",
"-mcpu=%s" % env.BoardConfig().get("build.cpu"),
Expand All @@ -166,6 +164,69 @@
]
)

# Optimization
if "TEENSY_OPT_FASTER_LTO" in env['CPPDEFINES']:
env.Append(
CCFLAGS=["-O2", "-flto", "-fno-fat-lto-objects"],
LINKFLAGS=["-O2", "-flto", "-fno-fat-lto-objects", "-fuse-linker-plugin"]
)
elif "TEENSY_OPT_FAST" in env['CPPDEFINES']:
env.Append(
CCFLAGS=["-O1"],
LINKFLAGS=["-O1"]
)
elif "TEENSY_OPT_FAST_LTO" in env['CPPDEFINES']:
env.Append(
CCFLAGS=["-O1", "-flto", "-fno-fat-lto-objects"],
LINKFLAGS=["-O1", "-flto", "-fno-fat-lto-objects", "-fuse-linker-plugin"]
)
elif "TEENSY_OPT_FASTEST" in env['CPPDEFINES']:
env.Append(
CCFLAGS=["-O3"],
LINKFLAGS=["-O3"]
)
elif "TEENSY_OPT_FASTEST_LTO" in env['CPPDEFINES']:
env.Append(
CCFLAGS=["-O3", "-flto", "-fno-fat-lto-objects"],
LINKFLAGS=["-O3", "-flto", "-fno-fat-lto-objects", "-fuse-linker-plugin"]
)
elif "TEENSY_OPT_FASTEST_PURE_CODE" in env['CPPDEFINES']:
env.Append(
CCFLAGS=["-O3", "-mpure-code"],
CPPDEFINES=["__PURE_CODE__"],
LINKFLAGS=["-O3", "-mpure-code"]
)
elif "TEENSY_OPT_FASTEST_PURE_CODE_LTO" in env['CPPDEFINES']:
env.Append(
CCFLAGS=["-O3", "-mpure-code", "-flto", "-fno-fat-lto-objects"],
CPPDEFINES=["__PURE_CODE__"],
LINKFLAGS=["-O3", "-mpure-code", "-flto", "-fno-fat-lto-objects", "-fuse-linker-plugin"]
)
elif "TEENSY_OPT_DEBUG" in env['CPPDEFINES']:
env.Append(
CCFLAGS=["-g", "-Og"],
LINKFLAGS=["-g", "-Og"]
)
elif "TEENSY_OPT_DEBUG_LTO" in env['CPPDEFINES']:
env.Append(
CCFLAGS=["-g", "-Og", "-flto", "-fno-fat-lto-objects"],
LINKFLAGS=["-g", "-Og", "-flto", "-fno-fat-lto-objects", "-fuse-linker-plugin"]
)
elif "TEENSY_OPT_SMALLEST_CODE" in env['CPPDEFINES']:
env.Append(
CCFLAGS=["-Os", "--specs=nano.specs"],
LINKFLAGS=["-Os", "--specs=nano.specs"]
)
elif "TEENSY_OPT_SMALLEST_CODE_LTO" in env['CPPDEFINES']:
env.Append(
CCFLAGS=["-Os", "--specs=nano.specs", "-flto", "-fno-fat-lto-objects"],
LINKFLAGS=["-Os", "--specs=nano.specs", "-flto", "-fno-fat-lto-objects", "-fuse-linker-plugin"]
)
# TEENSY_OPT_FASTER
else:
env.Append(CCFLAGS=["-O2"], LINKFLAGS=["-O2"])


env.Append(
ASFLAGS=env.get("CCFLAGS", [])[:]
)
Expand Down
2 changes: 1 addition & 1 deletion builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def _jlink_cmd_script(env, source):
upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]

# custom upload tool
elif "UPLOADCMD" in env:
elif upload_protocol == "custom":
upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]

else:
Expand Down
6 changes: 3 additions & 3 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"homepage": "http://platformio.org/platforms/teensy",
"license": "Apache-2.0",
"engines": {
"platformio": "^3.0.0"
"platformio": "<5"
},
"repository": {
"type": "git",
"url": "https://github.com/platformio/platform-teensy.git"
},
"version": "3.7.0",
"version": "4.0.0",
"packageRepositories": [
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
"http://dl.platformio.org/packages/manifest.json"
Expand Down Expand Up @@ -46,7 +46,7 @@
"framework-mbed": {
"type": "framework",
"optional": true,
"version": "~5.51001.1"
"version": "~5.51103.190202"
},
"tool-teensy": {
"type": "uploader",
Expand Down

0 comments on commit f2d4bab

Please sign in to comment.