Skip to content
Permalink
Browse files

cmake: add helpers for setting board runners

This helps by letting us add checks for when the runner has already
been set. There is documentation saying you can set
-DBOARD_DEBUG_RUNNER at the command line and have it take effect,
which turns out not to be true for a large number of boards.
A status message helps the user debug.

(We'll address the existing in-tree boards in the next patch.)

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
  • Loading branch information...
mbolivar authored and carlescufi committed May 31, 2019
1 parent 9f851cc commit 1717332c7af5f3c096d5f75d33f4b4cf96b28345
Showing with 148 additions and 88 deletions.
  1. +3 −3 boards/arc/arduino_101_sss/board.cmake
  2. +2 −2 boards/arc/em_starterkit/board.cmake
  3. +2 −2 boards/arc/iotdk/board.cmake
  4. +2 −2 boards/arc/nsim/board.cmake
  5. +4 −4 boards/arm/frdm_k64f/board.cmake
  6. +4 −4 boards/arm/frdm_kl25z/board.cmake
  7. +4 −4 boards/arm/frdm_kw41z/board.cmake
  8. +4 −4 boards/arm/hexiwear_k64/board.cmake
  9. +4 −4 boards/arm/hexiwear_kw40z/board.cmake
  10. +2 −2 boards/arm/lpcxpresso54114/board.cmake
  11. +2 −2 boards/arm/lpcxpresso55s69/board.cmake
  12. +2 −2 boards/arm/mimxrt1015_evk/board.cmake
  13. +4 −4 boards/arm/mimxrt1020_evk/board.cmake
  14. +4 −4 boards/arm/mimxrt1050_evk/board.cmake
  15. +4 −4 boards/arm/mimxrt1060_evk/board.cmake
  16. +4 −4 boards/arm/mimxrt1064_evk/board.cmake
  17. +1 −1 boards/arm/mps2_an385/board.cmake
  18. +2 −2 boards/arm/nrf52_sparkfun/board.cmake
  19. +1 −1 boards/arm/qemu_cortex_m3/board.cmake
  20. +4 −4 boards/arm/twr_ke18f/board.cmake
  21. +1 −1 boards/arm/v2m_beetle/board.cmake
  22. +2 −2 boards/common/blackmagicprobe.board.cmake
  23. +1 −1 boards/common/bossac.board.cmake
  24. +1 −1 boards/common/dfu-util.board.cmake
  25. +1 −1 boards/common/esp32.board.cmake
  26. +2 −2 boards/common/jlink.board.cmake
  27. +2 −2 boards/common/nios2.board.cmake
  28. +1 −1 boards/common/nrfjprog.board.cmake
  29. +2 −2 boards/common/openocd.board.cmake
  30. +2 −2 boards/common/pyocd.board.cmake
  31. +1 −1 boards/nios2/qemu_nios2/board.cmake
  32. +2 −2 boards/riscv32/hifive1/board.cmake
  33. +1 −1 boards/riscv32/qemu_riscv32/board.cmake
  34. +2 −2 boards/x86/arduino_101/board.cmake
  35. +1 −1 boards/x86/qemu_x86/board.cmake
  36. +2 −2 boards/x86/tinytile/board.cmake
  37. +1 −1 boards/x86/x86_jailhouse/board.cmake
  38. +2 −2 boards/xtensa/intel_s1000_crb/board.cmake
  39. +1 −1 boards/xtensa/qemu_xtensa/board.cmake
  40. +1 −1 boards/xtensa/xt-sim/board.cmake
  41. +60 −0 cmake/extensions.cmake
@@ -1,12 +1,12 @@
# SPDX-License-Identifier: Apache-2.0

if(DEFINED ENV{ZEPHYR_FLASH_OVER_DFU})
set(BOARD_FLASH_RUNNER dfu-util)
board_set_flasher(dfu-util)
else()
set(BOARD_FLASH_RUNNER openocd)
board_set_flasher(openocd)
endif()

set(BOARD_DEBUG_RUNNER openocd)
board_set_debugger(openocd)

board_runner_args(dfu-util "--pid=8087:0aba" "--alt=sensor_core")
board_runner_args(openocd --cmd-pre-load "targets 1" "--gdb-port=3334")
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

# TODO: can this board just use the usual openocd runner?
set(BOARD_FLASH_RUNNER em-starterkit)
set(BOARD_DEBUG_RUNNER em-starterkit)
board_set_flasher(em-starterkit)
board_set_debugger(em-starterkit)
board_finalize_runner_args(em-starterkit)
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

# TODO: can this board just use the usual openocd runner?
set(BOARD_FLASH_RUNNER em-starterkit)
set(BOARD_DEBUG_RUNNER em-starterkit)
board_set_flasher(em-starterkit)
board_set_debugger(em-starterkit)
board_finalize_runner_args(em-starterkit)
@@ -2,8 +2,8 @@

set(EMU_PLATFORM nsim)

set(BOARD_FLASH_RUNNER arc-nsim)
set(BOARD_DEBUG_RUNNER arc-nsim)
board_set_flasher(arc-nsim)
board_set_debugger(arc-nsim)

if(${CONFIG_SOC_NSIM_EM})
board_runner_args(arc-nsim "--props=nsim_em.props")
@@ -3,11 +3,11 @@
set_ifndef(OPENSDA_FW daplink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
elseif(OPENSDA_FW STREQUAL daplink)
set_ifndef(BOARD_DEBUG_RUNNER pyocd)
set_ifndef(BOARD_FLASH_RUNNER pyocd)
board_set_debugger_ifnset(pyocd)
board_set_flasher_ifnset(pyocd)
endif()

board_runner_args(jlink "--device=MK64FN1M0xxx12")
@@ -3,11 +3,11 @@
set_ifndef(OPENSDA_FW daplink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
elseif(OPENSDA_FW STREQUAL daplink)
set_ifndef(BOARD_DEBUG_RUNNER pyocd)
set_ifndef(BOARD_FLASH_RUNNER pyocd)
board_set_debugger_ifnset(pyocd)
board_set_flasher_ifnset(pyocd)
endif()

board_runner_args(jlink "--device=MKL25Z128xxx4")
@@ -3,11 +3,11 @@
set_ifndef(OPENSDA_FW daplink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
elseif(OPENSDA_FW STREQUAL daplink)
set_ifndef(BOARD_DEBUG_RUNNER pyocd)
set_ifndef(BOARD_FLASH_RUNNER pyocd)
board_set_debugger_ifnset(pyocd)
board_set_flasher_ifnset(pyocd)
endif()

board_runner_args(jlink "--device=MKW41Z512xxx4")
@@ -3,11 +3,11 @@
set_ifndef(OPENSDA_FW jlink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
elseif(OPENSDA_FW STREQUAL daplink)
set_ifndef(BOARD_DEBUG_RUNNER pyocd)
set_ifndef(BOARD_FLASH_RUNNER pyocd)
board_set_debugger_ifnset(pyocd)
board_set_flasher_ifnset(pyocd)
endif()

board_runner_args(pyocd "--target=k64f")
@@ -3,11 +3,11 @@
set_ifndef(OPENSDA_FW jlink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
elseif(OPENSDA_FW STREQUAL daplink)
set_ifndef(BOARD_DEBUG_RUNNER pyocd)
set_ifndef(BOARD_FLASH_RUNNER pyocd)
board_set_debugger_ifnset(pyocd)
board_set_flasher_ifnset(pyocd)
endif()

board_runner_args(jlink "--device=MKW40Z160xxx4")
@@ -7,8 +7,8 @@
set_ifndef(LPCLINK_FW jlink)

if(LPCLINK_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
endif()

if(CONFIG_BOARD_LPCXPRESSO54114_M4)
@@ -11,8 +11,8 @@
set_ifndef(OPENSDA_FW jlink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
endif()

if(CONFIG_BOARD_LPCXPRESSO55S69_CPU0)
@@ -6,8 +6,8 @@
set_ifndef(OPENSDA_FW jlink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
endif()

board_runner_args(jlink "--device=MIMXRT1015")
@@ -7,11 +7,11 @@
set_ifndef(OPENSDA_FW jlink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
elseif(OPENSDA_FW STREQUAL daplink)
set_ifndef(BOARD_DEBUG_RUNNER pyocd)
set_ifndef(BOARD_FLASH_RUNNER pyocd)
board_set_debugger_ifnset(pyocd)
board_set_flasher_ifnset(pyocd)
endif()

board_runner_args(pyocd "--target=mimxrt1020")
@@ -7,11 +7,11 @@
set_ifndef(OPENSDA_FW jlink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
elseif(OPENSDA_FW STREQUAL daplink)
set_ifndef(BOARD_DEBUG_RUNNER pyocd)
set_ifndef(BOARD_FLASH_RUNNER pyocd)
board_set_debugger_ifnset(pyocd)
board_set_flasher_ifnset(pyocd)
endif()

board_runner_args(pyocd "--target=mimxrt1050_hyperflash")
@@ -7,11 +7,11 @@
set_ifndef(OPENSDA_FW jlink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
elseif(OPENSDA_FW STREQUAL daplink)
set_ifndef(BOARD_DEBUG_RUNNER pyocd)
set_ifndef(BOARD_FLASH_RUNNER pyocd)
board_set_debugger_ifnset(pyocd)
board_set_flasher_ifnset(pyocd)
endif()

board_runner_args(pyocd "--target=cortex_m")
@@ -7,11 +7,11 @@
set_ifndef(OPENSDA_FW jlink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
elseif(OPENSDA_FW STREQUAL daplink)
set_ifndef(BOARD_DEBUG_RUNNER pyocd)
set_ifndef(BOARD_FLASH_RUNNER pyocd)
board_set_debugger_ifnset(pyocd)
board_set_flasher_ifnset(pyocd)
endif()

board_runner_args(pyocd "--target=cortex_m")
@@ -10,4 +10,4 @@ set(QEMU_FLAGS_${ARCH}
-vga none
)

set(BOARD_DEBUG_RUNNER qemu)
board_set_debugger(qemu)
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

set(BOARD_FLASH_RUNNER pyocd.sh)
set(BOARD_DEBUG_RUNNER pyocd.sh)
board_set_flasher(pyocd.sh)
board_set_debugger(pyocd.sh)

set(PYOCD_TARGET nrf52)

@@ -10,4 +10,4 @@ set(QEMU_FLAGS_${ARCH}
-vga none
)

set(BOARD_DEBUG_RUNNER qemu)
board_set_debugger(qemu)
@@ -3,11 +3,11 @@
set_ifndef(OPENSDA_FW daplink)

if(OPENSDA_FW STREQUAL jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
set_ifndef(BOARD_FLASH_RUNNER jlink)
board_set_debugger_ifnset(jlink)
board_set_flasher_ifnset(jlink)
elseif(OPENSDA_FW STREQUAL daplink)
set_ifndef(BOARD_DEBUG_RUNNER pyocd)
set_ifndef(BOARD_FLASH_RUNNER pyocd)
board_set_debugger_ifnset(pyocd)
board_set_flasher_ifnset(pyocd)
endif()

board_runner_args(jlink "--device=MKE18F512xxx16")
@@ -1,3 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

set(BOARD_DEBUG_RUNNER openocd)
board_set_debugger(openocd)
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

set_ifndef(BOARD_FLASH_RUNNER blackmagicprobe)
set_ifndef(BOARD_DEBUG_RUNNER blackmagicprobe)
board_set_flasher_ifnset(blackmagicprobe)
board_set_debugger_ifnset(blackmagicprobe)
board_finalize_runner_args(blackmagicprobe) # No default arguments to provide
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

set_ifndef(BOARD_FLASH_RUNNER bossac)
board_set_flasher_ifnset(bossac)
board_finalize_runner_args(bossac "--bossac=${BOSSAC}")
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

set_ifndef(BOARD_FLASH_RUNNER dfu-util)
board_set_flasher_ifnset(dfu-util)
board_finalize_runner_args(dfu-util) # No default arguments to provide.
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

set(BOARD_FLASH_RUNNER esp32)
board_set_flasher(esp32)

if(NOT DEFINED ESP_IDF_PATH)
if(DEFINED ENV{ESP_IDF_PATH})
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

set_ifndef(BOARD_FLASH_RUNNER jlink)
set_ifndef(BOARD_DEBUG_RUNNER jlink)
board_set_flasher_ifnset(jlink)
board_set_debugger_ifnset(jlink)
board_finalize_runner_args(jlink "--dt-flash=y")
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

set_ifndef(BOARD_FLASH_RUNNER nios2)
set_ifndef(BOARD_DEBUG_RUNNER nios2)
board_set_flasher_ifnset(nios2)
board_set_debugger_ifnset(nios2)

board_finalize_runner_args(nios2
# TODO: merge this script into nios2.py
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

set_ifndef(BOARD_FLASH_RUNNER nrfjprog)
board_set_flasher_ifnset(nrfjprog)
board_finalize_runner_args(nrfjprog) # No default arguments to provide.
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

set_ifndef(BOARD_FLASH_RUNNER openocd)
set_ifndef(BOARD_DEBUG_RUNNER openocd)
board_set_flasher_ifnset(openocd)
board_set_debugger_ifnset(openocd)

# "load_image" or "flash write_image erase"?
if(CONFIG_X86 OR CONFIG_ARC)
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

set_ifndef(BOARD_FLASH_RUNNER pyocd)
set_ifndef(BOARD_DEBUG_RUNNER pyocd)
board_set_flasher_ifnset(pyocd)
board_set_debugger_ifnset(pyocd)
board_finalize_runner_args(pyocd "--dt-flash=y")
@@ -9,4 +9,4 @@ set(QEMU_FLAGS_${ARCH}
-nographic
)

set(BOARD_DEBUG_RUNNER qemu)
board_set_debugger(qemu)
@@ -9,6 +9,6 @@ set(QEMU_FLAGS_${ARCH}
-machine sifive_e
)

set(BOARD_DEBUG_RUNNER qemu)
set(BOARD_FLASH_RUNNER hifive1)
board_set_debugger(qemu)
board_set_flasher(hifive1)
board_finalize_runner_args(hifive1)
@@ -9,4 +9,4 @@ set(QEMU_FLAGS_${ARCH}
-machine sifive_e
)

set(BOARD_DEBUG_RUNNER qemu)
board_set_debugger(qemu)
@@ -1,10 +1,10 @@
# SPDX-License-Identifier: Apache-2.0

if(DEFINED ENV{ZEPHYR_FLASH_OVER_DFU})
set(BOARD_FLASH_RUNNER dfu-util)
board_set_flasher(dfu-util)
endif()

set(BOARD_DEBUG_RUNNER openocd)
board_set_debugger(openocd)

board_runner_args(dfu-util "--pid=8087:0aba" "--alt=x86_app")
board_runner_args(openocd --cmd-pre-load "targets 1")
@@ -17,6 +17,6 @@ set(QEMU_FLAGS_${ARCH}
)

# TODO: Support debug
# set(BOARD_DEBUG_RUNNER qemu)
# board_set_debugger(qemu)
# debugserver: QEMU_EXTRA_FLAGS += -s -S
# debugserver: qemu
@@ -1,10 +1,10 @@
# SPDX-License-Identifier: Apache-2.0

if(DEFINED ENV{ZEPHYR_FLASH_OVER_DFU})
set(BOARD_FLASH_RUNNER dfu-util)
board_set_flasher(dfu-util)
endif()

set(BOARD_DEBUG_RUNNER openocd)
board_set_debugger(openocd)

board_runner_args(dfu-util "--pid=8087:0aba" "--alt=x86_app")
board_runner_args(openocd --cmd-pre-load "targets 1")
@@ -37,6 +37,6 @@ set(QEMU_FLAGS_${ARCH}
)

# TODO: Support debug
# set(BOARD_DEBUG_RUNNER qemu)
# board_set_debugger(qemu)
# debugserver: QEMU_EXTRA_FLAGS += -s -S
# debugserver: qemu

0 comments on commit 1717332

Please sign in to comment.
You can’t perform that action at this time.