Skip to content

Commit

Permalink
boards: raspberrypi: rpi_pico2: add OpenOCD runner configuration
Browse files Browse the repository at this point in the history
Add OpenOCD debugger support.
For now we will need a RaspberryPi forked version of OpenOCD.

https://github.com/raspberrypi/openocd

Signed-off-by: TOKITA Hiroshi <[email protected]>
Signed-off-by: Andrew Featherstone <[email protected]>
  • Loading branch information
ajf58 committed Sep 30, 2024
1 parent 381e8e2 commit 045ed4a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
15 changes: 14 additions & 1 deletion boards/raspberrypi/rpi_pico2/board.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# SPDX-License-Identifier: Apache-2.0

if ("${RPI_PICO_DEBUG_ADAPTER}" STREQUAL "")
set(RPI_PICO_DEBUG_ADAPTER "cmsis-dap")
endif()

board_runner_args(openocd --cmd-pre-init "source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]")
board_runner_args(openocd --cmd-pre-init "transport select swd")
board_runner_args(openocd --cmd-pre-init "source [find target/rp2350.cfg]")

# The adapter speed is expected to be set by interface configuration.
# But if not so, set 2000 to adapter speed.
board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 2000")

board_runner_args(uf2 "--board-id=RP2350")

include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
1 change: 1 addition & 0 deletions boards/raspberrypi/rpi_pico2/rpi_pico2_defconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_CLOCK_CONTROL=y
CONFIG_CONSOLE=y
Expand Down
11 changes: 11 additions & 0 deletions boards/raspberrypi/rpi_pico2/support/openocd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2024 TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0

# Checking and set 'adapter speed'.
# Set the adaptor speed, if unset, and given as an argument.
proc set_adapter_speed_if_not_set { speed } {
puts "checking adapter speed..."
if { [catch {adapter speed} ret] } {
adapter speed $speed
}
}

0 comments on commit 045ed4a

Please sign in to comment.