1# SPDX-License-Identifier: Apache-2.0 2 3# This configuration allows selecting what debug adapter debugging rpi_pico 4# 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# Set RPI_PICO_DEBUG_ADAPTER to select debug adapter by command-line arguments. 10# e.g.) west build -b rpi_pico -- -DRPI_PICO_DEBUG_ADAPTER=raspberrypi-swd 11# The value is treated as a part of an interface file name that 12# the debugger's configuration file. 13# The value must be the 'stem' part of the name of one of the files 14# in the openocd interface configuration file. 15# The setting is store to CMakeCache.txt. 16if("${RPI_PICO_DEBUG_ADAPTER}" STREQUAL "") 17 set(RPI_PICO_DEBUG_ADAPTER "cmsis-dap") 18endif() 19 20board_runner_args(openocd --cmd-pre-init "source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]") 21board_runner_args(openocd --cmd-pre-init "transport select swd") 22board_runner_args(openocd --cmd-pre-init "source [find target/rp2040.cfg]") 23 24# The adapter speed is expected to be set by interface configuration. 25# But if not so, set 2000 to adapter speed. 26board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 2000") 27 28board_runner_args(jlink "--device=RP2040_M0_0") 29board_runner_args(uf2 "--board-id=RPI-RP2") 30board_runner_args(pyocd "--target=rp2040") 31 32include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) 33include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) 34include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake) 35include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) 36include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) 37