tcl/target: add SPDX tag
[fw/openocd] / tcl / target / lpc2294.cfg
index 399b11dfb7bdfa9fbfb2f7c99d8ba34311ab1189..7537a6541cccbcf42222b9523b2384b5ff01053b 100644 (file)
@@ -1,38 +1,25 @@
-if { [info exists CHIPNAME] } {
-   set  _CHIPNAME $CHIPNAME
-} else {
-   set  _CHIPNAME lpc2294
-}
-
-if { [info exists ENDIAN] } {
-   set  _ENDIAN $ENDIAN
-} else {
-   set  _ENDIAN little
-}
+# SPDX-License-Identifier: GPL-2.0-or-later
 
-if { [info exists CPUTAPID ] } {
-   set _CPUTAPID $CPUTAPID
-} else {
-  # force an error till we get a good number
-   set _CPUTAPID 0xffffffff
-}
+# NXP LPC2294 ARM7TDMI-S with 256kB flash and 16kB SRAM, clocked with 12MHz crystal
 
-jtag_nsrst_delay 200
-jtag_ntrst_delay 200
+source [find target/lpc2xxx.cfg]
 
-#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config trst_and_srst srst_pulls_trst
+# parameters:
+# - core_freq_khz - frequency of core in kHz during flashing, usually equal to connected crystal or internal oscillator, e.g. 12000
+# - adapter_freq_khz - frequency of debug adapter in kHz, should be 8x slower than core_freq_khz, e.g. 1000
 
-#jtag scan chain
-jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
+proc setup_lpc2294 {core_freq_khz adapter_freq_khz} {
+       # 256kB flash and 16kB SRAM
+       # setup_lpc2xxx <chip_name> <cputapid> <flash_size> <flash_variant> <workarea_size> <core_freq_khz> <adapter_freq_khz>
 
-set _TARGETNAME $_CHIPNAME.cpu
-target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi-s_r4
-$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x40000000 -work-area-size 0x4000 -work-area-backup 0
+       # !! TAPID unknown !!
+       setup_lpc2xxx lpc2294 0xffffffff 0x40000 lpc2000_v1 0x4000 $core_freq_khz $adapter_freq_khz
+}
 
-#flash configuration
-#flash bank lpc2000 <base> <size> 0 0 <target#> <variant>
-flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14765 calc_checksum
+proc init_targets {} {
+       # default to core clocked with 12MHz crystal
+       echo "Warning - assuming default core clock 12MHz! Flashing may fail if actual core clock is different."
 
-# For more information about the configuration files, take a look at:
-# openocd.texi
+       # setup_lpc2294 <core_freq_khz> <adapter_freq_khz>
+       setup_lpc2294 12000 1500
+}