tcl: am437x: define registers to be used later
[fw/openocd] / tcl / target / m051.cfg
1 # script for nuvoton M051 family
2
3 transport select hla_swd
4
5 source [find target/swj-dp.tcl]
6
7 if { [info exists CHIPNAME] } {
8    set _CHIPNAME $CHIPNAME
9 } else {
10    set _CHIPNAME m051
11 }
12
13 if { [info exists ENDIAN] } {
14    set _ENDIAN $ENDIAN
15 } else {
16    set _ENDIAN little
17 }
18
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
25 }
26
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
33 }
34
35 swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
36
37 set _TARGETNAME $_CHIPNAME.cpu
38 target create $_TARGETNAME cortex_m -endian $_ENDIAN -chain-position $_TARGETNAME
39
40 $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
41
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
51
52 # adapter speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
53 adapter_khz 1000
54
55 adapter_nsrst_delay 100
56
57 if {![using_hla]} {
58    # if srst is not fitted use SYSRESETREQ to
59    # perform a soft reset
60    cortex_m reset_config sysresetreq
61 }