Skip to content

Commit fe1b37b

Browse files
committed
Use J-Link package from PlatformIO Registry
1 parent 658e5fd commit fe1b37b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

platform.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
"type": "debugger",
4343
"optional": true,
4444
"version": "~0.801.0"
45+
},
46+
"tool-jlink": {
47+
"type": "uploader",
48+
"optional": true,
49+
"version": "^1.63208.0"
4550
}
4651
}
4752
}

platform.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ def configure_default_packages(self, variables, targets):
3131
if upload_protocol == "cmsis-dap":
3232
self.packages['tool-pyocd']['type'] = "uploader"
3333

34+
# configure J-LINK tool
35+
jlink_conds = [
36+
"jlink" in variables.get(option, "")
37+
for option in ("upload_protocol", "debug_tool")
38+
]
39+
if variables.get("board"):
40+
board_config = self.board_config(variables.get("board"))
41+
jlink_conds.extend([
42+
"jlink" in board_config.get(key, "")
43+
for key in ("debug.default_tools", "upload.protocol")
44+
])
45+
jlink_pkgname = "tool-jlink"
46+
if not any(jlink_conds) and jlink_pkgname in self.packages:
47+
del self.packages[jlink_pkgname]
48+
3449
return PlatformBase.configure_default_packages(self, variables,
3550
targets)
3651

@@ -66,6 +81,7 @@ def _add_default_debug_tools(self, board):
6681
"Missed J-Link Device ID for %s" % board.id)
6782
debug['tools'][link] = {
6883
"server": {
84+
"package": "tool-jlink",
6985
"arguments": [
7086
"-singlerun",
7187
"-if", "SWD",

0 commit comments

Comments
 (0)