tcl/board: add SPDX tag
[fw/openocd] / tcl / board / olimex_sam7_la2.cfg
1 # SPDX-License-Identifier: GPL-2.0-or-later
2
3 source [find target/at91sam7a2.cfg]
4
5 # delays needed to get stable reads of cpu state
6 jtag_ntrst_delay 10
7 adapter srst delay 200
8
9 # board uses pullup and connects only srst
10 reset_config srst_open_drain
11
12 # srst is connected to NRESET of CPU and fully resets everything...
13 reset_config srst_only srst_pulls_trst
14
15 adapter speed 1
16 $_TARGETNAME configure -event reset-start {
17         adapter speed 1
18 }
19
20 $_TARGETNAME configure -event reset-init {
21         # init script from http://www.mikrocontroller.net/topic/107462
22         # AT91SAM7A2
23         # AMC (advanced memory controller)
24
25         echo "setting up AMC"
26         # AMC_CS0 - FLASH 1MB (0x40000000-0x400FFFFF) + DM9000E (0x40100000)
27         mww 0xFFE00000 0x40003EBD
28
29         # AMC_CS1 - RAM low 2MB (0x40400000-0x405FFFFF)
30         mww 0xFFE00004 0x404030A9
31
32         # AMC_CS2 - RAM high 2MB (0x40800000-0x405FFFFF)
33         #mww 0xFFE00008 0x404030A9
34         # changed to  0x40_8_
35         mww 0xFFE00008 0x408030A9
36
37         # AMC_MCR
38         mww 0xFFE00024 0x00000004
39
40         # AMC_RCR force remap
41         mww 0xFFE00020 0x00000001
42
43         echo "set up AMC"
44         sleep 100
45
46         # the following base addresses from the original script did not correspond to those from datasheet
47         # changed bases from 0xFF000000 to 0xFFF00000
48
49         # disable watchdog, to prevent unwanted resets
50         mww 0xFFFA0068 0x00000000
51         echo "disabled watchdog"
52
53         sleep 50
54
55         # disable PLL
56         mww 0xFFFEC004 0x18070004
57
58         # PLL = 10 ==> Coreclock = 6Mhz*10/2 = 30 Mhz
59         mww 0xFFFEC010 0x762D800A
60
61         # enable PLL
62         mww 0xFFFEC000 0x23050004
63         echo "set up pll"
64
65         sleep 100
66         adapter speed 5000
67 }
68
69 $_TARGETNAME arm7_9 dcc_downloads enable
70 $_TARGETNAME arm7_9 fast_memory_access enable
71
72 # remap:  ram at 0, flash at 0x40000000, like reset-init above does
73 $_TARGETNAME configure -work-area-phys 0x00000000 -work-area-size 0x4000 -work-area-backup 1
74 flash bank onboard.flash cfi 0x40000000 0x00100000 2 2 at91sam7a2.cpu
75
76 # boot: ram at 0x300000, flash at 0x0, useful if board is in funny configuration
77 #$_TARGETNAME configure -work-area-phys 0x00300000 -work-area-size 0x4000 -work-area-backup 1
78 #flash bank onboard1.flash cfi 0x00000000 0x00100000 2 2 at91sam7a2.cpu