Skip to content

Commit 416e209

Browse files
authored
Merge pull request #4109 from P33M/openocd_rationalise
Rationalise debugprobe setup
2 parents 2ab8f45 + 915f45f commit 416e209

File tree

2 files changed

+17
-72
lines changed

2 files changed

+17
-72
lines changed
Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,12 @@
11
== Install tools
22

3-
To use the Debug Probe, install the following tools.
3+
To use the Debug Probe, OpenOCD and the GNU Project Debugger (GDB) are required. An Integrated Development Environment (IDE) may also be useful.
44

5-
=== Install OpenOCD
5+
On Raspberry Pi OS, most Linux variants, macOS, and Microsoft Windows, it is recommended to install our VS Code extension. This extension bundles OpenOCD, ARM toolchains, GDB, and register definitions for Pico-series microcontrollers.
66

7-
You need to install OpenOCD.
7+
See Chapter 3 of our https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf[Getting Started with Raspberry Pi Pico] guide.
88

9-
To install OpenOCD, run the following command in a terminal:
9+
Alternatively, tools can be manually installed by following Appendix C in the guide.
1010

11-
[source,console]
12-
----
13-
$ sudo apt install openocd
14-
----
11+
NOTE: Manual installation of the tools on Windows is not recommended.
1512

16-
To run OpenOCD, use the `openocd` command in your terminal.
17-
18-
==== Install OpenOCD on macOS
19-
20-
First, install the https://brew.sh/[Homebrew] package manager:
21-
22-
[source,console]
23-
----
24-
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
25-
----
26-
27-
To install OpenOCD on macOS, run the following commands:
28-
29-
[source,console]
30-
----
31-
$ brew install openocd
32-
----
33-
34-
To run OpenOCD, use the `openocd` command in your terminal.
35-
36-
=== Install GDB
37-
38-
We also need to install the GNU debugger (GDB).
39-
40-
==== Linux
41-
42-
Install `gdb-multiarch`:
43-
44-
[source,console]
45-
----
46-
$ sudo apt install gdb-multiarch
47-
----
48-
49-
==== macOS
50-
51-
Run the following command to install `gdb`:
52-
53-
[source,console]
54-
----
55-
$ brew install arm-none-eabi-gdb
56-
----
57-
58-
You can safely ignore the request for "special privileges" messages on installation.
59-
60-
==== MS Windows
61-
62-
GDB is available as part of our https://github.com/raspberrypi/pico-setup-windows/releases/latest[Pico setup for Windows installer]. It is also included in the https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads[Arm GNU Toolchain Downloads].
63-
64-
Alternatively information about manual installation can be found in Chapter 9 and Appendix A of our https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf[Getting Started with Raspberry Pi Pico] book.
65-
66-
NOTE: Manual installation of GDB on Windows is not recommended.

documentation/asciidoc/microcontrollers/debug-probe/swd-connection.adoc

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
== Serial Wire Debug (SWD)
1+
== Starting a Debug Session
22

3-
Serial Wire Debug (SWD) is a two-pin interface (https://developer.arm.com/documentation/101761/1-0/Debug-and-trace-interface/Serial-Wire-Debug-signals[SWDIO and SWCLK]) alternative to the JTAG four- or five-pin debugging interface standard.
3+
The Debug Probe will let you load binaries via the SWD port and OpenOCD: you will not need to unplug, and then push-and-hold, the BOOTSEL button every time you push a new binary to your Pico. Using the Debug Probe to upload new binaries is an entirely hands-off affair.
44

5-
=== Uploading new programs to your Pico
5+
GDB is then used to debug the binary running on the Pico.
66

7-
The Pico Debug Probe will let you load binaries via the SWD port and OpenOCD: you will not need to unplug, and then push-and-hold, the BOOTSEL button every time you push a new binary to your Pico. Using the Debug Probe uploading new binaries is an entirely hands off affair.
7+
We recommend the use of the Raspberry Pi Pico VSCode extension, which integrates the use of OpenOCD and GDB, to upload and debug programs. See Chapter 4 of https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf[Getting started with Raspberry Pi Pico] for more information.
8+
9+
=== Standalone program upload
810

911
Once you have built a binary:
1012

@@ -15,9 +17,9 @@ $ sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed
1517

1618
NOTE: When you use the Debug Probe to upload a binary the ELF version of the file is used, not the UF2 file that you would use when you drag-and-drop.
1719

18-
=== Debugging with SWD
20+
=== Standalone debug session
1921

20-
It'll also let you use `openocd` in server mode, and connect GDB, which gives you break points and "proper" debugging.
22+
This will use `openocd` in server mode, and connect GDB, which gives you breakpoints and single-step over a console interface.
2123

2224
[IMPORTANT]
2325
======
@@ -35,10 +37,12 @@ $ make -j4
3537
----
3638
3739
In a debug build you will get more information when you run it under the debugger, as the compiler builds your program with the information to tell GDB what your program is doing.
38-
39-
See Chapter 6 of https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf[Getting started with Raspberry Pi Pico] for more information.
4040
======
4141

42+
NOTE: For computers that are _not_ Raspberry Pis, a variant of GDB that can debug ARM processors is required. Use one of the following alternatives depending on your operating system and device:
43+
* On Linux devices, use `gdb-multiarch`.
44+
* On macOS and Windows devices, use `arm-none-eabi-gdb` from the toolchain on https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads[Arm's website]
45+
4246
To start an OpenOCD server, run the following command:
4347

4448
[source,console]
@@ -55,8 +59,3 @@ $ gdb blink.elf
5559
> monitor reset init
5660
> continue
5761
----
58-
59-
GDB doesn't work on all platforms. Use one of the following alternatives instead of `gdb`, depending on your operating system and device:
60-
61-
* On Linux devices that are _not_ Raspberry Pis, use `gdb-multiarch`.
62-
* On macOS devices, use `arm-none-eabi-gdb`.

0 commit comments

Comments
 (0)