diff --git a/Makefile.include b/Makefile.include index d79ef1f6d2..763c0aa009 100644 --- a/Makefile.include +++ b/Makefile.include @@ -410,6 +410,17 @@ endif # Include common programmer logic if available -include $(RIOTMAKE)/tools/$(PROGRAMMER).inc.mk +# Check if programmer is supported by the board, only if PROGRAMMERS_SUPPORTED +# is set and if programmer is not iotlab +ifneq (iotlab,$(PROGRAMMER)) + ifneq (,$(PROGRAMMERS_SUPPORTED)) + ifeq (,$(filter $(PROGRAMMER),$(PROGRAMMERS_SUPPORTED))) + $(info '$(PROGRAMMER)' programmer is not supported by this board. \ + Supported programmers: '$(PROGRAMMERS_SUPPORTED)') + endif + endif +endif + # Assume GCC/GNU as supported toolchain if CPU's Makefile.include doesn't # provide this macro TOOLCHAINS_SUPPORTED ?= gnu diff --git a/boards/6lowpan-clicker/Makefile.include b/boards/6lowpan-clicker/Makefile.include index c01275037e..4de3ef42b7 100644 --- a/boards/6lowpan-clicker/Makefile.include +++ b/boards/6lowpan-clicker/Makefile.include @@ -1,6 +1,6 @@ # use pic32prog by default to program this board PROGRAMMER ?= pic32prog - +PROGRAMMERS_SUPPORTED += pic32prog ifeq ($(PROGRAMMER),pic32prog) # pic32prog # diff --git a/boards/adafruit-clue/Makefile.include b/boards/adafruit-clue/Makefile.include index 7878ea050f..50cd70b7ab 100644 --- a/boards/adafruit-clue/Makefile.include +++ b/boards/adafruit-clue/Makefile.include @@ -2,6 +2,7 @@ PROGRAMMER ?= adafruit-nrfutil include $(RIOTBOARD)/common/nrf52/Makefile.include +PROGRAMMERS_SUPPORTED += adafruit-nrfutil ifeq ($(PROGRAMMER),adafruit-nrfutil) # The preinstalled bootloader must also be taken into account so diff --git a/boards/adafruit-itsybitsy-nrf52/Makefile.include b/boards/adafruit-itsybitsy-nrf52/Makefile.include index f6b26adbd7..b2e3879967 100644 --- a/boards/adafruit-itsybitsy-nrf52/Makefile.include +++ b/boards/adafruit-itsybitsy-nrf52/Makefile.include @@ -28,3 +28,4 @@ endif $(FLASHER) dfu genpkg --dev-type 0x0052 --sd-req 0x00B6 --application $< $@ include $(RIOTBOARD)/common/nrf52/Makefile.include +PROGRAMMERS_SUPPORTED += nrfutil diff --git a/boards/airfy-beacon/Makefile.include b/boards/airfy-beacon/Makefile.include index d2b5f458cf..b287220b37 100644 --- a/boards/airfy-beacon/Makefile.include +++ b/boards/airfy-beacon/Makefile.include @@ -6,7 +6,5 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) OPENOCD_DEBUG_ADAPTER ?= stlink STLINK_VERSION ?= 2 -PROGRAMMER = openocd - # include nrf51 boards common configuration include $(RIOTBOARD)/common/nrf51/Makefile.include diff --git a/boards/arduino-nano-33-ble/Makefile.include b/boards/arduino-nano-33-ble/Makefile.include index bc8ca5a779..703bd60627 100644 --- a/boards/arduino-nano-33-ble/Makefile.include +++ b/boards/arduino-nano-33-ble/Makefile.include @@ -13,6 +13,8 @@ ifeq ($(PROGRAMMER),bossa) PREFLASH_DELAY = 1 endif +PROGRAMMERS_SUPPORTED += bossa + TESTRUNNER_CONNECT_DELAY ?= 2 $(call target-export-variables,test,TESTRUNNER_CONNECT_DELAY) diff --git a/boards/b-l072z-lrwan1/Makefile.include b/boards/b-l072z-lrwan1/Makefile.include index dfa4ccfdf1..c175f5c87a 100644 --- a/boards/b-l072z-lrwan1/Makefile.include +++ b/boards/b-l072z-lrwan1/Makefile.include @@ -5,6 +5,9 @@ INCLUDES += -I$(RIOTBOARD)/common/stm32/include PROGRAMMER ?= openocd OPENOCD_DEBUG_ADAPTER ?= stlink +# Add openocd as supported programmer +PROGRAMMERS_SUPPORTED += openocd + # this board can become un-flashable after a hardfault, # use connect_assert_srst to always be able to flash or reset the board. OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 diff --git a/boards/b-l475e-iot01a/Makefile.include b/boards/b-l475e-iot01a/Makefile.include index cda79dc6a0..a13523caa7 100644 --- a/boards/b-l475e-iot01a/Makefile.include +++ b/boards/b-l475e-iot01a/Makefile.include @@ -5,6 +5,9 @@ INCLUDES += -I$(RIOTBOARD)/common/stm32/include PROGRAMMER ?= openocd OPENOCD_DEBUG_ADAPTER ?= stlink +# Add openocd as supported programmer +PROGRAMMERS_SUPPORTED += openocd + # The board can become un-flashable after some execution, # use connect_assert_srst to always be able to flash or reset the board. OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 diff --git a/boards/calliope-mini/Makefile.include b/boards/calliope-mini/Makefile.include index ec21564058..7261ddd8a4 100644 --- a/boards/calliope-mini/Makefile.include +++ b/boards/calliope-mini/Makefile.include @@ -1,6 +1,9 @@ # for this board we support flashing via openocd or pyocd PROGRAMMER ?= openocd +# This board can be flashed with pyocd +PROGRAMMERS_SUPPORTED += pyocd + OPENOCD_DEBUG_ADAPTER = dap # PyOCD doesn't recognize automatically the board ID, so target type has to # be passed explicitly diff --git a/boards/common/arduino-due/Makefile.include b/boards/common/arduino-due/Makefile.include index dd9c435bc7..dba7f6f100 100644 --- a/boards/common/arduino-due/Makefile.include +++ b/boards/common/arduino-due/Makefile.include @@ -3,5 +3,6 @@ INCLUDES += -I$(RIOTBOARD)/common/arduino-due/include # setup flasher (using BOSSA) PROGRAMMER ?= bossa +PROGRAMMERS_SUPPORTED += bossa BOSSA_VERSION = 1.8 BOSSA_ARDUINO_PREFLASH = yes diff --git a/boards/common/atmega/Makefile.include b/boards/common/atmega/Makefile.include index 3621acb1ca..446e2db24d 100644 --- a/boards/common/atmega/Makefile.include +++ b/boards/common/atmega/Makefile.include @@ -3,6 +3,9 @@ INCLUDES += -I$(RIOTBOARD)/common/atmega/include # Use avrdude programmer PROGRAMMER ?= avrdude +# Add avrdude as supported programmer +PROGRAMMERS_SUPPORTED += avrdude + # Use atmega board specific bootloader by default ATMEGA_BOOTLOADER ?= $($(call uppercase_and_underscore,$(BOARD))_BOOTLOADER) diff --git a/boards/common/cc2538/Makefile.include b/boards/common/cc2538/Makefile.include index 7fdda78d59..c2c17b3ae1 100644 --- a/boards/common/cc2538/Makefile.include +++ b/boards/common/cc2538/Makefile.include @@ -1,6 +1,9 @@ # define the default flash-tool PROGRAMMER ?= cc2538-bsl +# cc2538-bsl programmer is supported +PROGRAMMERS_SUPPORTED += cc2538-bsl + ifeq ($(PROGRAMMER),cc2538-bsl) PROG_BAUD ?= 460800 else ifeq ($(PROGRAMMER),jlink) diff --git a/boards/common/cc26xx_cc13xx/Makefile.include b/boards/common/cc26xx_cc13xx/Makefile.include index acfcb9224d..30f6b7f7eb 100644 --- a/boards/common/cc26xx_cc13xx/Makefile.include +++ b/boards/common/cc26xx_cc13xx/Makefile.include @@ -1,5 +1,8 @@ # configure the flash tool PROGRAMMER ?= uniflash +# uniflash and openocd programmers are supported +PROGRAMMERS_SUPPORTED += openocd uniflash + OPENOCD_CONFIG ?= $(RIOTBOARD)/common/cc26xx_cc13xx/dist/openocd.cfg UNIFLASH_CONFIG ?= $(RIOTBOARD)/common/cc26xx_cc13xx/dist diff --git a/boards/common/frdm/Makefile.include b/boards/common/frdm/Makefile.include index d293a9eb1a..8fee8b294d 100644 --- a/boards/common/frdm/Makefile.include +++ b/boards/common/frdm/Makefile.include @@ -24,3 +24,6 @@ OPENOCD_PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh # The board can become un-flashable after some execution, # use connect_assert_srst to always be able to flash or reset the board. OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 + +# openocd programmer is supported with FRDM boards +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/common/iotlab/Makefile.include b/boards/common/iotlab/Makefile.include index 6000a1b1ac..d98e6bcdf6 100644 --- a/boards/common/iotlab/Makefile.include +++ b/boards/common/iotlab/Makefile.include @@ -5,6 +5,9 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*B))) # setup serial terminal BAUD ?= 500000 +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd + # Use openocd by default PROGRAMMER ?= openocd diff --git a/boards/common/msb-430/Makefile.include b/boards/common/msb-430/Makefile.include index dc43ef76b4..cf53ed4586 100644 --- a/boards/common/msb-430/Makefile.include +++ b/boards/common/msb-430/Makefile.include @@ -7,3 +7,5 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup flash tool PROGRAMMER ?= mspdebug MSPDEBUG_PROGRAMMER ?= olimex + +PROGRAMMERS_SUPPORTED += mspdebug diff --git a/boards/common/msba2/Makefile.include b/boards/common/msba2/Makefile.include index 4f727bcb16..d7f54f3602 100644 --- a/boards/common/msba2/Makefile.include +++ b/boards/common/msba2/Makefile.include @@ -6,6 +6,8 @@ PORT_DARWIN ?= /dev/tty.usbserial-ARM # Use lpc2k_pgm programmer PROGRAMMER ?= lpc2k_pgm +PROGRAMMERS_SUPPORTED += lpc2k_pgm + # when using miniterm set RTS and DTR lines to 0, otherwise the board is reset MINITERMFLAGS += --rts 0 --dtr 0 diff --git a/boards/common/nrf51/Makefile.include b/boards/common/nrf51/Makefile.include index 5d6291a0ec..dc4d2d8f58 100644 --- a/boards/common/nrf51/Makefile.include +++ b/boards/common/nrf51/Makefile.include @@ -16,3 +16,6 @@ else ifeq ($(PROGRAMMER),jlink) # setup JLink for flashing JLINK_DEVICE = nrf51822 endif + +# Set openocd as default supported programmers +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/common/nrf52/Makefile.include b/boards/common/nrf52/Makefile.include index 5e9acb6778..9b287b6902 100644 --- a/boards/common/nrf52/Makefile.include +++ b/boards/common/nrf52/Makefile.include @@ -23,3 +23,6 @@ ifneq (,$(filter $(BOARD),ruuvitag thingy52)) $(error Cannot use OpenOCD with $(BOARD) board) endif endif + +# set list of supported programmers +PROGRAMMERS_SUPPORTED += bmp openocd diff --git a/boards/common/particle-mesh/Makefile.include b/boards/common/particle-mesh/Makefile.include index b86df590d3..8aa40425e0 100644 --- a/boards/common/particle-mesh/Makefile.include +++ b/boards/common/particle-mesh/Makefile.include @@ -5,6 +5,8 @@ CFLAGS += -DBOARD_NRFANTENNA_DEFAULT=BOARD_NRFANTENNA_$(BOARD_NRFANTENNA_DEFAULT # add the common header files to the include path INCLUDES += -I$(RIOTBOARD)/common/particle-mesh/include +PROGRAMMERS_SUPPORTED += dfu-util pyocd + ifeq (1,$(PARTICLE_MONOFIRMWARE)) CFLAGS += -DPARTICLE_MONOFIRMWARE ROM_OFFSET = 0x30000 @@ -17,6 +19,9 @@ ifeq (1,$(PARTICLE_MONOFIRMWARE)) # then again nothing can be done in that case anyway, and the preflash # routines fall through without erring. include $(RIOTMAKE)/tools/usb_board_reset.mk + + # Only dfu-util is supported in this case + PROGRAMMERS_SUPPORTED = dfu-util else # This board uses a DAP-Link programmer # Flashing support is provided through pyocd (default) and openocd. diff --git a/boards/common/qn908x/Makefile.include b/boards/common/qn908x/Makefile.include index 30ccde4388..cfd04893f6 100644 --- a/boards/common/qn908x/Makefile.include +++ b/boards/common/qn908x/Makefile.include @@ -2,6 +2,7 @@ # of writing has not been merged in the tree and is only available at # http://openocd.zylin.com/#/c/5584/ . PROGRAMMER ?= openocd +PROGRAMMERS_SUPPORTED += openocd # Using dap or jlink depends on which firmware the OpenSDA debugger is running #OPENOCD_DEBUG_ADAPTER ?= dap diff --git a/boards/common/samdx1-arduino-bootloader/Makefile.include b/boards/common/samdx1-arduino-bootloader/Makefile.include index bd6b74f7dd..651bda7df7 100644 --- a/boards/common/samdx1-arduino-bootloader/Makefile.include +++ b/boards/common/samdx1-arduino-bootloader/Makefile.include @@ -2,6 +2,10 @@ # Bossa is the default programmer PROGRAMMER ?= bossa +# Add bossa as supported programmers. Boards that support more programmers +# should declare them in their own Makefile.include +PROGRAMMERS_SUPPORTED += bossa + ifeq ($(PROGRAMMER),bossa) # by default, we use BOSSA to flash this board and take into account the # preinstalled Arduino bootloader. ROM_OFFSET skips the space taken by diff --git a/boards/common/silabs/Makefile.include b/boards/common/silabs/Makefile.include index a89b391363..b0e4406272 100644 --- a/boards/common/silabs/Makefile.include +++ b/boards/common/silabs/Makefile.include @@ -3,5 +3,8 @@ INCLUDES += -I$(RIOTBOARD)/common/silabs/drivers/include PROGRAMMER ?= jlink +# Silabs boards can use openocd programmer +PROGRAMMERS_SUPPORTED += openocd + JLINK_DEVICE ?= ${CPU_MODEL} OPENOCD_CONFIG ?= board/efm32.cfg diff --git a/boards/ek-lm4f120xl/Makefile.include b/boards/ek-lm4f120xl/Makefile.include index 003e851b55..35c17226b6 100644 --- a/boards/ek-lm4f120xl/Makefile.include +++ b/boards/ek-lm4f120xl/Makefile.include @@ -1,2 +1,4 @@ # this board uses openocd PROGRAMMER ?= openocd + +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/fox/Makefile.include b/boards/fox/Makefile.include index 306b36fe73..200c4867ba 100644 --- a/boards/fox/Makefile.include +++ b/boards/fox/Makefile.include @@ -7,3 +7,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*))) # this board uses openocd PROGRAMMER ?= openocd + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/hifive1/Makefile.include b/boards/hifive1/Makefile.include index 41ff60da34..5385a18171 100644 --- a/boards/hifive1/Makefile.include +++ b/boards/hifive1/Makefile.include @@ -4,6 +4,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) # this board uses openocd with a custom reset command PROGRAMMER ?= openocd +PROGRAMMERS_SUPPORTED += openocd OPENOCD_CMD_RESET_RUN =-c _reset # use our own openocd script to flash since HiFive1 has reset problems. diff --git a/boards/hifive1b/Makefile.include b/boards/hifive1b/Makefile.include index 815fef936c..88ec119270 100644 --- a/boards/hifive1b/Makefile.include +++ b/boards/hifive1b/Makefile.include @@ -1,5 +1,6 @@ # Set default programmer as jlink PROGRAMMER ?= jlink +PROGRAMMERS_SUPPORTED += jlink openocd ifeq (openocd,$(PROGRAMMER)) OPENOCD_DEBUG_ADAPTER = jlink @@ -10,8 +11,6 @@ else ifeq (jlink,$(PROGRAMMER)) JLINK_DEVICE = FE310 JLINK_IF = JTAG FLASH_ADDR = 0x20010000 -else - $(error Programmer '$(PROGRAMMER)' not supported for board '$(BOARD)') endif TESTRUNNER_RESET_DELAY = 1 diff --git a/boards/i-nucleo-lrwan1/Makefile.include b/boards/i-nucleo-lrwan1/Makefile.include index db8d239278..e42f142148 100644 --- a/boards/i-nucleo-lrwan1/Makefile.include +++ b/boards/i-nucleo-lrwan1/Makefile.include @@ -10,3 +10,5 @@ OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # this board uses openocd PROGRAMMER ?= openocd +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/im880b/Makefile.include b/boards/im880b/Makefile.include index d6da09df5b..c1aa8c2438 100644 --- a/boards/im880b/Makefile.include +++ b/boards/im880b/Makefile.include @@ -10,4 +10,7 @@ CFLAGS+=-DSX127X_RX_SWITCH # this board uses openocd PROGRAMMER ?= openocd +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd + OPENOCD_DEBUG_ADAPTER ?= stlink diff --git a/boards/limifrog-v1/Makefile.include b/boards/limifrog-v1/Makefile.include index 27e2d23834..11a51b9180 100644 --- a/boards/limifrog-v1/Makefile.include +++ b/boards/limifrog-v1/Makefile.include @@ -9,3 +9,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) PROGRAMMER ?= openocd OPENOCD_DEBUG_ADAPTER ?= stlink STLINK_VERSION ?= 2 + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/lobaro-lorabox/Makefile.include b/boards/lobaro-lorabox/Makefile.include index f13abe9e72..a04377df9e 100644 --- a/boards/lobaro-lorabox/Makefile.include +++ b/boards/lobaro-lorabox/Makefile.include @@ -14,3 +14,6 @@ PROGRAMMER ?= stm32loader STM32LOADER_FLAGS ?= -u -S -l 0x1ff PYTERMFLAGS += --set-rts 0 + +# stm32loader programmer is supported +PROGRAMMERS_SUPPORTED += stm32loader diff --git a/boards/lsn50/Makefile.include b/boards/lsn50/Makefile.include index 0dc3200ec3..34b701bdd7 100644 --- a/boards/lsn50/Makefile.include +++ b/boards/lsn50/Makefile.include @@ -8,3 +8,6 @@ PROGRAMMER ?= openocd OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # By default, flash this board using an ST-link adapter OPENOCD_DEBUG_ADAPTER ?= stlink + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/maple-mini/Makefile.include b/boards/maple-mini/Makefile.include index 0d40a6f290..a82e8b894f 100644 --- a/boards/maple-mini/Makefile.include +++ b/boards/maple-mini/Makefile.include @@ -4,3 +4,6 @@ INCLUDES += -I$(RIOTBOARD)/common/stm32/include # this board uses openocd with st-link PROGRAMMER ?= openocd OPENOCD_DEBUG_ADAPTER ?= stlink + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/microbit-v2/Makefile.include b/boards/microbit-v2/Makefile.include index cb5b9ed70d..79010b91b4 100644 --- a/boards/microbit-v2/Makefile.include +++ b/boards/microbit-v2/Makefile.include @@ -1,5 +1,7 @@ # for this board, flash with OpenOCD by default. PyOCD is also supported. PROGRAMMER ?= openocd +PROGRAMMERS_SUPPORTED += pyocd + # The board is not recognized automatically by pyocd, so the CPU target # option is passed explicitly PYOCD_FLASH_TARGET_TYPE ?= -t $(CPU) diff --git a/boards/microbit/Makefile.include b/boards/microbit/Makefile.include index 66107d5fa3..a51927daf9 100644 --- a/boards/microbit/Makefile.include +++ b/boards/microbit/Makefile.include @@ -3,6 +3,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # for this board we support flashing via openocd or pyocd PROGRAMMER ?= openocd +PROGRAMMERS_SUPPORTED += pyocd OPENOCD_DEBUG_ADAPTER = dap diff --git a/boards/mulle/Makefile.include b/boards/mulle/Makefile.include index 1eb45386b9..e880c5cf8c 100644 --- a/boards/mulle/Makefile.include +++ b/boards/mulle/Makefile.include @@ -5,6 +5,7 @@ endif # this board uses openocd PROGRAMMER ?= openocd +PROGRAMMERS_SUPPORTED += openocd # Default debug adapter choice is to use the Mulle programmer board OPENOCD_DEBUG_ADAPTER ?= mulle diff --git a/boards/nrf52832-mdk/Makefile.include b/boards/nrf52832-mdk/Makefile.include index 02d0a173ec..917c2be272 100644 --- a/boards/nrf52832-mdk/Makefile.include +++ b/boards/nrf52832-mdk/Makefile.include @@ -8,4 +8,7 @@ PROGRAMMER ?= pyocd PYOCD_FLASH_TARGET_TYPE ?= -t $(CPU) OPENOCD_DEBUG_ADAPTER = dap +# This board can also be flashed with pyocd +PROGRAMMERS_SUPPORTED += pyocd + include $(RIOTBOARD)/common/nrf52/Makefile.include diff --git a/boards/nrf52840-mdk-dongle/Makefile.include b/boards/nrf52840-mdk-dongle/Makefile.include index 6dde7744a8..ceca1c1104 100644 --- a/boards/nrf52840-mdk-dongle/Makefile.include +++ b/boards/nrf52840-mdk-dongle/Makefile.include @@ -16,4 +16,6 @@ ifeq (uf2conv,$(PROGRAMMER)) include $(RIOTMAKE)/tools/usb_board_reset.mk endif +PROGRAMMERS_SUPPORTED += uf2conv + include $(RIOTBOARD)/common/nrf52/Makefile.include diff --git a/boards/nrf52840-mdk/Makefile.include b/boards/nrf52840-mdk/Makefile.include index 2494656654..924274d4d4 100644 --- a/boards/nrf52840-mdk/Makefile.include +++ b/boards/nrf52840-mdk/Makefile.include @@ -8,4 +8,7 @@ PROGRAMMER ?= pyocd PYOCD_FLASH_TARGET_TYPE ?= -t nrf52840 OPENOCD_DEBUG_ADAPTER = dap +# This board can also be flashed with pyocd +PROGRAMMERS_SUPPORTED += pyocd + include $(RIOTBOARD)/common/nrf52/Makefile.include diff --git a/boards/nrf52840dongle/Makefile.include b/boards/nrf52840dongle/Makefile.include index b6e77101b7..135045a7d2 100644 --- a/boards/nrf52840dongle/Makefile.include +++ b/boards/nrf52840dongle/Makefile.include @@ -22,6 +22,8 @@ ifeq (nrfutil,$(PROGRAMMER)) include $(RIOTMAKE)/tools/usb_board_reset.mk endif +PROGRAMMERS_SUPPORTED += nrfutil + %.hex.zip: %.hex $(call check_cmd,$(FLASHER),Flash program and preparation tool) $(FLASHER) pkg generate --hw-version 52 --sd-req 0x00 --application-version 1 --application $< $@ diff --git a/boards/nz32-sc151/Makefile.include b/boards/nz32-sc151/Makefile.include index e482672d5d..955a8ee607 100644 --- a/boards/nz32-sc151/Makefile.include +++ b/boards/nz32-sc151/Makefile.include @@ -9,3 +9,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) PROGRAMMER ?= dfu-util DFU_USB_ID = 0483:df11 DFU_USE_DFUSE = 1 + +# dfu-util programmer is supported +PROGRAMMERS_SUPPORTED += dfu-util diff --git a/boards/opencm904/Makefile.include b/boards/opencm904/Makefile.include index 96c1876bc8..f711631972 100644 --- a/boards/opencm904/Makefile.include +++ b/boards/opencm904/Makefile.include @@ -3,6 +3,7 @@ INCLUDES += -I$(RIOTBOARD)/common/stm32/include # custom flasher to use with the bootloader PROGRAMMER ?= robotis-loader +PROGRAMMERS_SUPPORTED += robotis-loader # Skip the space needed by the embedded bootloader ROM_OFFSET ?= 0x3000 diff --git a/boards/p-l496g-cell02/Makefile.include b/boards/p-l496g-cell02/Makefile.include index bcb8ababf4..b6361fdaae 100644 --- a/boards/p-l496g-cell02/Makefile.include +++ b/boards/p-l496g-cell02/Makefile.include @@ -4,3 +4,6 @@ INCLUDES += -I$(RIOTBOARD)/common/stm32/include # this board uses openocd with st-link PROGRAMMER ?= openocd OPENOCD_DEBUG_ADAPTER ?= stlink + +# Only openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/pba-d-01-kw2x/Makefile.include b/boards/pba-d-01-kw2x/Makefile.include index 77bc78b382..a49baccf11 100644 --- a/boards/pba-d-01-kw2x/Makefile.include +++ b/boards/pba-d-01-kw2x/Makefile.include @@ -13,6 +13,7 @@ endif # this board uses openocd PROGRAMMER ?= openocd +PROGRAMMERS_SUPPORTED += openocd # We need special handling of the watchdog if we want to speed up the flash # verification by using the MCU to compute the image checksum after flashing. diff --git a/boards/pic32-wifire/Makefile.include b/boards/pic32-wifire/Makefile.include index bb34bd22c3..ec7c256b3e 100644 --- a/boards/pic32-wifire/Makefile.include +++ b/boards/pic32-wifire/Makefile.include @@ -2,6 +2,7 @@ PORT_LINUX ?= /dev/ttyUSB0 # use pic32prog by default to program this board PROGRAMMER ?= pic32prog +PROGRAMMERS_SUPPORTED += pic32prog jlink ifeq ($(PROGRAMMER),pic32prog) # pic32prog diff --git a/boards/pyboard/Makefile.include b/boards/pyboard/Makefile.include index 83b4a93f75..a0f16db3f3 100644 --- a/boards/pyboard/Makefile.include +++ b/boards/pyboard/Makefile.include @@ -7,5 +7,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # this board is flashed using DFU PROGRAMMER ?= dfu-util +PROGRAMMERS_SUPPORTED += dfu-util DFU_USB_ID = 1d50:607f DFU_USE_DFUSE = 1 diff --git a/boards/ruuvitag/Makefile.include b/boards/ruuvitag/Makefile.include index 03e3beeae0..d90c0b68c4 100644 --- a/boards/ruuvitag/Makefile.include +++ b/boards/ruuvitag/Makefile.include @@ -7,3 +7,6 @@ endif # use shared Makefile.include include $(RIOTBOARD)/common/nrf52xxxdk/Makefile.include + +# openocd doesn't fully work with this board +PROGRAMMERS_SUPPORTED := $(filter-out openocd,$(PROGRAMMERS_SUPPORTED)) diff --git a/boards/seeeduino_arch-pro/Makefile.include b/boards/seeeduino_arch-pro/Makefile.include index f2b0acf7c9..f908447db2 100644 --- a/boards/seeeduino_arch-pro/Makefile.include +++ b/boards/seeeduino_arch-pro/Makefile.include @@ -4,6 +4,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # this board uses openocd with an HEXFILE PROGRAMMER ?= openocd +PROGRAMMERS_SUPPORTED += openocd FLASHFILE ?= $(HEXFILE) OPENOCD_DEBUG_ADAPTER ?= dap diff --git a/boards/sensebox_samd21/Makefile.include b/boards/sensebox_samd21/Makefile.include index 8f06497edf..0ccbc79afd 100644 --- a/boards/sensebox_samd21/Makefile.include +++ b/boards/sensebox_samd21/Makefile.include @@ -1,6 +1,7 @@ # by default, we use BOSSA to flash this board to take into account the # pre-flashed Arduino bootloader PROGRAMMER ?= bossa +PROGRAMMERS_SUPPORTED += bossa # setup the flash tool used ifeq ($(PROGRAMMER),jlink) diff --git a/boards/spark-core/Makefile.include b/boards/spark-core/Makefile.include index cbce081a8e..676e629259 100644 --- a/boards/spark-core/Makefile.include +++ b/boards/spark-core/Makefile.include @@ -12,3 +12,5 @@ ROM_OFFSET ?= 0x5000 PROGRAMMER ?= dfu-util DFU_USB_ID = 1d50:607f DFU_USE_DFUSE = 1 + +PROGRAMMERS_SUPPORTED += dfu-util diff --git a/boards/stm32f0discovery/Makefile.include b/boards/stm32f0discovery/Makefile.include index f65270401a..7bf9af1e3f 100644 --- a/boards/stm32f0discovery/Makefile.include +++ b/boards/stm32f0discovery/Makefile.include @@ -9,3 +9,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) PROGRAMMER ?= openocd OPENOCD_DEBUG_ADAPTER ?= stlink STLINK_VERSION ?= 2 + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/stm32f3discovery/Makefile.include b/boards/stm32f3discovery/Makefile.include index f0a61abbb4..0de5d6bd05 100644 --- a/boards/stm32f3discovery/Makefile.include +++ b/boards/stm32f3discovery/Makefile.include @@ -13,3 +13,6 @@ STLINK_VERSION ?= 2 # The board can become un-flashable after some execution, # use connect_assert_srst to always be able to flash or reset the board. OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/stm32f429i-disc1/Makefile.include b/boards/stm32f429i-disc1/Makefile.include index 78f07632fc..b932c4f457 100644 --- a/boards/stm32f429i-disc1/Makefile.include +++ b/boards/stm32f429i-disc1/Makefile.include @@ -5,3 +5,6 @@ INCLUDES += -I$(RIOTBOARD)/common/stm32/include PROGRAMMER ?= openocd # this board has an on-board ST-link adapter OPENOCD_DEBUG_ADAPTER ?= stlink + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/stm32f4discovery/Makefile.include b/boards/stm32f4discovery/Makefile.include index 34a774d39c..39dd1d7221 100644 --- a/boards/stm32f4discovery/Makefile.include +++ b/boards/stm32f4discovery/Makefile.include @@ -12,3 +12,6 @@ STLINK_VERSION ?= 2 # Tell renode on which UART stdio is available RENODE_SYSBUS_UART ?= sysbus.uart2 + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/stm32f723e-disco/Makefile.include b/boards/stm32f723e-disco/Makefile.include index a117a96e26..7a34de18d6 100644 --- a/boards/stm32f723e-disco/Makefile.include +++ b/boards/stm32f723e-disco/Makefile.include @@ -6,3 +6,6 @@ PROGRAMMER ?= openocd # this board has an on-board ST-link adapter OPENOCD_DEBUG_ADAPTER ?= stlink + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/stm32f769i-disco/Makefile.include b/boards/stm32f769i-disco/Makefile.include index 0564a223c3..ba4b128d6f 100644 --- a/boards/stm32f769i-disco/Makefile.include +++ b/boards/stm32f769i-disco/Makefile.include @@ -6,3 +6,6 @@ PROGRAMMER ?= openocd # this board has an on-board ST-link adapter OPENOCD_DEBUG_ADAPTER ?= stlink + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/stm32l0538-disco/Makefile.include b/boards/stm32l0538-disco/Makefile.include index 16d7ebec80..0f0dcc4c3a 100644 --- a/boards/stm32l0538-disco/Makefile.include +++ b/boards/stm32l0538-disco/Makefile.include @@ -9,3 +9,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) PROGRAMMER ?= openocd OPENOCD_DEBUG_ADAPTER ?= stlink + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/stm32l476g-disco/Makefile.include b/boards/stm32l476g-disco/Makefile.include index c6d70cf420..a5887aac83 100644 --- a/boards/stm32l476g-disco/Makefile.include +++ b/boards/stm32l476g-disco/Makefile.include @@ -8,3 +8,6 @@ OPENOCD_DEBUG_ADAPTER ?= stlink # This board can become un-flashable after a hardfault, # use connect_assert_srst to always be able to flash or reset the board. OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/telosb/Makefile.include b/boards/telosb/Makefile.include index 0fde013039..89ae2fdc86 100644 --- a/boards/telosb/Makefile.include +++ b/boards/telosb/Makefile.include @@ -7,3 +7,5 @@ BAUD ?= 9600 # flash tool configuration PROGRAMMER ?= goodfet GOODFET_FLAGS ?= --telosb + +PROGRAMMERS_SUPPORTED += goodfet diff --git a/boards/thingy52/Makefile.include b/boards/thingy52/Makefile.include index 59dbf42556..a229253a2a 100644 --- a/boards/thingy52/Makefile.include +++ b/boards/thingy52/Makefile.include @@ -7,3 +7,6 @@ endif # use shared Makefile.include include $(RIOTBOARD)/common/nrf52/Makefile.include + +# openocd doesn't fully work with this board +PROGRAMMERS_SUPPORTED := $(filter-out openocd,$(PROGRAMMERS_SUPPORTED)) diff --git a/boards/ublox-c030-u201/Makefile.include b/boards/ublox-c030-u201/Makefile.include index d4255951f2..7d7dc1c749 100644 --- a/boards/ublox-c030-u201/Makefile.include +++ b/boards/ublox-c030-u201/Makefile.include @@ -6,3 +6,6 @@ PROGRAMMER ?= openocd OPENOCD_DEBUG_ADAPTER ?= stlink STLINK_VERSION ?= 2-1 + +# openocd programmer is supported +PROGRAMMERS_SUPPORTED += openocd diff --git a/boards/z1/Makefile.include b/boards/z1/Makefile.include index c228bb5c3b..09ba9d15e1 100644 --- a/boards/z1/Makefile.include +++ b/boards/z1/Makefile.include @@ -5,3 +5,5 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup flash tool PROGRAMMER ?= goodfet GOODFET_FLAGS ?= --z1 + +PROGRAMMERS_SUPPORTED += goodfet diff --git a/cpu/cortexm_common/Makefile.include b/cpu/cortexm_common/Makefile.include index eef3eb0092..9fd250d984 100644 --- a/cpu/cortexm_common/Makefile.include +++ b/cpu/cortexm_common/Makefile.include @@ -83,3 +83,6 @@ SLOT0_LEN ?= $(shell printf "0x%x" $$((($(ROM_LEN:%K=%*1024)-$(RIOTBOOT_LEN)) / SLOT1_LEN ?= $(SLOT0_LEN) SLOT0_LEN := $(SLOT0_LEN) SLOT1_LEN := $(SLOT1_LEN) + +# JLink is able to flash any ARM CPUs +PROGRAMMERS_SUPPORTED += jlink diff --git a/cpu/esp_common/Makefile.include b/cpu/esp_common/Makefile.include index b7d2c641e4..63109cc4ec 100644 --- a/cpu/esp_common/Makefile.include +++ b/cpu/esp_common/Makefile.include @@ -96,3 +96,6 @@ endif # All ESP are flashed using esptool PROGRAMMER ?= esptool + +# Add esptool in the list supported programmers +PROGRAMMERS_SUPPORTED += esptool diff --git a/makefiles/boards/sam0.inc.mk b/makefiles/boards/sam0.inc.mk index 2d2415a34c..04d0004486 100644 --- a/makefiles/boards/sam0.inc.mk +++ b/makefiles/boards/sam0.inc.mk @@ -18,6 +18,9 @@ endif # Default for these boards is to use a CMSIS-DAP programmer OPENOCD_DEBUG_ADAPTER ?= dap +# Increase the list of supported programmers +PROGRAMMERS_SUPPORTED += openocd edbg + # If no programmer is set, select a default programmer ifeq ($(PROGRAMMER),) # EDBG can only be used with a compatible Atmel programmer diff --git a/makefiles/boards/stm32.inc.mk b/makefiles/boards/stm32.inc.mk index c55374a2c7..d848177415 100644 --- a/makefiles/boards/stm32.inc.mk +++ b/makefiles/boards/stm32.inc.mk @@ -1,10 +1,5 @@ PROGRAMMER ?= openocd - -PROGRAMMERS_SUPPORTED := bmp dfu-util openocd stm32flash jlink - -ifeq (,$(filter $(PROGRAMMER), $(PROGRAMMERS_SUPPORTED))) - $(error Programmer $(PROGRAMMER) not supported) -endif +PROGRAMMERS_SUPPORTED += bmp dfu-util openocd stm32flash ifeq (bmp,$(PROGRAMMER)) # On Blackmagic Probe, the first ACM is used to connect to the gdb server, diff --git a/makefiles/info.inc.mk b/makefiles/info.inc.mk index 525388355e..ac2cfc4263 100644 --- a/makefiles/info.inc.mk +++ b/makefiles/info.inc.mk @@ -3,7 +3,9 @@ info-features-provided info-features-required \ info-features-used \ info-debug-variable-% info-toolchains-supported \ - check-toolchain-supported + check-toolchain-supported \ + info-programmers-supported \ + # info-objsize: @case "$(SORTROW)" in \ @@ -224,3 +226,6 @@ info-toolchains-supported: check-toolchain-supported: @exit $(if $(filter $(TOOLCHAIN),$(filter-out $(TOOLCHAINS_BLACKLIST),$(TOOLCHAINS_SUPPORTED))),0,1) + +info-programmers-supported: + @echo $(sort $(PROGRAMMERS_SUPPORTED)) diff --git a/makefiles/vars.inc.mk b/makefiles/vars.inc.mk index 6e48f53964..b460be459c 100644 --- a/makefiles/vars.inc.mk +++ b/makefiles/vars.inc.mk @@ -105,6 +105,8 @@ export HEXFILE # The 'intel hex' stripped result of the compilatio # DEBUGSERVER_FLAGS # The parameters to supply to DEBUGSERVER. # RESET # The command to call on "make reset", this command resets/reboots the target. # RESET_FLAGS # The parameters to supply to RESET. +# PROGRAMMER # The programmer to use when flashing, resetting or debugging +# PROGRAMMERS_SUPPORTED # The list of programmers supported by a board export DLCACHE # directory used to cache http downloads export DOWNLOAD_TO_FILE # Use `$(DOWNLOAD_TO_FILE) $(DESTINATION) $(URL)` to download `$(URL)` to `$(DESTINATION)`.