1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/makefiles/tools/avrdude.inc.mk
Marian Buschsieweke ba7815163c
Makefile*: Allow multiple external board dirs
- Add the new EXTERNAL_BOARD_DIRS variable that can contain a space separated
  list of folders containing external boards
- Introduce $(BOARDDIR) as shortcut for $(BOARDSDIR)/$(BOARD)
- Map the existing BOARDSDIR to the new approach
    - If BOARDSDIR is provided by the user, it will be added to
      EXTERNAL_BOARD_DIRS for backward compatibility. (And a warning is issued
      to encourage users migrating to EXTRA_BOARDS.)
    - BOARDSDIR is updated after the board is found to "$(BOARDDIR)/..".
        - Useful for `include $(BOARDSDIR)/common/external_common/Makefile.dep`
        - Provides backward compatibility
2020-04-29 18:32:39 +02:00

41 lines
1.6 KiB
Makefile

FLASHER = avrdude
DIST_PATH = $(BOARDDIR)/dist
AVARICE_PATH = $(RIOTTOOLS)/avarice
DEBUGSERVER_PORT = 4242
DEBUGSERVER = $(AVARICE_PATH)/debug_srv.sh
# Allow choosing debugger hardware via AVR_DEBUGDEVICE, default to Atmel ICE,
# which is compatible to all AVR devices and since the AVR Dragon is no longer
# produced, the least expensive option
AVR_DEBUGDEVICE ?= --edbg
AVR_DEBUGINTERFACE ?= usb
ifneq (,$(filter $(CPU),atmega328p))
# Use debugWIRE as protocol for debugging (ATmega328P does not support JTAG)
DEBUGPROTO := -w
else
# Use JTAG as protocol for debugging
DEBUGPROTO := -j $(AVR_DEBUGINTERFACE)
endif
DEBUGSERVER_FLAGS = "$(AVR_DEBUGDEVICE) $(DEBUGPROTO) :$(DEBUGSERVER_PORT)"
DEBUGGER_FLAGS = "-x $(AVARICE_PATH)/gdb.conf $(ELFFILE)"
DEBUGGER = "$(AVARICE_PATH)/debug.sh" $(DEBUGSERVER_FLAGS) $(AVARICE_PATH) $(DEBUGSERVER_PORT)
PROGRAMMER_FLAGS = -p $(subst atmega,m,$(CPU))
# Set flasher port only for programmers that require it
ifneq (,$(filter $(PROGRAMMER),arduino avr109 buspirate stk500v1 stk500v2 wiring))
# make the flasher port configurable (e.g. with atmelice the port is usb)
# defaults to terminal's serial port if not configured
PROGRAMMER_FLAGS += -P $(PROG_DEV)
endif
PROGRAMMER_FLAGS += $(FFLAGS_EXTRA)
# don't force to flash HEXFILE, but set it as default
FLASHFILE ?= $(HEXFILE)
FFLAGS += -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -U flash:w:$(FLASHFILE)
ifeq (,$(filter $(PROGRAMMER),arduino avr109 stk500v1 stk500v2 wiring))
# Use avrdude to trigger a reset, if programming is not done via UART and a
# bootloader.
RESET ?= $(FLASHER) -c $(PROGRAMMER) $(PROGRAMMER_FLAGS)
endif