boards: arm: add generic openocd-via-jlink support for nRF5x boards
This support is Zephyr RTOS aware, so you can debug threads as well. Add a CMake fragment which adds openocd support for nrf5 boards which can also be flashed via JLink. This ought to work for nRF51 and nRF52 based boards at time of writing with openocd 0.10.0 or later (zephyr SDK 0.10.3 also worked when I tried for nrf52840_pca10056). Use it from the nRF DKs from Nordic which have interface MCUs with Segger compatible firmware. I'm also including Thingy:52, even though it doesn't, to make it easier when connecting to it via a standalone JLink dongle. The board has a nice connector for that. I'm leaving non-Nordic boards alone for now because I don't know them. It's just one line of CMake to add it for other boards, which should be easy for their maintainers to do. Suggested-by: Radosław Koppel <radoslaw.koppel@nordicsemi.no> Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
0df4a53107
commit
63c6917234
|
@ -4,3 +4,4 @@ board_runner_args(nrfjprog "--nrf-family=NRF51")
|
|||
board_runner_args(jlink "--device=nrf51" "--speed=4000")
|
||||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
|
||||
|
|
|
@ -4,3 +4,4 @@ board_runner_args(nrfjprog "--nrf-family=NRF52")
|
|||
board_runner_args(jlink "--device=nrf52" "--speed=4000")
|
||||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
|
||||
|
|
|
@ -6,3 +6,4 @@ board_runner_args(nrfjprog "--nrf-family=NRF52")
|
|||
board_runner_args(jlink "--device=nrf52" "--speed=4000")
|
||||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
|
||||
|
|
|
@ -6,3 +6,4 @@ board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
|
|||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
|
||||
|
|
|
@ -4,3 +4,4 @@ board_runner_args(nrfjprog "--nrf-family=NRF52")
|
|||
board_runner_args(jlink "--device=nrf52" "--speed=4000")
|
||||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
|
||||
|
|
|
@ -6,3 +6,4 @@ board_runner_args(pyocd "--target=nrf52" "--frequency=4000000")
|
|||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
|
||||
|
|
|
@ -4,3 +4,4 @@ board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
|
|||
board_runner_args(jlink "--device=nrf52" "--speed=4000")
|
||||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Infer nrf51 vs nrf52 etc from the BOARD name. This enforces a board
|
||||
# naming convention: "nrf5x" must appear somewhere in the board name
|
||||
# for this to work.
|
||||
#
|
||||
# Boards which don't meet this convention can set this variable before
|
||||
# including this script.
|
||||
if (NOT DEFINED OPENOCD_NRF5_SUBFAMILY)
|
||||
string(REGEX MATCH nrf5. OPENOCD_NRF5_SUBFAMILY "${BOARD}")
|
||||
endif()
|
||||
if("${OPENOCD_NRF5_SUBFAMILY}" STREQUAL "")
|
||||
message(FATAL_ERROR
|
||||
"Can't match nrf5 subfamily from BOARD name. "
|
||||
"To fix, set CMake variable OPENOCD_NRF5_SUBFAMILY.")
|
||||
endif()
|
||||
|
||||
# We can do the right thing for supported subfamilies using a generic
|
||||
# script, at least for openocd 0.10.0 and the openocd shipped with
|
||||
# Zephyr SDK 0.10.3.
|
||||
set(pre_init_cmds
|
||||
"set WORKAREASIZE 0x4000" # 16 kB RAM used for flashing
|
||||
"source [find interface/jlink.cfg]"
|
||||
"transport select swd"
|
||||
"source [find target/${OPENOCD_NRF5_SUBFAMILY}.cfg]"
|
||||
"$_TARGETNAME configure -rtos auto"
|
||||
)
|
||||
|
||||
foreach(cmd ${pre_init_cmds})
|
||||
board_runner_args(openocd --cmd-pre-init "-c ${cmd}")
|
||||
endforeach()
|
||||
|
||||
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
|
Loading…
Reference in New Issue