Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards: move programmer includes in Makefile.include #15475

Merged
merged 3 commits into from
Nov 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ ifneq (,$(filter emulate,$(MAKECMDGOALS)))
-include $(RIOTMAKE)/tools/$(RIOT_EMULATOR).inc.mk
endif

# Include common programmer logic if available
-include $(RIOTMAKE)/tools/$(PROGRAMMER).inc.mk

# Assume GCC/GNU as supported toolchain if CPU's Makefile.include doesn't
# provide this macro
TOOLCHAINS_SUPPORTED ?= gnu
Expand Down
1 change: 0 additions & 1 deletion boards/6lowpan-clicker/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ ifeq ($(PROGRAMMER),pic32prog)
# * The triangle `▶` goes into the port number 1 (a hole with a square around it)
# opposite side of the JP1 ICSP text.
FLASHFILE ?= $(HEXFILE)
include $(RIOTMAKE)/tools/pic32prog.inc.mk
endif
2 changes: 0 additions & 2 deletions boards/adafruit-clue/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ ifeq ($(PROGRAMMER),adafruit-nrfutil)
TERM_DELAY = 2
TERMDEPS += term-delay
endif

include $(RIOTMAKE)/tools/adafruit-nrfutil.inc.mk
endif

term-delay:
Expand Down
2 changes: 0 additions & 2 deletions boards/arduino-nano-33-ble/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ ifeq ($(PROGRAMMER),bossa)
BOSSA_VERSION = nrf52
BOSSA_ARDUINO_PREFLASH = yes
PREFLASH_DELAY = 1

include $(RIOTMAKE)/tools/bossa.inc.mk
endif

TESTRUNNER_CONNECT_DELAY ?= 2
Expand Down
2 changes: 1 addition & 1 deletion boards/atmega1284p/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ATMEGA1284P_CLOCK ?=
# Allow overwriting programmer via env variables without affecting other boards
PROGRAMMER_BOARD_ATMEGA1284P ?= atmelice
# ICSP programmer to use for avrdude
PROGRAMMER ?= $(PROGRAMMER_BOARD_ATMEGA1284P)
AVRDUDE_PROGRAMMER ?= $(PROGRAMMER_BOARD_ATMEGA1284P)

ifneq (,$(ATMEGA1284P_CLOCK))
CFLAGS += -DCLOCK_CORECLOCK=$(ATMEGA1284P_CLOCK)
Expand Down
2 changes: 1 addition & 1 deletion boards/atmega256rfr2-xpro/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
BAUD ?= 115200
# Use EDBG (xplainedpro) programmer with avrdude
PROGRAMMER ?= xplainedpro
AVRDUDE_PROGRAMMER ?= xplainedpro

include $(RIOTBOARD)/common/atmega/Makefile.include
2 changes: 1 addition & 1 deletion boards/atmega328p/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ATMEGA328P_CLOCK ?=
# Allow overwriting programmer via env variables without affecting other boards
PROGRAMMER_BOARD_ATMEGA328P ?= usbtiny
# ICSP programmer to use for avrdude
PROGRAMMER ?= $(PROGRAMMER_BOARD_ATMEGA328P)
AVRDUDE_PROGRAMMER ?= $(PROGRAMMER_BOARD_ATMEGA328P)

ifneq (,$(ATMEGA328P_CLOCK))
CFLAGS += -DCLOCK_CORECLOCK=$(ATMEGA328P_CLOCK)
Expand Down
4 changes: 1 addition & 3 deletions boards/b-l072z-lrwan1/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# this board has an on-board ST-link adapter
PROGRAMMER ?= 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

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
4 changes: 1 addition & 3 deletions boards/b-l475e-iot01a/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# this board has an on-board ST-link adapter
PROGRAMMER ?= openocd
DEBUG_ADAPTER ?= stlink

# 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

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
1 change: 0 additions & 1 deletion boards/calliope-mini/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ else ifeq (pyocd,$(PROGRAMMER))
# PyOCD doesn't recognize automatically the board ID, so target type has to
# be passed explicitly
FLASH_TARGET_TYPE ?= -t nrf51
include $(RIOTMAKE)/tools/pyocd.inc.mk
endif

