diff --git a/boards/samd21g18a.json b/boards/samd21g18a.json index b1f09c8..01541d2 100644 --- a/boards/samd21g18a.json +++ b/boards/samd21g18a.json @@ -2,7 +2,7 @@ "build": { "core": "samd", "cpu": "cortex-m0plus", - "extra_flags": "-DARDUINO_SAMD_MKR1000 -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", + "extra_flags": "-DARDUINO_ARCH_SAMD -D__SAMD21G18A__", "f_cpu": "48000000L", "hwids": [ [ diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index e56eb2d..415a95c 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -94,14 +94,18 @@ "-Wl,--warn-section-align" ], - LIBPATH=[ - join(FRAMEWORK_DIR, "variants", - board.get("build.variant"), "linker_scripts", "gcc") - ], - LIBS=["m"] ) +variants_dir = join( + "$PROJECT_DIR", board.get("build.variants_dir")) if board.get( + "build.variants_dir", "") else join(FRAMEWORK_DIR, "variants") + +env.Append( + LIBPATH=[ + join(variants_dir, board.get("build.variant"), "linker_scripts", "gcc") + ]) + if "BOARD" in env: env.Append( CCFLAGS=[ @@ -129,8 +133,7 @@ LIBPATH=[ join(SYSTEM_DIR, "CMSIS", "CMSIS", "Lib", "GCC"), - join(FRAMEWORK_DIR, "variants", - board.get("build.variant")) + join(variants_dir, board.get("build.variant")) ] ) @@ -153,7 +156,6 @@ if BUILD_CORE == "adafruit": env.Append( - CPPDEFINES=["USE_TINYUSB"], CPPPATH=[ join(FRAMEWORK_DIR, "cores", BUILD_CORE, "Adafruit_TinyUSB_Core"), @@ -171,7 +173,7 @@ ], LIBPATH=[ - join(FRAMEWORK_DIR, "variants", board.get("build.variant")) + join(variants_dir, board.get("build.variant")) ], LINKFLAGS=[ @@ -208,11 +210,11 @@ if "build.variant" in env.BoardConfig(): env.Append( - CPPPATH=[join(FRAMEWORK_DIR, "variants", board.get("build.variant"))] + CPPPATH=[join(variants_dir, board.get("build.variant"))] ) libs.append(env.BuildLibrary( join("$BUILD_DIR", "FrameworkArduinoVariant"), - join(FRAMEWORK_DIR, "variants", board.get("build.variant")) + join(variants_dir, board.get("build.variant")) )) libs.append(env.BuildLibrary( diff --git a/builder/main.py b/builder/main.py index 45aff7b..d42b3bf 100644 --- a/builder/main.py +++ b/builder/main.py @@ -207,10 +207,13 @@ def _jlink_cmd_script(env, source): ], UPLOADCMD="$UPLOADER $UPLOADERFLAGS $SOURCES" ) - if board.get("build.core") == "adafruit": + if board.get("build.core") == "adafruit" and board.get( + "build.mcu").startswith("samd51"): + # special flags for the latest bossac tool env.Append( - UPLOADERFLAGS=["-U", "--offset", - board.get("upload.offset_address")]) + UPLOADERFLAGS=[ + "-U", "--offset", board.get("upload.offset_address")]) + else: env.Append(UPLOADERFLAGS=[ "--erase", diff --git a/platform.json b/platform.json index dccdcdf..f084f08 100644 --- a/platform.json +++ b/platform.json @@ -12,7 +12,7 @@ "type": "git", "url": "https://github.com/platformio/platform-atmelsam.git" }, - "version": "3.8.0", + "version": "3.8.1", "packageRepositories": [ "https://dl.bintray.com/platformio/dl-packages/manifest.json", "http://dl.platformio.org/packages/manifest.json", diff --git a/platform.py b/platform.py index 70fdfe3..8f21b88 100644 --- a/platform.py +++ b/platform.py @@ -49,7 +49,8 @@ def configure_default_packages(self, variables, targets): self.packages["toolchain-gccarmnoneeabi"][ 'version'] = ">=1.40803.0,<1.40805.0" if (board.get("build.core", "") == "adafruit" - and "tool-bossac" in self.packages): + and "tool-bossac" in self.packages + and board.get("build.mcu", "").startswith("samd51")): self.packages["tool-bossac"]['version'] = "~1.10900.0" for name in disabled_pkgs: