diff --git a/.travis.yml b/.travis.yml index 968775e..d1d421b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: python python: - "2.7" + - "3.6" env: - PLATFORMIO_PROJECT_DIR=examples/arduino-blink diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 7938f9b..e65a4b3 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -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", @@ -142,7 +141,6 @@ RANLIBFLAGS=["-s"], LINKFLAGS=[ - "-Os", "-Wl,--gc-sections,--relax", "-mthumb", "-mcpu=%s" % env.BoardConfig().get("build.cpu"), @@ -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", [])[:] ) diff --git a/builder/main.py b/builder/main.py index b46dba3..1b5a026 100644 --- a/builder/main.py +++ b/builder/main.py @@ -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: diff --git a/platform.json b/platform.json index 8a3d94d..13d3a45 100644 --- a/platform.json +++ b/platform.json @@ -12,7 +12,7 @@ "type": "git", "url": "https://github.com/platformio/platform-teensy.git" }, - "version": "3.7.0", + "version": "3.7.1", "packageRepositories": [ "https://dl.bintray.com/platformio/dl-packages/manifest.json", "http://dl.platformio.org/packages/manifest.json"