Skip to content

Commit 3817c81

Browse files
committed
Merge branch 'release/v2.2.0'
2 parents 97c6e11 + c0f4c13 commit 3817c81

10 files changed

Lines changed: 64 additions & 8 deletions

boards/delta_dfbm_nq620.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"bluetooth"
1313
],
1414
"debug": {
15+
"jlink_device": "nRF52832_xxAA",
1516
"onboard_tools": [
1617
"cmsis-dap"
1718
]

boards/nrf52840_dk.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"bluetooth"
1313
],
1414
"debug": {
15+
"jlink_device": "nRF52840_xxAA",
1516
"default_tools": [
1617
"jlink"
1718
],

boards/nrf52_dk.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"bluetooth"
1313
],
1414
"debug": {
15+
"jlink_device": "nRF52832_xxAA",
1516
"default_tools": [
1617
"jlink"
1718
],

boards/redbear_blenano2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"bluetooth"
1313
],
1414
"debug": {
15+
"jlink_device": "nRF52832_xxAA",
1516
"onboard_tools": [
1617
"cmsis-dap"
1718
]

boards/redbear_blend2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"bluetooth"
1313
],
1414
"debug": {
15+
"jlink_device": "nRF52832_xxAA",
1516
"onboard_tools": [
1617
"cmsis-dap"
1718
]

boards/stct_nrf52_minidev.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"connectivity": [
1212
"bluetooth"
1313
],
14+
"debug": {
15+
"jlink_device": "nRF52832_xxAA"
16+
},
1417
"frameworks": [
1518
"arduino"
1619
],

boards/ublox_evk_nina_b1.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"nfc"
1414
],
1515
"debug": {
16+
"jlink_device": "nRF52832_xxAA",
1617
"onboard_tools": [
1718
"jlink"
1819
]

builder/main.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
# limitations under the License.
1414

1515
import sys
16-
from os.path import join
16+
from platform import system
17+
from os import makedirs
18+
from os.path import isdir, join
1719

1820
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
1921
DefaultEnvironment)
@@ -184,17 +186,42 @@
184186
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")
185187
]
186188

187-
elif upload_protocol.startswith("nrfjprog"):
189+
elif upload_protocol == "nrfjprog":
188190
env.Replace(
189191
UPLOADER="nrfjprog",
190192
UPLOADERFLAGS=[
191193
"--chiperase",
192-
"-r"
194+
"--reset"
193195
],
194196
UPLOADCMD="$UPLOADER $UPLOADERFLAGS --program $SOURCE"
195197
)
196198
upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]
197199

200+
elif upload_protocol.startswith("jlink"):
201+
202+
def _jlink_cmd_script(env, source):
203+
build_dir = env.subst("$BUILD_DIR")
204+
if not isdir(build_dir):
205+
makedirs(build_dir)
206+
script_path = join(build_dir, "upload.jlink")
207+
commands = ["h", "loadbin %s,0x0" % source, "r", "q"]
208+
with open(script_path, "w") as fp:
209+
fp.write("\n".join(commands))
210+
return script_path
211+
212+
env.Replace(
213+
__jlink_cmd_script=_jlink_cmd_script,
214+
UPLOADER="JLink.exe" if system() == "Windows" else "JLinkExe",
215+
UPLOADERFLAGS=[
216+
"-device", env.BoardConfig().get("debug", {}).get("jlink_device"),
217+
"-speed", "4000",
218+
"-if", ("jtag" if upload_protocol == "jlink-jtag" else "swd"),
219+
"-autoconnect", "1"
220+
],
221+
UPLOADCMD="$UPLOADER $UPLOADERFLAGS -CommanderScript ${__jlink_cmd_script(__env__, SOURCE)}"
222+
)
223+
upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]
224+
198225
elif upload_protocol in debug_tools:
199226
env.Replace(
200227
UPLOADER="openocd",

platform.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"type": "git",
1313
"url": "https://github.com/platformio/platform-nordicnrf52.git"
1414
},
15-
"version": "2.1.0",
15+
"version": "2.2.0",
1616
"packageRepositories": [
1717
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
1818
"http://dl.platformio.org/packages/manifest.json"
@@ -35,7 +35,7 @@
3535
"framework-mbed": {
3636
"type": "framework",
3737
"optional": true,
38-
"version": "~4.50707.0"
38+
"version": "~4.50802.0"
3939
},
4040
"framework-arduinonordicnrf5": {
4141
"type": "framework",

platform.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from platform import system
16+
1517
from platformio.managers.platform import PlatformBase
1618

1719

@@ -55,16 +57,34 @@ def _add_default_debug_tools(self, board):
5557
for link in ("blackmagic", "jlink", "stlink", "cmsis-dap"):
5658
if link not in upload_protocols or link in debug['tools']:
5759
continue
60+
5861
if link == "blackmagic":
5962
debug['tools']['blackmagic'] = {
6063
"hwids": [["0x1d50", "0x6018"]],
6164
"require_debug_port": True
6265
}
66+
67+
elif link == "jlink":
68+
assert debug.get("jlink_device"), (
69+
"Missed J-Link Device ID for %s" % board.id)
70+
debug['tools'][link] = {
71+
"server": {
72+
"arguments": [
73+
"-singlerun",
74+
"-if", "SWD",
75+
"-select", "USB",
76+
"-device", debug.get("jlink_device"),
77+
"-port", "2331"
78+
],
79+
"executable": ("JLinkGDBServerCL.exe"
80+
if system() == "Windows" else
81+
"JLinkGDBServer")
82+
},
83+
"onboard": link in debug.get("onboard_tools", [])
84+
}
85+
6386
else:
6487
server_args = ["-f", "scripts/interface/%s.cfg" % link]
65-
if link == "jlink":
66-
server_args.extend(
67-
["-c", "transport select swd; set WORKAREASIZE 0"])
6888
if link == "stlink":
6989
server_args.extend([
7090
"-c",

0 commit comments

Comments
 (0)