Skip to content

Commit 7bfbdb4

Browse files
authored
document LPCXpresso55S69 instructions (#78)
1 parent 7bbc330 commit 7bfbdb4

File tree

3 files changed

+151
-3
lines changed

3 files changed

+151
-3
lines changed

README.mkdn

+151-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ From one terminal, `cd` into the root of this repository and run `openocd`.
9191

9292
From another terminal:
9393

94-
```shell
94+
```console
9595
$ cargo xtask gdb demo/app.toml openocd.gdb
9696
```
9797

@@ -102,7 +102,155 @@ deposited at a `(gdb)` prompt halted on the first instruction. Type `c` /
102102

103103
### LPCXpresso55S69 board
104104

105-
TODO: we need instructions for this, as it does not use openocd
105+
To use the LPCXpresso55S69, you will need <a href="https://github.com/mbedmicro/pyOCD">pyOCD</a>, version 0.27.0 or later.
106+
107+
The LPCXpresso55S69 is somewhat of a mess because the built-on on-chip debugger, LPC-Link2, <a href="https://community.nxp.com/t5/LPC-Microcontrollers/SWO-SWV-on-LPC-Link2-with-CMSIS-DAP/m-p/1079442">does not correctly support SWO/SWV</a>.
108+
If you have the stock LPC-Link2, it will report itself this way via `pyocd list`:
109+
110+
111+
```console
112+
$ pyocd list
113+
# Probe Unique ID
114+
-----------------------------------------------------------------
115+
0 NXP Semiconductors LPC-LINK2 CMSIS-DAP V5.361 JSAQCQIQ
116+
```
117+
118+
It's also possible that you have the Segger J-Link firmware -- firmware
119+
that will make its odious presence known by prompting for you to accept license
120+
terms whenever running `pyocd list`!
121+
122+
```console
123+
$ pyocd list
124+
# Probe Unique ID
125+
-----------------------------------------------------------------------------
126+
0 Segger J-Link LPCXpresso V2 compiled Apr 4 2019 16:54:03 726424936
127+
```
128+
129+
In either of these cases you must -- as a one-time step -- install new
130+
firmware on the LPC-Link2. The new firmware is a build of the (open source)
131+
<a href="https://github.com/oxidecomputer/DAPLink">DAPLink</a>, which
132+
we affectionally call **RickLink** after
133+
the engineer who managed to get it all built -- no small feat!
134+
135+
There are two files that you will need, both contained in the Hubris repository:
136+
137+
- <a href="./support/lpc4322_bl_crc.bin">lpc4322_bl_crc.bin</a>
138+
- <a
139+
href="./support/lpc4322_lpc55s69xpresso_if_rla_swo_hacks.bin">lpc4322_lpc55s69xpresso_if_rla_swo_hacks.bin</a>
140+
141+
You will additionally need the <a
142+
href="https://www.nxp.com/design/microcontrollers-developer-resources/lpc-microcontroller-utilities/lpcscrypt-v2-1-1:LPCSCRYPT">LPCScrypt program</a> from NXP.
143+
144+
Here are the steps to install RickLink:
145+
146+
1. Install the DFU jumper. This can be found next to the SWD header on the
147+
left side of the board; it is labelled "DFU".
148+
149+
2. Run `scripts/boot_lpcscrypt` from the installed LPCScrypt software:
150+
151+
```console
152+
$ /usr/local/lpcscrypt/scripts/boot_lpcscrypt
153+
Looking for DFU devices with VID 1fc9 PID 000c ...
154+
dfu-util -d 1fc9:000c -c 1 -i 0 -t 2048 -R -D /usr/local/lpcscrypt/scripts/../bin/LPCScrypt_228.bin.hdr
155+
Booted LPCScrypt target (1fc9:000c) with /usr/local/lpcscrypt/scripts/../bin/LPCScrypt_228.bin.hdr
156+
$
157+
```
158+
159+
3. Run `lpcscrypt clockslow`:
160+
161+
```console
162+
$ /usr/local/lpcscrypt/bin/lpcscrypt clockslow
163+
$
164+
```
165+
166+
4. Run `lpcscrypt program +c <path-to-lpc4322_bl_crc.bin> BankA`:
167+
168+
```console
169+
$ /usr/local/lpcscrypt/bin/lpcscrypt program +c ~/hubris/support/lpc4322_bl_crc.bin BankA
170+
..
171+
Programmed 57344 bytes to 0x1a000000 in 0.827s (67.717KB/sec)
172+
$
173+
```
174+
175+
5. Assuming it is successful, remove the DFU jumper and disconnect/reconnect USB
176+
177+
6. There should now be a USB mass storage device named `MAINTENANCE`
178+
179+
```console
180+
# fdisk -l
181+
Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
182+
Disk model: Micron 2200S NVMe 512GB
183+
Units: sectors of 1 * 512 = 512 bytes
184+
Sector size (logical/physical): 512 bytes / 512 bytes
185+
I/O size (minimum/optimal): 512 bytes / 512 bytes
186+
Disklabel type: gpt
187+
Disk identifier: A8653F99-39AB-4F67-A9C9-524A2864856E
188+
189+
Device Start End Sectors Size Type
190+
/dev/nvme0n1p1 2048 1050623 1048576 512M EFI System
191+
/dev/nvme0n1p2 1050624 967393279 966342656 460.8G Linux filesystem
192+
/dev/nvme0n1p3 967393280 1000214527 32821248 15.7G Linux swap
193+
194+
195+
Disk /dev/sda: 64.1 MiB, 67174400 bytes, 131200 sectors
196+
Disk model: VFS
197+
Units: sectors of 1 * 512 = 512 bytes
198+
Sector size (logical/physical): 512 bytes / 512 bytes
199+
I/O size (minimum/optimal): 512 bytes / 512 bytes
200+
Disklabel type: dos
201+
Disk identifier: 0x00000000
202+
# mount /dev/sda /mnt
203+
# ls /mnt
204+
DETAILS.TXT PRODINFO.HTM
205+
# cat /mnt/DETAILS.TXT
206+
# DAPLink Firmware - see https://mbed.com/daplink
207+
Unique ID: 02360b000d96e4fc00000000000000000000000097969905
208+
HIC ID: 97969905
209+
Auto Reset: 1
210+
Automation allowed: 1
211+
Overflow detection: 1
212+
Daplink Mode: Interface
213+
Interface Version: 0254
214+
Bootloader Version: 0254
215+
Git SHA: f499eb6ec4a847a2b78831fe1acc856fd8eb2f28
216+
Local Mods: 1
217+
USB Interfaces: MSD, CDC, HID, WebUSB
218+
Bootloader CRC: 0x09974fb3
219+
Interface CRC: 0x7174ab4c
220+
Remount count: 0
221+
URL: https://os.mbed.com/platforms/LPCXpresso55S69/
222+
```
223+
224+
7. Copy `lpc4322_lpc55s69xpresso_if_rla_swo_hacks.bin` to the USB drive
225+
226+
```console
227+
$ sudo cp ~/hubris/support/lpc4322_lpc55s69xpresso_if_rla_swo_hacks.bin /mnt
228+
$
229+
```
230+
231+
8. Unmount (or otherwise sync) the USB drive:
232+
233+
```console
234+
# umount /mnt
235+
#
236+
```
237+
238+
9. Unplug and replug the USB cable.
239+
240+
Verify that you are on the new firmware by running `pyocd list`:
241+
242+
```console
243+
$ pyocd list
244+
# Probe Unique ID
245+
-------------------------------------------------------------------------------------
246+
0 LPCXpresso55S69 [lpc55s69] 02360b000d96e4fc00000000000000000000000097969905
247+
```
248+
249+
Once RickLink is running:
250+
251+
- Terminal 1: `pyocd gdbserver -t lpc55s69`
252+
- Terminal 2: `telnet localhost 4444` (semihosting output)
253+
- Terminal 3: `cargo xtask gdb lpc55/app.toml openocd.gdb`
106254

107255
### ST Nucleo-H743ZI2 board
108256

@@ -147,7 +295,7 @@ build" for this.
147295

148296
For instance, to run a standalone build of `task-ping`, run:
149297

150-
```shell
298+
```console
151299
$ cd task-ping
152300
$ cargo xtask build
153301
```

support/lpc4322_bl_crc.bin

56 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)