Shows how to share code more easily between configuration files. LPC2148 is different enough that more work is needed. Perhaps LPC2148 is the most tested config file and that the rest should have the same fixes(e.g. reset-init sequence)?
Signed-off-by: Øyvind Harboe <oyvind.har...@zylin.com> --- tcl/target/lpc2103.cfg | 33 +++++---------------------------- tcl/target/lpc2124.cfg | 34 +++++----------------------------- tcl/target/lpc2129.cfg | 32 +++++--------------------------- tcl/target/lpc21xx.cfg | 28 ++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 84 deletions(-) create mode 100644 tcl/target/lpc21xx.cfg diff --git a/tcl/target/lpc2103.cfg b/tcl/target/lpc2103.cfg index 7f14555..a58875b 100644 --- a/tcl/target/lpc2103.cfg +++ b/tcl/target/lpc2103.cfg @@ -1,32 +1,9 @@ # NXP LPC2103 ARM7TDMI-S with 32kB Flash and 8kB SRAM, clocked with 12MHz crystal -if { [info exists CHIPNAME] } { - set _CHIPNAME $CHIPNAME -} else { - set _CHIPNAME lpc2103 -} +source [find target/lpc21xx.cfg] -if { [info exists CPUTAPID ] } { - set _CPUTAPID $CPUTAPID -} else { - set _CPUTAPID 0x4f1f0f0f +proc init_targets {} { + # 8kB of internal SRAM + # 32kB of internal Flash, core clocked with 12MHz crystal + setup_lpc21xx lpc2103 1000 0x4f1f0f0f 0x2000 0x8000 lpc2000_v2 12000 } - -reset_config trst_and_srst - -# reset delays -adapter_nsrst_delay 100 -jtag_ntrst_delay 100 - -jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID - -set _TARGETNAME $_CHIPNAME.cpu -target create $_TARGETNAME arm7tdmi -chain-position $_TARGETNAME - -# 8kB of internal SRAM -$_TARGETNAME configure -work-area-phys 0x40000000 -work-area-size 0x2000 -work-area-backup 0 - -# 32kB of internal Flash, core clocked with 12MHz crystal -# flash bank <name> lpc2000 <base> <size> 0 0 <target#> <variant> <clock> [calc checksum] -set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME lpc2000 0x0 0x8000 0 0 $_TARGETNAME lpc2000_v2 12000 calc_checksum diff --git a/tcl/target/lpc2124.cfg b/tcl/target/lpc2124.cfg index df71bdd..2ff5388 100644 --- a/tcl/target/lpc2124.cfg +++ b/tcl/target/lpc2124.cfg @@ -1,33 +1,9 @@ # NXP LPC2124 -if { [info exists CHIPNAME] } { - set _CHIPNAME $CHIPNAME -} else { - set _CHIPNAME lpc2124 -} +source [find target/lpc21xx.cfg] -if { [info exists CPUTAPID ] } { - set _CPUTAPID $CPUTAPID -} else { - set _CPUTAPID 0x4f1f0f0f +proc init_targets {} { + # 32kB of internal SRAM + # 256kB of internal Flash, core clocked with 14745KHz crystal + setup_lpc21xx lpc2124 1000 0x4f1f0f0f 0x4000 0x40000 lpc2000_v1 14745 } - -reset_config trst_and_srst - -# reset delays -adapter_nsrst_delay 100 -jtag_ntrst_delay 100 - -adapter_khz 1000 - -#jtag scan chain -jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID - -set _TARGETNAME $_CHIPNAME.cpu -target create $_TARGETNAME arm7tdmi -chain-position $_TARGETNAME - -$_TARGETNAME configure -work-area-phys 0x40000000 -work-area-size 0x4000 -work-area-backup 0 - -# flash bank <name> lpc2000 <base> <size> 0 0 <target#> <variant> <clock> [calc checksum] -set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME lpc2000 0x0 0x40000 0 0 $_TARGETNAME lpc2000_v1 14745 calc_checksum diff --git a/tcl/target/lpc2129.cfg b/tcl/target/lpc2129.cfg index 2587bf7..389b0b9 100644 --- a/tcl/target/lpc2129.cfg +++ b/tcl/target/lpc2129.cfg @@ -1,31 +1,9 @@ # NXP LPC2129 -if { [info exists CHIPNAME] } { - set _CHIPNAME $CHIPNAME -} else { - set _CHIPNAME lpc2129 -} +source [find target/lpc21xx.cfg] -if { [info exists CPUTAPID ] } { - set _CPUTAPID $CPUTAPID -} else { - set _CPUTAPID 0xcf1f0f0f +proc init_targets {} { + # 32kB of internal SRAM + # 256kB of internal Flash, core clocked with 14745KHz crystal + setup_lpc21xx lpc2129 1000 0xcf1f0f0f 0x4000 0x40000 lpc2000_v1 14765 } - -reset_config trst_and_srst - -# reset delays -adapter_nsrst_delay 100 -jtag_ntrst_delay 100 - -#jtag scan chain -jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID - -set _TARGETNAME $_CHIPNAME.cpu -target create $_TARGETNAME arm7tdmi -chain-position $_TARGETNAME - -$_TARGETNAME configure -work-area-phys 0x40000000 -work-area-size 0x4000 -work-area-backup 0 - -# flash bank <name> lpc2000 <base> <size> 0 0 <target#> <variant> <clock> [calc checksum] -set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME lpc2000 0x0 0x40000 0 0 $_TARGETNAME lpc2000_v1 14765 calc_checksum diff --git a/tcl/target/lpc21xx.cfg b/tcl/target/lpc21xx.cfg new file mode 100644 index 0000000..597bdcb --- /dev/null +++ b/tcl/target/lpc21xx.cfg @@ -0,0 +1,28 @@ +# Common setup between the lpc21xx parts + +proc setup_lpc21xx {chipname jtagspeed cputapid workareasize flashsize flashvariant clockrate} { + reset_config trst_and_srst + + # reset delays + adapter_nsrst_delay 100 + jtag_ntrst_delay 100 + + jtag_khz $jtagspeed + + jtag newtap $chipname cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $cputapid + + set _TARGETNAME $chipname.cpu + target create $_TARGETNAME arm7tdmi -chain-position $_TARGETNAME + + $_TARGETNAME configure -work-area-phys 0x40000000 -work-area-size $workareasize -work-area-backup 0 + + # flash bank <name> lpc2000 <base> <size> 0 0 <target#> <variant> <clock> [calc checksum] + set _FLASHNAME $chipname.flash + flash bank $_FLASHNAME lpc2000 0x0 $flashsize 0 0 $_TARGETNAME $flashvariant $clockrate calc_checksum +} + +proc init_targets {} { + # FIX!!! read out CPUTAPID here and choose right setup. In addition to the + # CPUTAPID some querying of the target would be required. + return -error "This is a generic LPC21xx configuration file, use a specific target file." +} -- 1.7.0.4 _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development