From 74274d9e19aaa8f9a58eaa5f0819cca5b9ea6de4 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Thu, 18 Feb 2021 17:29:53 +0100 Subject: [PATCH] boards: remove openocd/pyocd config conditionals --- boards/calliope-mini/Makefile.include | 11 ++++------ boards/common/nrf52/Makefile.include | 22 ++++++++++---------- boards/common/particle-mesh/Makefile.include | 11 ++++------ boards/microbit-v2/Makefile.include | 11 ++++------ boards/microbit/Makefile.include | 4 +--- boards/nrf51dk/Makefile.include | 4 +--- boards/nrf51dongle/Makefile.include | 4 +--- boards/nrf52832-mdk/Makefile.include | 11 ++++------ boards/nrf52840-mdk/Makefile.include | 11 ++++------ boards/nrf6310/Makefile.include | 4 +--- boards/phynode-kw41z/Makefile.include | 4 +--- boards/pinetime/Makefile.include | 4 +--- makefiles/boards/stm32.inc.mk | 18 +++++++--------- 13 files changed, 44 insertions(+), 75 deletions(-) diff --git a/boards/calliope-mini/Makefile.include b/boards/calliope-mini/Makefile.include index f119139994..ec21564058 100644 --- a/boards/calliope-mini/Makefile.include +++ b/boards/calliope-mini/Makefile.include @@ -1,13 +1,10 @@ # for this board we support flashing via openocd or pyocd PROGRAMMER ?= openocd -ifeq (openocd,$(PROGRAMMER)) - OPENOCD_DEBUG_ADAPTER = dap -else ifeq (pyocd,$(PROGRAMMER)) - # PyOCD doesn't recognize automatically the board ID, so target type has to - # be passed explicitly - PYOCD_FLASH_TARGET_TYPE ?= -t nrf51 -endif +OPENOCD_DEBUG_ADAPTER = dap +# PyOCD doesn't recognize automatically the board ID, so target type has to +# be passed explicitly +PYOCD_FLASH_TARGET_TYPE ?= -t nrf51 # include nrf51 boards common configuration include $(RIOTBOARD)/common/nrf51/Makefile.include diff --git a/boards/common/nrf52/Makefile.include b/boards/common/nrf52/Makefile.include index d416a40ce6..5e9acb6778 100644 --- a/boards/common/nrf52/Makefile.include +++ b/boards/common/nrf52/Makefile.include @@ -9,17 +9,17 @@ ifeq (bmp,$(PROGRAMMER)) endif PROGRAMMER ?= jlink -ifeq (jlink,$(PROGRAMMER)) - # setup JLink for flashing - JLINK_DEVICE = nrf52 -else ifeq (openocd,$(PROGRAMMER)) - ifneq (,$(filter $(BOARD),ruuvitag thingy52)) - # openocd doesn't fully work with ruuvitag and thingy52 +# setup JLink for flashing +JLINK_DEVICE = nrf52 +# setup OpenOCD for flashing. Version 0.10 of OpenOCD doesn't contain support +# for nrf52dk and nrf52840dk boards. To use OpenOCD with these a version +# build from source (master > 2018, August the 13rd) is required. +OPENOCD_DEBUG_ADAPTER ?= jlink +OPENOCD_CONFIG = $(RIOTBOARD)/common/nrf52/dist/openocd.cfg + +ifneq (,$(filter $(BOARD),ruuvitag thingy52)) + # openocd doesn't fully work with ruuvitag and thingy52 + ifeq (openocd,$(PROGRAMMER)) $(error Cannot use OpenOCD with $(BOARD) board) endif - # setup OpenOCD for flashing. Version 0.10 of OpenOCD doesn't contain support - # for nrf52dk and nrf52840dk boards. To use OpenOCD with these a version - # build from source (master > 2018, August the 13rd) is required. - OPENOCD_DEBUG_ADAPTER ?= jlink - OPENOCD_CONFIG = $(RIOTBOARD)/common/nrf52/dist/openocd.cfg endif diff --git a/boards/common/particle-mesh/Makefile.include b/boards/common/particle-mesh/Makefile.include index d9ad7eb1cb..b86df590d3 100644 --- a/boards/common/particle-mesh/Makefile.include +++ b/boards/common/particle-mesh/Makefile.include @@ -23,13 +23,10 @@ else # For openocd, a version built against the development branch and containing # the support for nrf52 cpu is required. PROGRAMMER ?= pyocd - ifeq (pyocd,$(PROGRAMMER)) - # The board is not recognized automatically by pyocd, so the CPU target - # option is passed explicitly - PYOCD_FLASH_TARGET_TYPE ?= -t nrf52840 - else ifeq (openocd,$(PROGRAMMER)) - OPENOCD_DEBUG_ADAPTER ?= dap - endif + # The board is not recognized automatically by pyocd, so the CPU target + # option is passed explicitly + PYOCD_FLASH_TARGET_TYPE ?= -t nrf52840 + OPENOCD_DEBUG_ADAPTER ?= dap endif MONOFIRMWARETOOL = ${RIOTBOARD}/common/particle-mesh/monofirmware-tool.py diff --git a/boards/microbit-v2/Makefile.include b/boards/microbit-v2/Makefile.include index 2b0afee20a..cb5b9ed70d 100644 --- a/boards/microbit-v2/Makefile.include +++ b/boards/microbit-v2/Makefile.include @@ -1,12 +1,9 @@ # for this board, flash with OpenOCD by default. PyOCD is also supported. PROGRAMMER ?= openocd -ifeq (pyocd,$(PROGRAMMER)) - # The board is not recognized automatically by pyocd, so the CPU target - # option is passed explicitly - PYOCD_FLASH_TARGET_TYPE ?= -t $(CPU) -else ifeq (openocd,$(PROGRAMMER)) - OPENOCD_DEBUG_ADAPTER = dap -endif +# The board is not recognized automatically by pyocd, so the CPU target +# option is passed explicitly +PYOCD_FLASH_TARGET_TYPE ?= -t $(CPU) +OPENOCD_DEBUG_ADAPTER = dap ifneq (,$(filter microbit,$(USEMODULE))) INCLUDES += -I$(RIOTBOARD)/common/microbit/include diff --git a/boards/microbit/Makefile.include b/boards/microbit/Makefile.include index ce2a88d8c6..66107d5fa3 100644 --- a/boards/microbit/Makefile.include +++ b/boards/microbit/Makefile.include @@ -4,9 +4,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # for this board we support flashing via openocd or pyocd PROGRAMMER ?= openocd -ifeq (openocd,$(PROGRAMMER)) - OPENOCD_DEBUG_ADAPTER = dap -endif +OPENOCD_DEBUG_ADAPTER = dap # QEMU 4.0 added microbit system emulation. RIOT_EMULATOR ?= qemu diff --git a/boards/nrf51dk/Makefile.include b/boards/nrf51dk/Makefile.include index 8d1d548b62..35f9126ed7 100644 --- a/boards/nrf51dk/Makefile.include +++ b/boards/nrf51dk/Makefile.include @@ -5,9 +5,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) PROGRAMMER ?= openocd # dap debug adapter is required for openocd -ifeq (openocd,$(PROGRAMMER)) - OPENOCD_DEBUG_ADAPTER = dap -endif +OPENOCD_DEBUG_ADAPTER = dap # include nrf51 boards common configuration include $(RIOTBOARD)/common/nrf51/Makefile.include diff --git a/boards/nrf51dongle/Makefile.include b/boards/nrf51dongle/Makefile.include index 9fcdfb1ff8..4503c843bc 100644 --- a/boards/nrf51dongle/Makefile.include +++ b/boards/nrf51dongle/Makefile.include @@ -5,9 +5,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) PROGRAMMER ?= jlink # set required jlink debug adapter for openocd if it's used -ifeq (openocd,$(PROGRAMMER)) - OPENOCD_DEBUG_ADAPTER = jlink -endif +OPENOCD_DEBUG_ADAPTER = jlink # include nrf51 boards common configuration include $(RIOTBOARD)/common/nrf51/Makefile.include diff --git a/boards/nrf52832-mdk/Makefile.include b/boards/nrf52832-mdk/Makefile.include index 31d573cb34..02d0a173ec 100644 --- a/boards/nrf52832-mdk/Makefile.include +++ b/boards/nrf52832-mdk/Makefile.include @@ -3,12 +3,9 @@ # For openocd, a version built against the development branch and containing # the support for nrf52 cpu is required. PROGRAMMER ?= pyocd -ifeq (pyocd,$(PROGRAMMER)) - # The board is not recognized automatically by pyocd, so the CPU target - # option is passed explicitly - PYOCD_FLASH_TARGET_TYPE ?= -t $(CPU) -else ifeq (openocd,$(PROGRAMMER)) - OPENOCD_DEBUG_ADAPTER = dap -endif +# The board is not recognized automatically by pyocd, so the CPU target +# option is passed explicitly +PYOCD_FLASH_TARGET_TYPE ?= -t $(CPU) +OPENOCD_DEBUG_ADAPTER = dap include $(RIOTBOARD)/common/nrf52/Makefile.include diff --git a/boards/nrf52840-mdk/Makefile.include b/boards/nrf52840-mdk/Makefile.include index faf922bc83..2494656654 100644 --- a/boards/nrf52840-mdk/Makefile.include +++ b/boards/nrf52840-mdk/Makefile.include @@ -3,12 +3,9 @@ # For openocd, a version built against the development branch and containing # the support for nrf52 cpu is required. PROGRAMMER ?= pyocd -ifeq (pyocd,$(PROGRAMMER)) - # The board is not recognized automatically by pyocd, so the CPU target - # option is passed explicitly - PYOCD_FLASH_TARGET_TYPE ?= -t nrf52840 -else ifeq (openocd,$(PROGRAMMER)) - OPENOCD_DEBUG_ADAPTER = dap -endif +# The board is not recognized automatically by pyocd, so the CPU target +# option is passed explicitly +PYOCD_FLASH_TARGET_TYPE ?= -t nrf52840 +OPENOCD_DEBUG_ADAPTER = dap include $(RIOTBOARD)/common/nrf52/Makefile.include diff --git a/boards/nrf6310/Makefile.include b/boards/nrf6310/Makefile.include index 8682b0bcc7..35c541b38c 100644 --- a/boards/nrf6310/Makefile.include +++ b/boards/nrf6310/Makefile.include @@ -6,9 +6,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) PROGRAMMER ?= jlink # set required debug adapter for openocd if it's used -ifeq (openocd,$(PROGRAMMER)) - OPENOCD_DEBUG_ADAPTER = jlink -endif +OPENOCD_DEBUG_ADAPTER = jlink # include nrf51 boards common configuration include $(RIOTBOARD)/common/nrf51/Makefile.include diff --git a/boards/phynode-kw41z/Makefile.include b/boards/phynode-kw41z/Makefile.include index 859e7d9f6c..9438a02f3c 100644 --- a/boards/phynode-kw41z/Makefile.include +++ b/boards/phynode-kw41z/Makefile.include @@ -2,9 +2,7 @@ PROGRAMMER ?= openocd # dap debug adapter is required for openocd -ifeq (openocd,$(PROGRAMMER)) - OPENOCD_DEBUG_ADAPTER = dap -endif +OPENOCD_DEBUG_ADAPTER = dap # Enable direct write to FCF (required for setting FOPT byte). OPENOCD_PRE_FLASH_CMDS += "-c kinetis fcf_source write" diff --git a/boards/pinetime/Makefile.include b/boards/pinetime/Makefile.include index 7702f36a50..6777092b9e 100644 --- a/boards/pinetime/Makefile.include +++ b/boards/pinetime/Makefile.include @@ -2,9 +2,7 @@ RIOT_TERMINAL ?= jlink # define pyocd as programmer to program with stlink -ifeq (pyocd,$(PROGRAMMER)) - PYOCD_FLASH_TARGET_TYPE ?= -t $(CPU) -endif +PYOCD_FLASH_TARGET_TYPE ?= -t $(CPU) # use shared Makefile.include include $(RIOTBOARD)/common/nrf52/Makefile.include diff --git a/makefiles/boards/stm32.inc.mk b/makefiles/boards/stm32.inc.mk index 71152d7b64..c55374a2c7 100644 --- a/makefiles/boards/stm32.inc.mk +++ b/makefiles/boards/stm32.inc.mk @@ -13,19 +13,15 @@ ifeq (bmp,$(PROGRAMMER)) PORT_DARWIN ?= $(wordlist 2, 2, $(sort $(wildcard /dev/tty.usbmodem*))) endif -ifeq (openocd,$(PROGRAMMER)) - # STM32 boards can become un-flashable after a hardfault, - # use connect_assert_srst to always be able to flash or reset the boards. - OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 +# STM32 boards can become un-flashable after a hardfault, +# use connect_assert_srst to always be able to flash or reset the boards. +OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 - # For STM32 boards the ST-link adapter is the default adapter, e.g. all - # Nucleo boards have an on-board ST-link adapter - OPENOCD_DEBUG_ADAPTER ?= stlink -endif +# For STM32 boards the ST-link adapter is the default adapter, e.g. all +# Nucleo boards have an on-board ST-link adapter +OPENOCD_DEBUG_ADAPTER ?= stlink -ifeq (jlink,$(PROGRAMMER)) - JLINK_DEVICE ?= $(CPU_MODEL) -endif +JLINK_DEVICE ?= $(CPU_MODEL) ifeq (dfu-util,$(PROGRAMMER)) # optionally, use dfu-util to flash via usb