zephyr/boards/common/openocd-nrf5.board.cmake
Anas Nashif c724033acc west: prepend -c to openocd commands
commit 0df4a53107 changed the behavior of
how openocd commands are passed to openocd. We used to add -c to each
command, now the commands are being added without -c causing an error.

This adds "-c" to all commands instead of just passing a list.

Also fixes #20449.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2019-11-12 14:37:34 -05:00

34 lines
1.1 KiB
CMake

# 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 "${cmd}")
endforeach()
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)