summaryrefslogtreecommitdiff
path: root/util/openocd/nrf51_cmds.tcl
diff options
context:
space:
mode:
authorMyles Watson <mylesgw@chromium.org>2015-07-17 13:05:43 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-08-04 19:22:12 +0000
commit050db0510ef2d7ed72f1befc9bd0569d69bf0e4a (patch)
tree8a5a6fb5c7ff16df460d2d75fcfedc16469ef573 /util/openocd/nrf51_cmds.tcl
parentd804e8fdbd1e9f238317c68d235add1806dcd49f (diff)
downloadchrome-ec-050db0510ef2d7ed72f1befc9bd0569d69bf0e4a.tar.gz
flash_ec: add support for SWD, nrf51, and hadoken
BUG=none TEST=manual BRANCH=none flash_ec --board=hadoken flash_ec --board=npcx_evb flash_ec --board=samus Use openocd in SWD mode to flash the nRF51 chip. Use warm_reset to exit DEBUG mode. Change-Id: Iaf2827d4ce5be6d61431a3de7ab4f86aa4adde02 Signed-off-by: Myles Watson <mylesgw@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/287039 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'util/openocd/nrf51_cmds.tcl')
-rw-r--r--util/openocd/nrf51_cmds.tcl22
1 files changed, 22 insertions, 0 deletions
diff --git a/util/openocd/nrf51_cmds.tcl b/util/openocd/nrf51_cmds.tcl
new file mode 100644
index 0000000000..711b27574d
--- /dev/null
+++ b/util/openocd/nrf51_cmds.tcl
@@ -0,0 +1,22 @@
+# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# Command automation for Nordic nRF51 chip
+
+proc flash_nrf51 {path offset} {
+ reset halt;
+ program $path $offset;
+}
+
+proc unprotect_nrf51 { } {
+ reset halt;
+ nrf51 mass_erase;
+}
+
+# enable reset by writing 1 to the RESET register
+# This will disconnect the debugger with the following message:
+# Polling target nrf51.cpu failed, trying to reexamine
+proc exit_debug_mode_nrf51 { } {
+ mww 0x40000544 1;
+}