# include nrf51 boards common configuration
Expand Down
2 changes: 1 addition & 1 deletion boards/cc2650-launchpad/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# configure the flash tool
include $(RIOTMAKE)/tools/uniflash.inc.mk
PROGRAMMER ?= uniflash
2 changes: 1 addition & 1 deletion boards/cc2650stk/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# configure the flash tool
include $(RIOTMAKE)/tools/uniflash.inc.mk
PROGRAMMER ?= uniflash
2 changes: 1 addition & 1 deletion boards/common/arduino-due/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# setup flasher (using BOSSA)
PROGRAMMER ?= bossa
BOSSA_VERSION = 1.8
BOSSA_ARDUINO_PREFLASH = yes
include $(RIOTMAKE)/tools/bossa.inc.mk
1 change: 0 additions & 1 deletion boards/common/arduino-mkr/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ include $(RIOTMAKE)/tools/serial.inc.mk
ifeq ($(PROGRAMMER),jlink)
# in case J-Link is attached to SWD pins, use a plain CPU memory model
JLINK_DEVICE = $(MKR_JLINK_DEVICE)
include $(RIOTMAKE)/tools/jlink.inc.mk
endif

# Include all definitions for flashing with bossa over USB
Expand Down
21 changes: 11 additions & 10 deletions boards/common/atmega/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
INCLUDES += -I$(RIOTBOARD)/common/atmega/include

# If programmer is not set, set it based on the bootloader used
ifeq (,$(PROGRAMMER))
# Use avrdude programmer
PROGRAMMER ?= avrdude

# If avrdude specific programmer is not set, set it based on the bootloader used
ifeq (,$(AVRDUDE_PROGRAMMER))
ifeq (atmegaboot,$(BOOTLOADER))
PROGRAMMER = arduino
AVRDUDE_PROGRAMMER = arduino
BOOTLOADER_SIZE ?= 2048
BOOTLOADER_BAUD ?= 57600
endif

ifeq (optiboot,$(BOOTLOADER))
PROGRAMMER = arduino
AVRDUDE_PROGRAMMER = arduino
ifneq (,$(filter $(CPU), atmega128rfa1 atmega256rfr2 atmega1281 atmega1284p atmega2560))
# The minimum bootloader size on these CPUs is 1 KiB (so 512 Byte are wasted)
BOOTLOADER_SIZE ?= 1024
Expand All @@ -19,25 +22,25 @@ ifeq (,$(PROGRAMMER))
endif

ifeq (stk500v1,$(BOOTLOADER))
PROGRAMMER = stk500v1
AVRDUDE_PROGRAMMER = stk500v1
BOOTLOADER_SIZE ?= 8K
endif

ifeq (stk500v2,$(BOOTLOADER))
PROGRAMMER = stk500v2
AVRDUDE_PROGRAMMER = stk500v2
BOOTLOADER_SIZE ?= 8K
# Disable auto erase; erasing the flash is done implicitly by the bootloader
# and explicit erase is not supported
FFLAGS_EXTRA += -D
endif

ifeq (avr109,$(BOOTLOADER))
PROGRAMMER = avr109
AVRDUDE_PROGRAMMER = avr109
BOOTLOADER_SIZE ?= 4K
endif

ifeq (derfmega,$(BOOTLOADER))
PROGRAMMER = wiring
AVRDUDE_PROGRAMMER = wiring
BOOTLOADER_SIZE ?= 4K
endif

Expand All @@ -50,5 +53,3 @@ BOOTLOADER_SIZE ?= 0
ROM_RESERVED ?= $(BOOTLOADER_SIZE)

include $(RIOTMAKE)/tools/serial.inc.mk
# include avrdude flashing tool
include $(RIOTMAKE)/tools/avrdude.inc.mk
2 changes: 0 additions & 2 deletions boards/common/cc2538/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ endif

ifeq ($(PROGRAMMER),cc2538-bsl)
PROG_BAUD ?= 460800
include $(RIOTMAKE)/tools/cc2538-bsl.inc.mk
else ifeq ($(PROGRAMMER),jlink)
# Special flashing and reset scripts are required due to board hardware
FLASH_ADDR = 0x200000
JLINK_DEVICE = CC2538SF53
JLINK_IF = JTAG
JLINK_RESET_FILE = $(RIOTBOARD)/common/cc2538/dist/hw_reset.seg
include $(RIOTMAKE)/tools/jlink.inc.mk
endif

