Skip to content

Commit dae7787

Browse files
ajf58kartben
authored andcommitted
boards: raspberrypi: rpi_pico2: Add OpenOCD runner configuration
Add OpenOCD debugger support. For now we will need Raspberry Pi'a forked version of OpenOCD from https://github.com/raspberrypi/openocd . The default adapter speed is set to match Raspberry Pi's documentation. Signed-off-by: Andrew Featherstone <[email protected]>
1 parent 8bea756 commit dae7787

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed
+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
if("${RPI_PICO_DEBUG_ADAPTER}" STREQUAL "")
4+
set(RPI_PICO_DEBUG_ADAPTER "cmsis-dap")
5+
endif()
6+
7+
board_runner_args(openocd --cmd-pre-init "source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]")
8+
board_runner_args(openocd --cmd-pre-init "source [find target/rp2350.cfg]")
9+
10+
# The adapter speed is expected to be set by interface configuration.
11+
# The Raspberry Pi's OpenOCD fork doesn't, so match their documentation at
12+
# https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html#debugging-with-swd
13+
board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 5000")
14+
315
board_runner_args(uf2 "--board-id=RP2350")
416

5-
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
17+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
18+
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)

boards/raspberrypi/rpi_pico2/rpi_pico2_rp2350a_m33_defconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This configuration is orthogonal to whether the Cortex-M33 or Hazard3 cores
22
# are in use, but Zephyr does not support providing a qualifier-agnostic
33
# _defconfig file.
4+
CONFIG_BUILD_OUTPUT_HEX=y
45
CONFIG_BUILD_OUTPUT_UF2=y
56
CONFIG_CLOCK_CONTROL=y
67
CONFIG_CONSOLE=y
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2024 TOKITA Hiroshi
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Checking and set 'adapter speed'.
5+
# Set the adaptor speed, if unset, and given as an argument.
6+
proc set_adapter_speed_if_not_set { speed } {
7+
puts "checking adapter speed..."
8+
if { [catch {adapter speed} ret] } {
9+
adapter speed $speed
10+
}
11+
}

0 commit comments

Comments
 (0)