2018-05-14 19:27:10 +02:00
|
|
|
FLASHER = avrdude
|
2020-04-14 15:23:23 +02:00
|
|
|
DIST_PATH = $(BOARDDIR)/dist
|
2019-03-27 13:45:25 +01:00
|
|
|
AVARICE_PATH = $(RIOTTOOLS)/avarice
|
2018-05-14 19:27:10 +02:00
|
|
|
DEBUGSERVER_PORT = 4242
|
2019-03-27 13:45:25 +01:00
|
|
|
DEBUGSERVER = $(AVARICE_PATH)/debug_srv.sh
|
2019-03-27 15:59:29 +01:00
|
|
|
# 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)"
|
2019-03-27 13:45:25 +01:00
|
|
|
DEBUGGER_FLAGS = "-x $(AVARICE_PATH)/gdb.conf $(ELFFILE)"
|
|
|
|
DEBUGGER = "$(AVARICE_PATH)/debug.sh" $(DEBUGSERVER_FLAGS) $(AVARICE_PATH) $(DEBUGSERVER_PORT)
|
2018-05-14 19:27:10 +02:00
|
|
|
|
2019-02-20 21:59:06 +01:00
|
|
|
PROGRAMMER_FLAGS = -p $(subst atmega,m,$(CPU))
|
|
|
|
|
2019-02-20 21:40:40 +01:00
|
|
|
# Set flasher port only for programmers that require it
|
2017-07-03 19:23:28 +02:00
|
|
|
ifneq (,$(filter $(PROGRAMMER),arduino avr109 buspirate stk500v1 stk500v2 wiring))
|
2019-02-20 21:40:40 +01:00
|
|
|
# make the flasher port configurable (e.g. with atmelice the port is usb)
|
|
|
|
# defaults to terminal's serial port if not configured
|
2019-10-15 14:16:44 +02:00
|
|
|
PROGRAMMER_FLAGS += -P $(PROG_DEV)
|
2019-02-20 21:40:40 +01:00
|
|
|
endif
|
|
|
|
PROGRAMMER_FLAGS += $(FFLAGS_EXTRA)
|
2018-05-14 19:27:10 +02:00
|
|
|
|
|
|
|
# don't force to flash HEXFILE, but set it as default
|
|
|
|
FLASHFILE ?= $(HEXFILE)
|
2018-12-19 19:12:54 +01:00
|
|
|
FFLAGS += -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -U flash:w:$(FLASHFILE)
|
2019-11-25 14:39:25 +01:00
|
|
|
|
|
|
|
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
|