summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-01-24 16:01:39 -0800
committerVincent Palatin <vpalatin@chromium.org>2012-01-24 16:18:52 -0800
commitdc97a7ec1e4fd92a6fb3a3eb332d1638c9d54b1e (patch)
treecb281087b9436ee4a42ca4e4160c596b42eb3279
parentd356dea61ee170366acddc373953dad20f6fc48e (diff)
downloadchrome-ec-dc97a7ec1e4fd92a6fb3a3eb332d1638c9d54b1e.tar.gz
Add more openOCD automation as a TCL script
This script is automatically loaded when launching 'openocd -f openocd.cfg'. It adds 'flash_bds', 'ramboot_bds' commands to the openOCD console. The former is writing the current EC firmware inside the internal flash, the latter is loading a RAM only firmware on the chip. There are similar commands for the Link Proto-0 board : 'flash_link', 'ramboot_link'. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=none TEST=type 'flash_bds' from openocd telnet console Change-Id: Ic63281a99ee1d083986696675ed0a82da7c033ee
-rw-r--r--chip/lm4/openocd/lm4x.cfg3
-rw-r--r--chip/lm4/openocd/lm4x_cmds.tcl42
-rw-r--r--chip/lm4/openocd/up-link.tcl12
3 files changed, 45 insertions, 12 deletions
diff --git a/chip/lm4/openocd/lm4x.cfg b/chip/lm4/openocd/lm4x.cfg
index 8d9ff64ca2..3619320c57 100644
--- a/chip/lm4/openocd/lm4x.cfg
+++ b/chip/lm4/openocd/lm4x.cfg
@@ -29,3 +29,6 @@ $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 0x3000
#flash configuration
flash bank stellaris 0 0 0 0 $_TARGETNAME
+
+# useful command definitions for software loading
+source [find lm4x_cmds.tcl]
diff --git a/chip/lm4/openocd/lm4x_cmds.tcl b/chip/lm4/openocd/lm4x_cmds.tcl
new file mode 100644
index 0000000000..d117db71f6
--- /dev/null
+++ b/chip/lm4/openocd/lm4x_cmds.tcl
@@ -0,0 +1,42 @@
+# Copyright (c) 2012 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 Blizzard LM4F chip
+
+# Program internal flash
+
+proc flash_lm4 {path size} {
+ set lastsect [expr {$size / 1024 - 1}];
+ reset halt;
+ flash erase_sector 0 0 $lastsect;
+ flash write_image $path 0;
+ reset
+}
+
+# Link proto0 has 128KB flash; proto1+ will likely have 256KB, in which
+# case this'll need changing.
+proc flash_link { } {
+ flash_lm4 ../../../build/link/ec.bin 131072
+}
+
+proc flash_bds { } {
+ flash_lm4 ../../../build/bds/ec.bin 262144
+}
+
+# Boot a software using internal RAM only
+
+proc ramboot_lm4 {path} {
+ reset halt
+ load_image $path 0x20000000 bin
+ reg 15 0x20000400
+ resume
+}
+
+proc ramboot_link { } {
+ ramboot_lm4 ../../../build/link/ec.RO.flat
+}
+
+proc ramboot_bds { } {
+ ramboot_lm4 ../../../build/bds/ec.RO.flat
+}
diff --git a/chip/lm4/openocd/up-link.tcl b/chip/lm4/openocd/up-link.tcl
deleted file mode 100644
index 227a9c42ea..0000000000
--- a/chip/lm4/openocd/up-link.tcl
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2012 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.
-#
-# Upload link image to flash and run it
-
-reset halt
-# Link proto0 has 128KB flash; proto1+ will likely have 256KB, in which
-# case this'll need changing.
-flash erase_sector 0 0 127
-flash write_image ../../../build/link/ec.bin 0
-reset