cfg: Fix Kinetis kwikstik/kx config
[openocd.git] / tcl / target / m051.cfg
blobd06559470a3ba27424e5714f855a26e9b7965ef9
1 # script for nuvoton M051 family
3 transport select hla_swd
5 source [find target/swj-dp.tcl]
7 if { [info exists CHIPNAME] } {
8    set _CHIPNAME $CHIPNAME
9 } else {
10    set _CHIPNAME m051
13 if { [info exists ENDIAN] } {
14    set _ENDIAN $ENDIAN
15 } else {
16    set _ENDIAN little
19 # Work-area is a space in RAM used for flash programming
20 # By default use 4kB
21 if { [info exists WORKAREASIZE] } {
22    set _WORKAREASIZE $WORKAREASIZE
23 } else {
24    set _WORKAREASIZE 0x1000
27 if { [info exists CPUTAPID] } {
28    set _CPUTAPID $CPUTAPID
29 } else {
30   # See STM Document RM0091
31   # Section 29.5.3
32    set _CPUTAPID 0x0bb11477
35 swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
37 set _TARGETNAME $_CHIPNAME.cpu
38 target create $_TARGETNAME cortex_m -endian $_ENDIAN -chain-position $_TARGETNAME
40 $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
42 # flash size will be probed
43 set _FLASHNAME $_CHIPNAME.flash_aprom
44 flash bank $_FLASHNAME mini51 0x00000000 0x4000 0 0 $_TARGETNAME
45 set _FLASHNAME $_CHIPNAME.flash_data
46 flash bank $_FLASHNAME mini51 0x0001F000 0x1000 0 0 $_TARGETNAME
47 set _FLASHNAME $_CHIPNAME.flash_ldrom
48 flash bank $_FLASHNAME mini51 0x00100000 0x1000 0 0 $_TARGETNAME
49 set _FLASHNAME $_CHIPNAME.flash_conf
50 flash bank $_FLASHNAME mini51 0x00300000 0x0100 0 0 $_TARGETNAME
52 # adapter speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
53 adapter_khz 1000
55 adapter_nsrst_delay 100
57 if {![using_hla]} {
58    # if srst is not fitted use SYSRESETREQ to
59    # perform a soft reset
60    cortex_m reset_config sysresetreq