1# SPDX-License-Identifier: Apache-2.0
2
3# This configuration allows selecting what debug adapter debugging to use
4# for the SparkFun Pro Micro RP2040 by a command-line argument.
5# It is mainly intended to support both the 'picoprobe' and 'raspberrypi-swd'
6# adapter described in "Getting started with Raspberry Pi Pico".
7# And any other SWD debug adapter might also be usable with this configuration.
8
9# Note that the Pro Micro RP2040 SWD pins are test points on the underside
10# of the board.
11
12# Set RPI_PICO_DEBUG_ADAPTER to select debug adapter by command-line arguments.
13# e.g.) west build -b rpi_pico -- -DRPI_PICO_DEBUG_ADAPTER=raspberrypi-swd
14# The value is treated as a part of an interface file name that
15# the debugger's configuration file.
16# The value must be the 'stem' part of the name of one of the files
17# in the openocd interface configuration file.
18# The setting is store to CMakeCache.txt.
19if("${RPI_PICO_DEBUG_ADAPTER}" STREQUAL "")
20	set(RPI_PICO_DEBUG_ADAPTER "cmsis-dap")
21endif()
22
23board_runner_args(openocd --cmd-pre-init "source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]")
24board_runner_args(openocd --cmd-pre-init "transport select swd")
25board_runner_args(openocd --cmd-pre-init "source [find target/rp2040.cfg]")
26
27# The adapter speed is expected to be set by interface configuration.
28# But if not so, set 2000 to adapter speed.
29board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 2000")
30
31board_runner_args(jlink "--device=RP2040_M0_0")
32board_runner_args(uf2 "--board-id=RPI-RP2")
33board_runner_args(pyocd "--target=rp2040")
34
35include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
36include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
37include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
38include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)
39include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
40