OFLAGS = --gap-fill 0xff
Expand Down
6 changes: 0 additions & 6 deletions boards/common/cc26x2_cc13x2/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ PROGRAMMER ?= uniflash

OPENOCD_CONFIG ?= $(RIOTBOARD)/common/cc26x2_cc13x2/dist/openocd.cfg
UNIFLASH_CONFIG ?= $(RIOTBOARD)/common/cc26x2_cc13x2/dist

ifeq ($(PROGRAMMER),uniflash)
include $(RIOTMAKE)/tools/uniflash.inc.mk
else ifeq ($(PROGRAMMER),openocd)
include $(RIOTMAKE)/tools/openocd.inc.mk
endif
10 changes: 5 additions & 5 deletions boards/common/frdm/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))

# Use OpenOCD by default
PROGRAMMER ?= openocd

# Use the shared OpenOCD configuration
# Using dap or jlink depends on which firmware the OpenSDA debugger is running
DEBUG_ADAPTER ?= dap
Expand All @@ -22,12 +25,9 @@ OPENOCD_CONFIG ?= $(RIOTBOARD)/common/frdm/dist/openocd-$(OPENOCD_KINETIS_FAMILY
# Check the flash configuration field before flashing
PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh

# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk

# 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

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk
6 changes: 3 additions & 3 deletions boards/common/iotlab/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*B)))
BAUD ?= 500000
include $(RIOTMAKE)/tools/serial.inc.mk

# Use openocd by default
PROGRAMMER ?= openocd

# Using connect_assert_srst removes errors on flash from invalid state
OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1

DEBUG_ADAPTER ?= iotlab

OPENOCD_CONFIG ?= $(RIOTBOARD)/common/iotlab/dist/openocd.cfg

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk

# add the common header files to the include path
INCLUDES += -I$(RIOTBOARD)/common/stm32/include
INCLUDES += -I$(RIOTBOARD)/common/iotlab/include
5 changes: 3 additions & 2 deletions boards/common/nrf51/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ ifneq (,$(filter nimble,$(USEPKG)))
CFLAGS += -DBOARD_NRF51_XTIMER_ALT
endif

# Use openocd by default
PROGRAMMER ?= openocd

ifeq ($(PROGRAMMER),openocd)
# use common openocd configuration for nrf51
OPENOCD_CONFIG = $(RIOTBOARD)/common/nrf51/dist/openocd.cfg
include $(RIOTMAKE)/tools/openocd.inc.mk
else ifeq ($(PROGRAMMER),jlink)
# setup JLink for flashing
JLINK_DEVICE = nrf51822
include $(RIOTMAKE)/tools/jlink.inc.mk
endif
4 changes: 0 additions & 4 deletions boards/common/nrf52/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ PROGRAMMER ?= jlink
ifeq (jlink,$(PROGRAMMER))
# setup JLink for flashing
JLINK_DEVICE = nrf52
include $(RIOTMAKE)/tools/jlink.inc.mk
else ifeq (openocd,$(PROGRAMMER))
ifneq (,$(filter $(BOARD),ruuvitag thingy52))
# openocd doesn't fully work with ruuvitag and thingy52
Expand All @@ -30,7 +29,4 @@ else ifeq (openocd,$(PROGRAMMER))
# build from source (master > 2018, August the 13rd) is required.
DEBUG_ADAPTER ?= jlink
OPENOCD_CONFIG = $(RIOTBOARD)/common/nrf52/dist/openocd.cfg
include $(RIOTMAKE)/tools/openocd.inc.mk
else ifeq (bmp,$(PROGRAMMER))
include $(RIOTMAKE)/tools/bmp.inc.mk
endif
2 changes: 0 additions & 2 deletions boards/common/particle-mesh/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ ifeq (1,$(PARTICLE_MONOFIRMWARE))
# Setting DFU_ARGS won't work as the implied --reset causes errors.
FFLAGS = -d 0x2B04:0xD00E -a 0 -s 0x30000:leave -D $(FLASHFILE)
PROGRAMMER = dfu-util
include $(RIOTMAKE)/tools/dfu.inc.mk
# If CDC-ACM is *not* enabled, any pre-flash resets will just not work -- but
# then again nothing can be done in that case anyway, and the preflash
# routines fall through without erring.
Expand All @@ -32,7 +31,6 @@ else
# The board is not recognized automatically by pyocd, so the CPU target
# option is passed explicitly
FLASH_TARGET_TYPE ?= -t nrf52840
include $(RIOTMAKE)/tools/pyocd.inc.mk
else ifeq (openocd,$(PROGRAMMER))
DEBUG_ADAPTER ?= dap
endif
Expand Down
2 changes: 0 additions & 2 deletions boards/common/samd21-arduino-bootloader/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ ifeq ($(PROGRAMMER),bossa)
# such bootloader.
ROM_OFFSET ?= 0x2000
BOSSA_ARDUINO_PREFLASH = yes

