target: restructure dap support
[openocd.git] / tcl / target / lpc1xxx.cfg
1 # Main file for NXP LPC1xxx/LPC40xx series Cortex-M0/0+/3/4F parts
2 #
3 # !!!!!!
4 #
5 # This file should not be included directly, rather by the lpc11xx.cfg,
6 # lpc13xx.cfg, lpc17xx.cfg, etc. which set the needed variables to the
7 # appropriate values.
8 #
9 # !!!!!!
10
11 # LPC8xx chips support only SWD transport.
12 # LPC11xx chips support only SWD transport.
13 # LPC12xx chips support only SWD transport.
14 # LPC11Uxx chips support only SWD transports.
15 # LPC13xx chips support only SWD transports.
16 # LPC17xx chips support both JTAG and SWD transports.
17 # LPC40xx chips support both JTAG and SWD transports.
18 # Adapt based on what transport is active.
19 source [find target/swj-dp.tcl]
20
21 if { [info exists CHIPNAME] } {
22 set _CHIPNAME $CHIPNAME
23 } else {
24 error "CHIPNAME not set. Please do not include lpc1xxx.cfg directly, but the specific chip configuration file (lpc11xx.cfg, lpc13xx.cfg, lpc17xx.cfg, etc)."
25 }
26
27 if { [info exists CHIPSERIES] } {
28 # Validate chip series is supported
29 if { $CHIPSERIES != "lpc800" && $CHIPSERIES != "lpc1100" && $CHIPSERIES != "lpc1200" && $CHIPSERIES != "lpc1300" && $CHIPSERIES != "lpc1700" && $CHIPSERIES != "lpc4000" } {
30 error "Unsupported LPC1xxx chip series specified."
31 }
32 set _CHIPSERIES $CHIPSERIES
33 } else {
34 error "CHIPSERIES not set. Please do not include lpc1xxx.cfg directly, but the specific chip configuration file (lpc11xx.cfg, lpc13xx.cfg, lpc17xx.cfg, etc)."
35 }
36
37 # After reset, the chip is clocked by an internal RC oscillator.
38 # When board-specific code (reset-init handler or device firmware)
39 # configures another oscillator and/or PLL0, set CCLK to match; if
40 # you don't, then flash erase and write operations may misbehave.
41 # (The ROM code doing those updates cares about core clock speed...)
42 # CCLK is the core clock frequency in KHz
43 if { [info exists CCLK] } {
44 # Allow user override
45 set _CCLK $CCLK
46 } else {
47 # LPC8xx/LPC11xx/LPC12xx/LPC13xx use a 12MHz one, LPC17xx uses a 4MHz one(except for LPC177x/8x,LPC407x/8x)
48 if { $_CHIPSERIES == "lpc800" || $_CHIPSERIES == "lpc1100" || $_CHIPSERIES == "lpc1200" || $_CHIPSERIES == "lpc1300" } {
49 set _CCLK 12000
50 } elseif { $_CHIPSERIES == "lpc1700" || $_CHIPSERIES == "lpc4000" } {
51 set _CCLK 4000
52 }
53 }
54
55 if { [info exists CPUTAPID] } {
56 # Allow user override
57 set _CPUTAPID $CPUTAPID
58 } else {
59 # LPC8xx/LPC11xx/LPC12xx use a Cortex-M0/M0+ core, LPC13xx/LPC17xx use a Cortex-M3 core, LPC40xx use a Cortex-M4F core.
60 if { $_CHIPSERIES == "lpc800" || $_CHIPSERIES == "lpc1100" || $_CHIPSERIES == "lpc1200" } {
61 set _CPUTAPID 0x0bb11477
62 } elseif { $_CHIPSERIES == "lpc1300" || $_CHIPSERIES == "lpc1700" || $_CHIPSERIES == "lpc4000" } {
63 if { [using_jtag] } {
64 set _CPUTAPID 0x4ba00477
65 } {
66 set _CPUTAPID 0x2ba01477
67 }
68 }
69 }
70
71 if { [info exists WORKAREASIZE] } {
72 set _WORKAREASIZE $WORKAREASIZE
73 } else {
74 error "WORKAREASIZE is not set. The $CHIPNAME part is available in several Flash and RAM size configurations. Please set WORKAREASIZE."
75 }
76
77 swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
78 dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
79
80 set _TARGETNAME $_CHIPNAME.cpu
81 target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
82
83 # The LPC11xx devices have 2/4/8kB of SRAM in the ARMv7-M "Code" area (at 0x10000000)
84 # The LPC12xx devices have 4/8kB of SRAM in the ARMv7-M "Code" area (at 0x10000000)
85 # The LPC11Uxx devices have 4/6/8kB of SRAM in the ARMv7-M "Code" area (at 0x10000000)
86 # The LPC13xx devices have 4/8kB of SRAM in the ARMv7-M "Code" area (at 0x10000000)
87 # The LPC17xx devices have 8/16/32/64kB of SRAM in the ARMv7-M "Code" area (at 0x10000000)
88 # The LPC40xx devices have 16/32/64kB of SRAM in the ARMv7-ME "Code" area (at 0x10000000)
89 $_TARGETNAME configure -work-area-phys 0x10000000 -work-area-size $_WORKAREASIZE
90
91 # The LPC11xx devies have 8/16/24/32/48/56/64kB of flash memory (at 0x00000000)
92 # The LPC12xx devies have 32/48/64/80/96/128kB of flash memory (at 0x00000000)
93 # The LPC11Uxx devies have 16/24/32/40/48/64/96/128kB of flash memory (at 0x00000000)
94 # The LPC13xx devies have 8/16/32kB of flash memory (at 0x00000000)
95 # The LPC17xx devies have 32/64/128/256/512kB of flash memory (at 0x00000000)
96 # The LPC40xx devies have 64/128/256/512kB of flash memory (at 0x00000000)
97 #
98 # All are compatible with the "lpc1700" variant of the LPC2000 flash driver
99 # (same cmd51 destination boundary alignment, and all three support 256 byte
100 # transfers).
101 #
102 # flash bank <name> lpc2000 <base> <size> 0 0 <target#> <variant> <clock> [calc checksum]
103 set _FLASHNAME $_CHIPNAME.flash
104 flash bank $_FLASHNAME lpc2000 0x0 0 0 0 $_TARGETNAME \
105 auto $_CCLK calc_checksum
106
107 if { $_CHIPSERIES == "lpc800" || $_CHIPSERIES == "lpc1100" || $_CHIPSERIES == "lpc1200" || $_CHIPSERIES == "lpc1300" } {
108 # Do not remap 0x0000-0x0200 to anything but the flash (i.e. select
109 # "User Flash Mode" where interrupt vectors are _not_ remapped,
110 # and reside in flash instead).
111 #
112 # Table 8. System memory remap register (SYSMEMREMAP, address 0x4004 8000) bit description
113 # Bit Symbol Value Description
114 # 1:0 MAP System memory remap
115 # 0x0 Boot Loader Mode. Interrupt vectors are re-mapped to Boot ROM.
116 # 0x1 User RAM Mode. Interrupt vectors are re-mapped to Static RAM.
117 # 0x2 User Flash Mode. Interrupt vectors are not re-mapped and reside in Flash.
118 # 31:2 - - Reserved.
119 $_TARGETNAME configure -event reset-init {
120 mww 0x40048000 0x02
121 }
122 } elseif { $_CHIPSERIES == "lpc1700" || $_CHIPSERIES == "lpc4000" } {
123 # Do not remap 0x0000-0x0020 to anything but the flash (i.e. select
124 # "User Flash Mode" where interrupt vectors are _not_ remapped,
125 # and reside in flash instead).
126 #
127 # See Table 612. Memory Mapping Control register (MEMMAP - 0x400F C040) bit description
128 # Bit Symbol Value Description Reset
129 # value
130 # 0 MAP Memory map control. 0
131 # 0 Boot mode. A portion of the Boot ROM is mapped to address 0.
132 # 1 User mode. The on-chip Flash memory is mapped to address 0.
133 # 31:1 - Reserved. The value read from a reserved bit is not defined. NA
134 #
135 # http://ics.nxp.com/support/documents/microcontrollers/?scope=LPC1768&type=user
136 $_TARGETNAME configure -event reset-init {
137 mww 0x400FC040 0x01
138 }
139 }
140
141 # Run with *real slow* clock by default since the
142 # boot rom could have been playing with the PLL, so
143 # we have no idea what clock the target is running at.
144 adapter_khz 10
145
146 # delays on reset lines
147 adapter_nsrst_delay 200
148 if {[using_jtag]} {
149 jtag_ntrst_delay 200
150 }
151
152 # LPC8xx (Cortex-M0+ core) support SYSRESETREQ
153 # LPC11xx/LPC12xx (Cortex-M0 core) support SYSRESETREQ
154 # LPC13xx/LPC17xx (Cortex-M3 core) support SYSRESETREQ
155 # LPC40xx (Cortex-M4F core) support SYSRESETREQ
156 if {![using_hla]} {
157 # if srst is not fitted use SYSRESETREQ to
158 # perform a soft reset
159 cortex_m reset_config sysresetreq
160 }

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)