tcl/board: add SPDX tag
[fw/openocd] / tcl / board / at91eb40a.cfg
1 # SPDX-License-Identifier: GPL-2.0-or-later
2
3 #Script for AT91EB40a
4
5 # FIXME use some standard target config, maybe create one from this
6 #
7 #       source [find target/...cfg]
8
9 if { [info exists CHIPNAME] } {
10    set  _CHIPNAME $CHIPNAME
11 } else {
12    set  _CHIPNAME at91eb40a
13 }
14
15 if { [info exists ENDIAN] } {
16    set  _ENDIAN $ENDIAN
17 } else {
18    set  _ENDIAN little
19 }
20
21 if { [info exists CPUTAPID] } {
22    set _CPUTAPID $CPUTAPID
23 } else {
24    set _CPUTAPID 0x1f0f0f0f
25 }
26
27
28 #Atmel ties SRST & TRST together, at which point it makes
29 #no sense to use TRST, but use TMS instead.
30 #
31 #The annoying thing with tying SRST & TRST together is that
32 #there is no way to halt the CPU *before and during* the
33 #SRST reset, which means that the CPU will run a number
34 #of cycles before it can be halted(as much as milliseconds).
35 reset_config srst_only srst_pulls_trst
36
37 #jtag scan chain
38 jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
39
40 #target configuration
41 set _TARGETNAME $_CHIPNAME.cpu
42 target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME
43
44 # speed up memory downloads
45 arm7_9 fast_memory_access enable
46 arm7_9 dcc_downloads enable
47
48 #flash driver
49 set _FLASHNAME $_CHIPNAME.flash
50 flash bank $_FLASHNAME cfi 0x01000000 0x200000 2 2 $_TARGETNAME
51
52 # required for usable performance. Used for lots of
53 # other things than flash programming.
54 $_TARGETNAME configure -work-area-phys 0x00030000 -work-area-size 0x10000 -work-area-backup 0
55
56 $_TARGETNAME configure -event reset-init {
57         echo "Running reset init script for AT91EB40A"
58         # Reset script for AT91EB40a
59         reg cpsr 0x000000D3
60         mww 0xFFE00020 0x1
61         mww 0xFFE00024 0x00000000
62         mww 0xFFE00000 0x01002539
63         mww 0xFFFFF124 0xFFFFFFFF
64         mww 0xffff0010 0x100
65         mww 0xffff0034 0x100
66 }
67
68 # This target is pretty snappy...
69 adapter speed 16000