Skip to content

Commit 8c893e6

Browse files
soburikartbenajf58
committed
boards: raspberrypi: Aggregate debugging info to rpi_pico docs
Debugging information for RP2040/RP2350 is aggregated into the rpi pico document, making other boards only refer to it. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com> Co-authored-by: Benjamin Cabé <kartben@gmail.com> Co-authored-by: Andrew Featherstone <andrew.featherstone@gmail.com>
1 parent 9c08484 commit 8c893e6

File tree

7 files changed

+90
-373
lines changed

7 files changed

+90
-373
lines changed

boards/kws/pico2_spe/doc/index.rst

+13-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,19 @@ Programming and Debugging
4444

4545
.. zephyr:board-supported-runners::
4646
47-
As with the Pico-SPE, the SWD interface can be used to program and debug the
48-
device, e.g. using OpenOCD with the `Raspberry Pi Debug Probe <https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html>`_ .
47+
As with the Pico-SPE, the SWD interface can be used to program and debug the device,
48+
e.g. using OpenOCD with the `Raspberry Pi Debug Probe <https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html>`_ .
49+
50+
The overall explanation regarding flashing and debugging is the same as for :zephyr:board:`rpi_pico`.
51+
Refer to :ref:`rpi_pico_programming_and_debugging` for more information. N.b. OpenOCD support requires using Raspberry Pi's forked version of OpenOCD.
52+
53+
Below is an example of building and flashing the :zephyr:code-sample:`blinky` application.
54+
55+
.. zephyr-app-commands::
56+
:zephyr-app: samples/basic/blinky
57+
:board: pico2_spe/rp2350a/m33
58+
:goals: build flash
59+
:flash-args: --openocd /usr/local/bin/openocd
4960

5061
References
5162
**********

boards/kws/pico_spe/doc/index.rst

+6-131
Original file line numberDiff line numberDiff line change
@@ -84,144 +84,19 @@ Programming and Debugging
8484

8585
.. zephyr:board-supported-runners::
8686
87-
Flashing
88-
========
87+
The SWD interface can be used to program and debug the device,
88+
e.g. using OpenOCD with the `Raspberry Pi Debug Probe <https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html>`_ .
8989

90-
Using SEGGER JLink
91-
------------------
90+
The overall explanation regarding flashing and debugging is the same as for :zephyr:board:`rpi_pico`.
91+
Refer to :ref:`rpi_pico_programming_and_debugging` for more information. N.b. OpenOCD support requires using Raspberry Pi's forked version of OpenOCD.
9292

93-
You can Flash the pico_spe with a SEGGER JLink debug probe as described in
94-
:ref:`Building, Flashing and Debugging <west-flashing>`.
95-
96-
Here is an example of building and flashing the :zephyr:code-sample:`blinky` application.
97-
98-
.. zephyr-app-commands::
99-
:zephyr-app: samples/basic/blinky
100-
:board: pico_spe
101-
:goals: build
102-
103-
.. code-block:: bash
104-
105-
west flash --runner jlink
106-
107-
Using OpenOCD
108-
-------------
109-
110-
To use CMSIS-DAP, you must configure **udev**.
111-
112-
Create a file in /etc/udev.rules.d with any name, and write the line below.
113-
114-
.. code-block:: bash
115-
116-
ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="000c", MODE="660", GROUP="plugdev", TAG+="uaccess"
117-
118-
This example is valid for the case that the user joins to ``plugdev`` groups.
119-
120-
The Pico-SPE has an SWD interface that can be used to program
121-
and debug the on board RP2040. This interface can be utilized by OpenOCD.
122-
To use it with the RP2040, OpenOCD version 0.12.0 or later is needed.
123-
124-
If you are using a Debian based system (including RaspberryPi OS, Ubuntu. and more),
125-
using the `pico_setup.sh`_ script is a convenient way to set up the forked version of OpenOCD.
126-
127-
Depending on the interface used (such as JLink), you might need to
128-
checkout to a branch that supports this interface, before proceeding.
129-
Build and install OpenOCD as described in the README.
130-
131-
Here is an example of building and flashing the :zephyr:code-sample:`blinky` application.
93+
Below is an example of building and flashing the :zephyr:code-sample:`blinky` application.
13294

13395
.. zephyr-app-commands::
13496
:zephyr-app: samples/basic/blinky
13597
:board: pico_spe
13698
:goals: build flash
137-
:gen-args: -DOPENOCD=/usr/local/bin/openocd -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts -DRPI_PICO_DEBUG_ADAPTER=cmsis-dap
138-
139-
Set the environment variables **OPENOCD** to :file:`/usr/local/bin/openocd`
140-
and **OPENOCD_DEFAULT_PATH** to :file:`/usr/local/share/openocd/scripts`. This should work
141-
with the OpenOCD that was installed with the default configuration.
142-
This configuration also works with an environment that is set up by the `pico_setup.sh`_ script.
143-
144-
**RPI_PICO_DEBUG_ADAPTER** specifies what debug adapter is used for debugging.
145-
146-
If **RPI_PICO_DEBUG_ADAPTER** was not assigned, ``cmsis-dap`` is used by default.
147-
The other supported adapters are ``raspberrypi-swd``, ``jlink`` and ``blackmagicprobe``.
148-
How to connect ``cmsis-dap`` and ``raspberrypi-swd`` is described in `Getting Started with Pico-SPE-Series`_.
149-
Any other SWD debug adapter maybe also work with this configuration.
150-
151-
The value of **RPI_PICO_DEBUG_ADAPTER** is cached, so it can be omitted from
152-
``west flash`` and ``west debug`` if it was previously set while running
153-
``west build``.
154-
155-
**RPI_PICO_DEBUG_ADAPTER** is used in an argument to OpenOCD as ``"source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]"``.
156-
Thus, **RPI_PICO_DEBUG_ADAPTER** needs to be assigned the file name of the debug adapter.
157-
158-
You can also flash the board with the following
159-
command that directly calls OpenOCD (assuming a SEGGER JLink adapter is used):
160-
161-
.. code-block:: console
162-
163-
$ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/rp2040.cfg -c "adapter speed 2000" -c 'targets rp2040.core0' -c 'program path/to/zephyr.elf verify reset exit'
164-
165-
Using UF2
166-
---------
167-
168-
If you don't have an SWD adapter, you can flash the Pico-SPE with
169-
a UF2 file. By default, building an app for this board will generate a
170-
:file:`build/zephyr/zephyr.uf2` file. If the Pico is powered on with the ``BOOTSEL``
171-
button pressed, it will appear on the host as a mass storage device. The
172-
UF2 file should be drag-and-dropped to the device, which will flash the Pico.
173-
174-
Debugging
175-
=========
176-
177-
The SWD interface can also be used to debug the board. To achieve this, you can
178-
either use SEGGER JLink or OpenOCD.
179-
180-
Using SEGGER JLink
181-
------------------
182-
183-
Use a SEGGER JLink debug probe and follow the instruction in
184-
:ref:`Building, Flashing and Debugging<west-debugging>`.
185-
186-
187-
Using OpenOCD
188-
-------------
189-
190-
Install OpenOCD as described for flashing the board.
191-
192-
Here is an example for debugging the :zephyr:code-sample:`blinky` application.
193-
194-
.. zephyr-app-commands::
195-
:zephyr-app: samples/basic/blinky
196-
:board: pico_spe
197-
:maybe-skip-config:
198-
:goals: debug
199-
:gen-args: -DOPENOCD=/usr/local/bin/openocd -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts -DRPI_PICO_DEBUG_ADAPTER=raspberrypi-swd
200-
201-
As with flashing, you can specify the debug adapter by specifying **RPI_PICO_DEBUG_ADAPTER**
202-
at ``west build`` time. No needs to specify it at ``west debug`` time.
203-
204-
You can also debug with OpenOCD and gdb launching from command-line.
205-
Run the following command:
206-
207-
.. code-block:: console
208-
209-
$ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/rp2040.cfg -c "adapter speed 2000" -c 'targets rp2040.core0'
210-
211-
On another terminal, run:
212-
213-
.. code-block:: console
214-
215-
$ gdb-multiarch
216-
217-
Inside gdb, run:
218-
219-
.. code-block:: console
220-
221-
(gdb) tar ext :3333
222-
(gdb) file path/to/zephyr.elf
223-
224-
You can then start debugging the board.
99+
:flash-args: --openocd /usr/local/bin/openocd
225100

226101
.. target-notes::
227102

boards/pimoroni/pico_plus2/doc/index.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,16 @@ Programming and Debugging
4242

4343
.. zephyr:board-supported-runners::
4444
45-
The overall explanation regarding flashing and debugging is the same as or ``rpi_pico``.
46-
See :ref:`rpi_pico_flashing_using_openocd` and :ref:`rpi_pico_flashing_using_uf2`
47-
in ``rpi_pico`` documentation.
45+
The overall explanation regarding flashing and debugging is the same as or :zephyr:board:`rpi_pico`.
46+
See :ref:`rpi_pico_programming_and_debugging` in :zephyr:board:`rpi_pico` documentation. N.b. OpenOCD support requires using Raspberry Pi's forked version of OpenOCD.
47+
48+
Below is an example of building and flashing the :zephyr:code-sample:`blinky` application.
4849

4950
.. zephyr-app-commands::
5051
:zephyr-app: samples/basic/blinky
51-
:board: pico_plus2
52+
:board: pico_plus2/rp2350b/m33
5253
:goals: build flash
53-
:gen-args: -DOPENOCD=/usr/local/bin/openocd
54+
:flash-args: --openocd /usr/local/bin/openocd
5455

5556
.. target-notes::
5657

boards/raspberrypi/rpi_pico/doc/index.rst

+46-50
Original file line numberDiff line numberDiff line change
@@ -130,20 +130,11 @@ Raspberry Pi Pico's PIO is a programmable chip that can implement a variety of p
130130
- :kconfig:option:`CONFIG_LED_STRIP`
131131
- :dtcompatible:`worldsemi,ws2812-rpi_pico-pio`
132132

133-
Programming and Debugging
134-
*************************
135-
136-
.. zephyr:board-supported-runners::
137-
138-
Applications for the ``rpi_pico`` board configuration can be built and
139-
flashed in the usual way (see :ref:`build_an_application` and
140-
:ref:`application_run` for more details).
141-
142133
System requirements
143-
===================
134+
*******************
144135

145136
Prerequisites for the Pico W
146-
----------------------------
137+
============================
147138

148139
Building for the Raspberry Pi Pico W requires the AIROC binary blobs
149140
provided by Infineon. Run the command below to retrieve those files:
@@ -156,47 +147,30 @@ provided by Infineon. Run the command below to retrieve those files:
156147

157148
It is recommended running the command above after :file:`west update`.
158149

159-
Debug Probe and Host Tools
160-
--------------------------
150+
.. _rpi_pico_programming_and_debugging:
151+
152+
Programming and Debugging
153+
*************************
154+
155+
.. zephyr:board-supported-runners::
156+
157+
Applications for the ``rpi_pico`` board configuration can be built and
158+
flashed in the usual way (see :ref:`build_an_application` and
159+
:ref:`application_run` for more details).
161160

162161
Several debugging tools support the Raspberry Pi Pico.
163162
The `Raspberry Pi Debug Probe`_ is an easy-to-obtain CMSIS-DAP adapter
164163
officially provided by the Raspberry Pi Foundation,
165164
making it a convenient choice for debugging ``rpi_pico``.
165+
It can be used with ``openocd`` or ``pyocd``.
166166

167-
It can be used with
168-
169-
- :ref:`openocd-debug-host-tools`
170-
- :ref:`pyocd-debug-host-tools`
171-
172-
OpenOCD is the default for ``rpi_pico``.
173-
174-
- `SEGGER J-Link`_
175-
- `Black Magic Debug Probe <Black Magic Debug>`_
176-
177-
can also be used.
178-
These are used with dedicated probes.
179167

180168
Flashing
181169
========
182170

183171
The ``rpi_pico`` can flash with Zephyr's standard method.
184172
See also :ref:`Building, Flashing and Debugging<west-flashing>`.
185173

186-
Here is an example of building and flashing the :zephyr:code-sample:`blinky` application.
187-
188-
.. zephyr-app-commands::
189-
:zephyr-app: samples/basic/blinky
190-
:board: rpi_pico
191-
:goals: build
192-
193-
.. code-block:: console
194-
195-
west flash --runner jlink
196-
197-
198-
.. _rpi_pico_flashing_using_openocd:
199-
200174
Using OpenOCD
201175
-------------
202176

@@ -216,13 +190,14 @@ Here is an example of building and flashing the :zephyr:code-sample:`blinky` app
216190
:zephyr-app: samples/basic/blinky
217191
:board: rpi_pico
218192
:goals: build flash
219-
:gen-args: -DOPENOCD=/usr/local/bin/openocd -DRPI_PICO_DEBUG_ADAPTER=cmsis-dap
193+
:gen-args: -DRPI_PICO_DEBUG_ADAPTER=cmsis-dap
194+
:flash-args: --openocd /usr/local/bin/openocd
220195

221-
Set the CMake option **OPENOCD** to :file:`/usr/local/bin/openocd`. This should work
196+
Set the flash runner option **--openocd** to :file:`/usr/local/bin/openocd`. This should work
222197
with the OpenOCD that was installed with the default configuration.
223198
This configuration also works with an environment that is set up by the `pico_setup.sh`_ script.
224199

225-
**RPI_PICO_DEBUG_ADAPTER** specifies what debug adapter is used for debugging.
200+
In this sample, **RPI_PICO_DEBUG_ADAPTER** specifies which debug adapter is used for debugging.
226201

227202
If **RPI_PICO_DEBUG_ADAPTER** was not set, ``cmsis-dap`` is used by default.
228203
The ``raspberrypi-swd`` and ``jlink`` are verified to work.
@@ -236,16 +211,40 @@ The value of **RPI_PICO_DEBUG_ADAPTER** is cached, so it can be omitted from
236211
**RPI_PICO_DEBUG_ADAPTER** is used in an argument to OpenOCD as ``"source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]"``.
237212
Thus, **RPI_PICO_DEBUG_ADAPTER** needs to be assigned the file name of the debug adapter.
238213

239-
.. _rpi_pico_flashing_using_uf2:
214+
215+
Using JLink or other supported tools
216+
------------------------------------
217+
218+
You can Flash with a `SEGGER J-Link`_ debug probe as described in
219+
:ref:`Building, Flashing and Debugging <west-flashing>`.
220+
221+
Here is an example of building and flashing the :zephyr:code-sample:`blinky` application.
222+
223+
.. zephyr-app-commands::
224+
:zephyr-app: samples/basic/blinky
225+
:board: rpi_pico
226+
:goals: build flash
227+
:flash-args: --runner jlink
228+
229+
You can also use other supported tools, such as `Black Magic Probe`_,
230+
by changing the ``-- runner`` option.
231+
240232

241233
Using UF2
242234
---------
243235

244236
If you don't have an SWD adapter, you can flash the Raspberry Pi Pico with
245237
a UF2 file. By default, building an app for this board will generate a
246238
:file:`build/zephyr/zephyr.uf2` file. If the Pico is powered on with the ``BOOTSEL``
247-
button pressed, it will appear on the host as a mass storage device. The
248-
UF2 file should be drag-and-dropped to the device, which will flash the Pico.
239+
button pressed, it will appear on the host as a mass storage device.
240+
Run the following command, or drag-and-drop the uf2 file to the device,
241+
which will flash the Pico.
242+
243+
.. zephyr-app-commands::
244+
:zephyr-app: samples/basic/blinky
245+
:board: rpi_pico
246+
:goals: flash
247+
:flash-args: --runner uf2
249248

250249
Debugging
251250
=========
@@ -260,15 +259,12 @@ the `Raspberry Pi Debug Probe`_.
260259
:board: rpi_pico
261260
:maybe-skip-config:
262261
:goals: debug
263-
:gen-args: -DOPENOCD=/usr/local/bin/openocd -DRPI_PICO_DEBUG_ADAPTER=cmsis-dap
262+
:debug-args: --openocd /usr/local/bin/openocd
264263

265264
The default debugging tool is ``openocd``.
266265
If you use a different tool, specify it with the ``--runner``,
267266
such as ``jlink``.
268267

269-
If you use OpenOCD, see also the description about flashing :ref:`rpi_pico_flashing_using_uf2`
270-
for more information.
271-
272268

273269
.. target-notes::
274270

@@ -293,5 +289,5 @@ for more information.
293289
.. _SEGGER J-Link:
294290
https://www.segger.com/products/debug-probes/j-link/
295291

296-
.. _Black Magic Debug:
292+
.. _Black Magic Probe:
297293
https://black-magic.org/

boards/raspberrypi/rpi_pico2/doc/index.rst

+10-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,16 @@ Programming and Debugging
4242

4343
.. zephyr:board-supported-runners::
4444
45-
As with the Pico 1, the SWD interface can be used to program and debug the
46-
device, e.g. using OpenOCD with the `Raspberry Pi Debug Probe <https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html>`_ .
45+
The overall explanation regarding flashing and debugging is the same as or :zephyr:board:`rpi_pico`.
46+
See :ref:`rpi_pico_programming_and_debugging` in :zephyr:board:`rpi_pico` documentation. N.b. OpenOCD support requires using Raspberry Pi's forked version of OpenOCD.
47+
48+
Below is an example of building and flashing the :zephyr:code-sample:`blinky` application.
49+
50+
.. zephyr-app-commands::
51+
:zephyr-app: samples/basic/blinky
52+
:board: rpi_pico2/rp2350a/m33
53+
:goals: build flash
54+
:flash-args: --openocd /usr/local/bin/openocd
4755

4856
References
4957
**********

0 commit comments

Comments
 (0)