Skip to content

Commit

Permalink
Merge branch 'release/v2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Apr 19, 2018
2 parents 97c6e11 + c0f4c13 commit 3817c81
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 8 deletions.
1 change: 1 addition & 0 deletions boards/delta_dfbm_nq620.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"bluetooth"
],
"debug": {
"jlink_device": "nRF52832_xxAA",
"onboard_tools": [
"cmsis-dap"
]
Expand Down
1 change: 1 addition & 0 deletions boards/nrf52840_dk.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"bluetooth"
],
"debug": {
"jlink_device": "nRF52840_xxAA",
"default_tools": [
"jlink"
],
Expand Down
1 change: 1 addition & 0 deletions boards/nrf52_dk.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"bluetooth"
],
"debug": {
"jlink_device": "nRF52832_xxAA",
"default_tools": [
"jlink"
],
Expand Down
1 change: 1 addition & 0 deletions boards/redbear_blenano2.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"bluetooth"
],
"debug": {
"jlink_device": "nRF52832_xxAA",
"onboard_tools": [
"cmsis-dap"
]
Expand Down
1 change: 1 addition & 0 deletions boards/redbear_blend2.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"bluetooth"
],
"debug": {
"jlink_device": "nRF52832_xxAA",
"onboard_tools": [
"cmsis-dap"
]
Expand Down
3 changes: 3 additions & 0 deletions boards/stct_nrf52_minidev.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"connectivity": [
"bluetooth"
],
"debug": {
"jlink_device": "nRF52832_xxAA"
},
"frameworks": [
"arduino"
],
Expand Down
1 change: 1 addition & 0 deletions boards/ublox_evk_nina_b1.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"nfc"
],
"debug": {
"jlink_device": "nRF52832_xxAA",
"onboard_tools": [
"jlink"
]
Expand Down
33 changes: 30 additions & 3 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# limitations under the License.

import sys
from os.path import join
from platform import system
from os import makedirs
from os.path import isdir, join

from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
DefaultEnvironment)
Expand Down Expand Up @@ -184,17 +186,42 @@
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")
]

elif upload_protocol.startswith("nrfjprog"):
elif upload_protocol == "nrfjprog":
env.Replace(
UPLOADER="nrfjprog",
UPLOADERFLAGS=[
"--chiperase",
"-r"
"--reset"
],
UPLOADCMD="$UPLOADER $UPLOADERFLAGS --program $SOURCE"
)
upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]

elif upload_protocol.startswith("jlink"):

def _jlink_cmd_script(env, source):
build_dir = env.subst("$BUILD_DIR")
if not isdir(build_dir):
makedirs(build_dir)
script_path = join(build_dir, "upload.jlink")
commands = ["h", "loadbin %s,0x0" % source, "r", "q"]
with open(script_path, "w") as fp:
fp.write("\n".join(commands))
return script_path

env.Replace(
__jlink_cmd_script=_jlink_cmd_script,
UPLOADER="JLink.exe" if system() == "Windows" else "JLinkExe",
UPLOADERFLAGS=[
"-device", env.BoardConfig().get("debug", {}).get("jlink_device"),
"-speed", "4000",
"-if", ("jtag" if upload_protocol == "jlink-jtag" else "swd"),
"-autoconnect", "1"
],
UPLOADCMD="$UPLOADER $UPLOADERFLAGS -CommanderScript ${__jlink_cmd_script(__env__, SOURCE)}"
)
upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]

elif upload_protocol in debug_tools:
env.Replace(
UPLOADER="openocd",
Expand Down
4 changes: 2 additions & 2 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "git",
"url": "https://github.com/platformio/platform-nordicnrf52.git"
},
"version": "2.1.0",
"version": "2.2.0",
"packageRepositories": [
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
"http://dl.platformio.org/packages/manifest.json"
Expand All @@ -35,7 +35,7 @@
"framework-mbed": {
"type": "framework",
"optional": true,
"version": "~4.50707.0"
"version": "~4.50802.0"
},
"framework-arduinonordicnrf5": {
"type": "framework",
Expand Down
26 changes: 23 additions & 3 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from platform import system

from platformio.managers.platform import PlatformBase


Expand Down Expand Up @@ -55,16 +57,34 @@ def _add_default_debug_tools(self, board):
for link in ("blackmagic", "jlink", "stlink", "cmsis-dap"):
if link not in upload_protocols or link in debug['tools']:
continue

if link == "blackmagic":
debug['tools']['blackmagic'] = {
"hwids": [["0x1d50", "0x6018"]],
"require_debug_port": True
}

elif link == "jlink":
assert debug.get("jlink_device"), (
"Missed J-Link Device ID for %s" % board.id)
debug['tools'][link] = {
"server": {
"arguments": [
"-singlerun",
"-if", "SWD",
"-select", "USB",
"-device", debug.get("jlink_device"),
"-port", "2331"
],
"executable": ("JLinkGDBServerCL.exe"
if system() == "Windows" else
"JLinkGDBServer")
},
"onboard": link in debug.get("onboard_tools", [])
}

else:
server_args = ["-f", "scripts/interface/%s.cfg" % link]
if link == "jlink":
server_args.extend(
["-c", "transport select swd; set WORKAREASIZE 0"])
if link == "stlink":
server_args.extend([
"-c",
Expand Down

0 comments on commit 3817c81

Please sign in to comment.