From dc97a7ec1e4fd92a6fb3a3eb332d1638c9d54b1e Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Tue, 24 Jan 2012 16:01:39 -0800 Subject: 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 BUG=none TEST=type 'flash_bds' from openocd telnet console Change-Id: Ic63281a99ee1d083986696675ed0a82da7c033ee --- chip/lm4/openocd/lm4x.cfg | 3 +++ chip/lm4/openocd/lm4x_cmds.tcl | 42 ++++++++++++++++++++++++++++++++++++++++++ chip/lm4/openocd/up-link.tcl | 12 ------------ 3 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 chip/lm4/openocd/lm4x_cmds.tcl delete mode 100644 chip/lm4/openocd/up-link.tcl 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 -- cgit v1.2.1