include $(RIOTMAKE)/tools/bossa.inc.mk
endif
6 changes: 0 additions & 6 deletions boards/common/silabs/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,3 @@ PROGRAMMER ?= jlink

JLINK_DEVICE ?= ${CPU_MODEL}
OPENOCD_CONFIG ?= board/efm32.cfg

ifeq ($(PROGRAMMER),jlink)
include $(RIOTMAKE)/tools/jlink.inc.mk
else ifeq ($(PROGRAMMER),openocd)
include $(RIOTMAKE)/tools/openocd.inc.mk
endif
2 changes: 1 addition & 1 deletion boards/ek-lm4f120xl/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
PROGRAMMER ?= openocd
1 change: 0 additions & 1 deletion boards/feather-m0/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ include $(RIOTMAKE)/tools/serial.inc.mk
ifeq ($(PROGRAMMER),jlink)
# in case J-Link is attached to SWD pins, use a plain CPU memory model
JLINK_DEVICE = atsamd21
include $(RIOTMAKE)/tools/jlink.inc.mk
endif

# Include all definitions for flashing with bossa over USB
Expand Down
2 changes: 1 addition & 1 deletion boards/fox/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
PROGRAMMER ?= openocd
3 changes: 1 addition & 2 deletions boards/hamilton/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# debugger config
PROGRAMMER ?= jlink
JLINK_DEVICE = atsamr21e18a
OBJDUMPFLAGS += --disassemble --source --disassembler-options=force-thumb
OFLAGS := --gap-fill 0xff

# use JLink Segger RTT by default
RIOT_TERMINAL ?= jlink
include $(RIOTMAKE)/tools/serial.inc.mk

include $(RIOTMAKE)/tools/jlink.inc.mk
2 changes: 1 addition & 1 deletion boards/hifive1/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# this board uses openocd with a custom reset command
PROGRAMMER ?= openocd
OPENOCD_CMD_RESET_RUN =-c _reset
include $(RIOTMAKE)/tools/openocd.inc.mk

# use our own openocd script to flash since HiFive1 has reset problems.
FLASHER = $(RIOTBASE)/boards/hifive1/dist/flasher.sh
2 changes: 0 additions & 2 deletions boards/hifive1b/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ ifeq (openocd,$(PROGRAMMER))
DEBUG_ADAPTER = jlink
OPENOCD_TRANSPORT = jtag
OPENOCD_PRE_FLASH_CMDS += "-c flash protect 0 1 last off"
include $(RIOTMAKE)/tools/openocd.inc.mk
else ifeq (jlink,$(PROGRAMMER))
# setup JLink for flashing
JLINK_DEVICE = FE310
JLINK_IF = JTAG
FLASH_ADDR = 0x20010000
include $(RIOTMAKE)/tools/jlink.inc.mk
else
$(error Programmer '$(PROGRAMMER)' not supported for board '$(BOARD)')
endif
Expand Down
2 changes: 1 addition & 1 deletion boards/i-nucleo-lrwan1/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ DEBUG_ADAPTER ?= stlink
OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
PROGRAMMER ?= openocd
2 changes: 1 addition & 1 deletion boards/ikea-tradfri/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))

# setup JLink for flashing
PROGRAMMER ?= jlink
JLINK_DEVICE = EFR32MG1PxxxF256
JLINK_PRE_FLASH = r
include $(RIOTMAKE)/tools/jlink.inc.mk

# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk
Loading