diff --git a/platform.json b/platform.json index 07e92a3..4e7bf6d 100644 --- a/platform.json +++ b/platform.json @@ -12,7 +12,7 @@ "type": "git", "url": "https://github.com/platformio/platform-teensy.git" }, - "version": "3.3.1", + "version": "3.3.2", "packageRepositories": [ "https://dl.bintray.com/platformio/dl-packages/manifest.json", "http://dl.platformio.org/packages/manifest.json" @@ -52,6 +52,11 @@ "type": "uploader", "optional": true, "version": "<2" + }, + "tool-jlink": { + "type": "uploader", + "optional": true, + "version": "^1.63208.0" } } } diff --git a/platform.py b/platform.py index 15c47b9..6424981 100644 --- a/platform.py +++ b/platform.py @@ -32,6 +32,21 @@ def configure_default_packages(self, variables, targets): self.packages["toolchain-gccarmnoneeabi"][ 'version'] = ">=1.60301.0" + # configure J-LINK tool + jlink_conds = [ + "jlink" in variables.get(option, "") + for option in ("upload_protocol", "debug_tool") + ] + if variables.get("board"): + board_config = self.board_config(variables.get("board")) + jlink_conds.extend([ + "jlink" in board_config.get(key, "") + for key in ("debug.default_tools", "upload.protocol") + ]) + jlink_pkgname = "tool-jlink" + if not any(jlink_conds) and jlink_pkgname in self.packages: + del self.packages[jlink_pkgname] + return PlatformBase.configure_default_packages( self, variables, targets) @@ -58,6 +73,7 @@ def _add_default_debug_tools(self, board): "Missed J-Link Device ID for %s" % board.id) debug['tools']['jlink'] = { "server": { + "package": "tool-jlink", "arguments": [ "-singlerun", "-if", "SWD",