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

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)