OK, now I have something that will probably reunite us all.

This patch allows OpenOCD to be run with this target script but define CCLK via command line:

openocd -c "set CCLK 12345" -f target/lpc2478.cfg

It has only one downside, as I've noticed that OpenOCD prints the value... The more funny thing:

openocd -c "set X 100; set Y 12345; set Z 0xFFFF" -c "set A 1; set B 2; set C 3"
Open On-Chip Debugger 0.5.0-dev (2010-06-13-00:09)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.berlios.de/doc/doxygen/bugs.html
0xFFFF
3
Error: Debug Adapter has to be specified, see "interface" command
Command handler execution failed
...

So, as you see, the last value from each "-c" is printed. I don't know why. Adding semicolon at the end changes nothing.

This way, when in script usage of this value is preceded with "global VAR_NAME" it can be used this way. That's the only change I've made to the original patch.

4\/3!!
From bdf7b41321ef512d38be2d060ea20f0585534295 Mon Sep 17 00:00:00 2001
From: Rolf Meeser <rolfm_...@yahoo.de>
Date: Fri, 3 Dec 2010 14:10:40 +0100
Subject: [PATCH] lpc2478 target config: CCLK as (mandatory) parameter

Differences to original patch: CCLK is "imported" to script, so it works when 
CCLK is supplied via command line (openocd -c "set CCLK 12345" -f 
target/lpc2478.cfg)

Originally by: Rolf Meeser <rolfm_...@yahoo.de>
Signed-off-by: Freddie Chopin <freddie_cho...@op.pl>
---
 tcl/target/lpc2478.cfg |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/tcl/target/lpc2478.cfg b/tcl/target/lpc2478.cfg
index 99c8ce9..3e02fbe 100644
--- a/tcl/target/lpc2478.cfg
+++ b/tcl/target/lpc2478.cfg
@@ -12,6 +12,15 @@ if { [info exists CPUTAPID ] } {
        set _CPUTAPID 0x4f1f0f0f
 }
 
+#import CCLK if supplied via commandline
+global CCLK
+
+if { [info exists CCLK ] } {
+       set _CCLK $CCLK
+} else {
+    error "You must specify the CCLK that will be used for flash programming!"
+}
+
 #delays on reset lines
 adapter_nsrst_delay 100
 jtag_ntrst_delay 100
@@ -34,10 +43,6 @@ $_TARGETNAME configure -event reset-init {
 }
 
 # LPC2378 has 512kB of FLASH, but upper 8kB are occupied by bootloader.
-# After reset the chip uses its internal 4MHz RC oscillator.
 # flash bank <name> lpc2000 <base> <size> 0 0 <target#> <variant> <clock> 
[calc checksum]
 set _FLASHNAME $_CHIPNAME.flash
-flash bank $_FLASHNAME lpc2000 0x0 0x7D000 0 0 $_TARGETNAME lpc2000_v2 4000 
calc_checksum
-
-# Try to use RCLK, if RCLK is not available use "normal" mode. 4MHz / 6 = 
666kHz, so use 500.
-jtag_rclk 500
+flash bank $_FLASHNAME lpc2000 0x0 0x7E000 0 0 $_TARGETNAME lpc2000_v2 $_CCLK 
calc_checksum
-- 
1.6.5.1.1367.gcd48

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to