This firmware uses nomagic probe. It gives you a command line interface on USB serial port. This allows analysis of unsupported chips.
-
USB CDCD(serial port) gdb server
-
support for SWD according to ARM ADIv5.0, ARM ADIv5.1, ARM ADIv5.2, ARM ADIv6.0.
please refer to the nomagic probe project for most of the documentation.
Additional documentation can be created by doing
make doc
the created documentation is then located in the build/doxygen/ folder.
The firmware can be build using make. The generated Files will be placed in the bin folder. For details try
make help
for this to work you (obviously) need to have make installed. You might need to have additionaltools installed:
-
To build for ARM Cortex-M Targets you need GCC ARM Embedded
-
to flash and program you need OpenOCD or
-
to create an *.uf2 file you need elf2uf2
-
for automatic generated documentation you need Doxygen
Wenn connecting a pico running this firmware to your pc a new serial interface will show up. You can use your favorite terminal programm to open the interface. You can set any boud rate you like as the firmware will ignore the setting.
You need to connect - GPIO 2 (pin 4 on pico) carrying the SWCLK signal and - GPIO 3 (pin 5 on pico) carrying the SWDIO signal as well as - GND
to the MCU you want to analyse. Also see chapter [pico pinout].
If you type help
and hit enter the firmware will respond with a list of all supported commands.
The most interesting one will be swd_test
The "swd_test" command trys different ways of connectiong to a MCU over SWD. Most locations will fail, that is expected. But once it found a working set of options the connected chip will be analyzed.
For RP2040 you will see this:
$ swd_test trying to connect using SWDv1 .... resetting error condition! INFO: request reading ID Register! ERROR: read ap/dp: 0, addr: 0, ack: 7 ERROR: SWD ACK was 7 (target not connected?) ! ERROR: Failed to send packet! Result: -7 swd: error -7 on order connect target: step 3 failed (0xfffffff9) target: error -9 on action connect.3.0 SWDv1: Failed to connect! SWDv2: trying to connect on location 1/16 (target id: 0x01002927).... resetting error condition! INFO: request reading ID Register! INFO: Read ID Register! connected! testing AP 0 Found AP ! APv1: AP: IDR: Revision: 0 AP: IDR: Jep 106 : 4 x 0x7f + 0x3b AP: IDR: class : 8 AP: IDR: variant: 3 AP: IDR: type: 1 AP: CSW : 0x03000052 AP: BASE : 0xe00ff003 AP: ROM Table starts at 0xe00ff000 AP: CFG : 0x00000000 long address supported = 0 large data supported = 0 AP: CFG1 : 0x00000000 do_read_ap(0xe00ff000) System Control Space (SCS): ROM Table[0] : found 0xfff0f003 ROM Table[0] : address 0xe000e000 do_read_ap(0xe00ff004) Data watchpoint unit (DWT): ROM Table[1] : found 0xfff02000 ROM Table[1] : address 0xe0001000 do_read_ap(0xe00ff008) Breakpoint unit (BPU): ROM Table[2] : found 0xfff03000 ROM Table[2] : address 0xe0002000 do_read_ap(0xe00ff00c) do_read_ap(0xe0001000) Device has 2 watchpoints. do_read_ap(0xe0002000) Device has 4 breakpoints. Done with this AP! testing AP 1 AP 1: IDR = 0 Done! SWDv2: trying to connect on location 2/16 (target id: 0x11002927).... resetting error condition! INFO: request reading ID Register! INFO: Read ID Register! connected! testing AP 0 Found AP ! APv1: AP: IDR: Revision: 0 AP: IDR: Jep 106 : 4 x 0x7f + 0x3b AP: IDR: class : 8 AP: IDR: variant: 3 AP: IDR: type: 1 AP: CSW : 0x03000052 AP: BASE : 0xe00ff003 AP: ROM Table starts at 0xe00ff000 AP: CFG : 0x00000000 long address supported = 0 large data supported = 0 AP: CFG1 : 0x00000000 do_read_ap(0xe00ff000) System Control Space (SCS): ROM Table[0] : found 0xfff0f003 ROM Table[0] : address 0xe000e000 do_read_ap(0xe00ff004) Data watchpoint unit (DWT): ROM Table[1] : found 0xfff02000 ROM Table[1] : address 0xe0001000 do_read_ap(0xe00ff008) Breakpoint unit (BPU): ROM Table[2] : found 0xfff03000 ROM Table[2] : address 0xe0002000 do_read_ap(0xe00ff00c) do_read_ap(0xe0001000) Device has 2 watchpoints. do_read_ap(0xe0002000) Device has 4 breakpoints. Done with this AP! testing AP 1 AP 1: IDR = 0 Done!
followd by some more unsucessfull tries.
We fail to connect using SWDv1. But then succeed to connect to both cores using SWDv2.
The pico has 40 pins (1..40) Numbered counter clock wise starting at the USB connector.
+-----+ +-------+ USB +---------+ GPIO 0 -+- 1 +-----+ 40 -+- Vbus GPIO 1 -+- 2 39 -+- Vsys Gnd -+- 3 38 -+- Gnd GPIO 2 -+- 4 37 -+- 3V3_EN GPIO 3 -+- 5 36 -+- 3V3(Out) GPIO 4 -+- 6 35 -+- ADC-Vref GPIO 5 -+- 7 34 -+- GPIO 28 Gnd -+- 8 33 -+- Gnd GPIO 6 -+- 9 32 -+- GPIO 27 GPIO 7 -+- 10 31 -+- GPIO 26 GPIO 8 -+- 11 30 -+- Run = /Reset GPIO 9 -+- 12 29 -+- GPIO 22 Gnd -+- 13 28 -+- Gnd GPIO 10 -+- 14 27 -+- GPIO 21 GPIO 11 -+- 15 26 -+- GPIO 20 GPIO 12 -+- 16 25 -+- GPIO 19 GPIO 13 -+- 17 24 -+- GPIO 18 Gnd -+- 18 23 -+- Gnd GPIO 14 -+- 19 22 -+- GPIO 17 GPIO 15 -+- 20 Debug 21 -+- GPIO 16 +-----------------------+ S G S W n W C d D L I K O
Pin 2: (GPIO 1) SWDIR (High = from Probe to target; Low = from Target to probe)
Pin 4: (GPIO 2) SWCLK
Pin 5: (GPIO 3) SWDIO
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses/