Skip to content

Commit d835c1b

Browse files
mt-gjoergescarlescufi
authored andcommitted
boards: arm: rpi_pico: add jlink runner conf
Add jlink configuration. Signed-off-by: Gerhard Jörges <[email protected]>
1 parent 6cc8b57 commit d835c1b

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

boards/arm/rpi_pico/board.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,7 @@ board_runner_args(openocd --cmd-pre-init "source [find target/rp2040.cfg]")
2525
# But if not so, set 2000 to adapter speed.
2626
board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 2000")
2727

28+
board_runner_args(jlink "--device=RP2040_M0_0")
29+
2830
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
31+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

boards/arm/rpi_pico/doc/index.rst

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,25 @@ Programming and Debugging
8282
Flashing
8383
========
8484

85-
Using an SWD adapter
86-
--------------------
85+
Using SEGGER JLink
86+
------------------
87+
88+
You can Flash the rpi_pico with a SEGGER JLink debug probe as described in
89+
:ref:`Building, Flashing and Debugging <west-flashing>`.
90+
91+
Here is an example of building and flashing the :ref:`blinky-sample` application.
92+
93+
.. zephyr-app-commands::
94+
:zephyr-app: samples/basic/blinky
95+
:board: rpi_pico
96+
:goals: build
97+
98+
.. code-block:: bash
99+
100+
west flash --runner jlink
101+
102+
Using OpenOCD
103+
-------------
87104

88105
To use PicoProbe, You must configure **udev**.
89106

@@ -96,15 +113,15 @@ Create a file in /etc/udev.rules.d with any name, and write the line below.
96113
This example is valid for the case that the user joins to `plugdev` groups.
97114

98115
The Raspberry Pi Pico has an SWD interface that can be used to program
99-
and debug the on board RP2040. This interface can be utilized by openocd.
116+
and debug the on board RP2040. This interface can be utilized by OpenOCD.
100117
However, to use it with the RP2040, `fork of OpenOCD supporting RP2040`_ is needed.
101118

102119
If you are using Debian based system (including RaspberryPi OS, Ubuntu. and more),
103120
using `pico_setup.sh`_ script is convenient to set up forked version of OpenOCD.
104121

105122
Depending on the interface used (such as JLink), you might need to
106123
checkout to a branch that supports this interface, before proceeding.
107-
Build and install openocd as described in the README.
124+
Build and install OpenOCD as described in the README.
108125

109126
Here is an example of building and flashing the :ref:`blinky-sample` application.
110127

@@ -115,7 +132,7 @@ Here is an example of building and flashing the :ref:`blinky-sample` application
115132
:gen-args: -DOPENOCD=/usr/local/bin/openocd -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts -DRPI_PICO_DEBUG_ADAPTER=picoprobe
116133

117134
Set `/usr/local/bin/openocd` to **OPENOCD** and `/usr/local/share/openocd/scripts` to **OPENOCD_DEFAULT_PATH** will works
118-
with openocd that install with default configuration.
135+
with OpenOCD that install with default configuration.
119136
This configuration also works with an environment that is set up by `pico_setup.sh`_ script.
120137

121138
**RPI_PICO_DEBUG_ADAPTER** specifies what debug adapter is used for debugging.
@@ -128,11 +145,11 @@ Any other SWD debug adapter maybe also work with this configuration.
128145
So you can omit the option in `west flash` and `west debug` execution,
129146
you need only the `west build` case.
130147

131-
**RPI_PICO_DEBUG_ADAPTER** is used in an argument to openocd as `"source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]"`.
148+
**RPI_PICO_DEBUG_ADAPTER** is used in an argument to OpenOCD as `"source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]"`.
132149
Thus, **RPI_PICO_DEBUG_ADAPTER** needs to assign from the definition file name of debugging adapter.
133150

134151
You can also flash the board with the following
135-
command that directly call openocd (assuming JLink is used):
152+
command that directly call OpenOCD (assuming a SEGGER JLink adapter is used):
136153

137154
.. code-block:: console
138155
@@ -150,8 +167,20 @@ UF2 file should be drag-and-dropped to the device, which will flash the Pico.
150167
Debugging
151168
=========
152169

153-
The SWD interface can also be used to debug the board. To achieve this,
154-
install openocd as described for flashing the board.
170+
The SWD interface can also be used to debug the board. To achieve this, you can
171+
either user SEGGER JLink or OpenOCD.
172+
173+
Using SEGGER JLink
174+
------------------
175+
176+
Use a SEGGER JLink debug probe and follow the instruction in
177+
:ref:`Building, Flashing and Debugging<west-debugging>`.
178+
179+
180+
Using OpenOCD
181+
-------------
182+
183+
Install OpenOCD as described for flashing the board.
155184

156185
.. note::
157186
`fork of OpenOCD supporting RP2040`_ does not provide ZephyrRTOS enhancement.
@@ -169,7 +198,7 @@ Here is an example for debugging the :ref:`blinky-sample` application.
169198
As with flashing, you can specify the debug adapter by specifying **RPI_PICO_DEBUG_ADAPTER**
170199
at `west build` time. No needs to specify it at `west debug` time.
171200

172-
You can also debugging with openocd and gdb launching from command-line.
201+
You can also debugging with OpenOCD and gdb launching from command-line.
173202
Run the following command:
174203

175204
.. code-block:: console

0 commit comments

Comments
 (0)