2019-02-17 14:05:48 +01:00
|
|
|
INCLUDES += -I$(RIOTBOARD)/common/atmega/include
|
2020-02-10 14:48:39 +01:00
|
|
|
|
2020-11-19 18:38:41 +01:00
|
|
|
# Use avrdude programmer
|
|
|
|
PROGRAMMER ?= avrdude
|
|
|
|
|
2021-02-11 15:16:13 +01:00
|
|
|
# Add avrdude as supported programmer
|
|
|
|
PROGRAMMERS_SUPPORTED += avrdude
|
|
|
|
|
2021-01-29 15:27:40 +01:00
|
|
|
# Use atmega board specific bootloader by default
|
|
|
|
ATMEGA_BOOTLOADER ?= $($(call uppercase_and_underscore,$(BOARD))_BOOTLOADER)
|
|
|
|
|
2020-11-19 18:38:41 +01:00
|
|
|
# If avrdude specific programmer is not set, set it based on the bootloader used
|
|
|
|
ifeq (,$(AVRDUDE_PROGRAMMER))
|
2021-01-29 15:27:40 +01:00
|
|
|
ifeq (atmegaboot,$(ATMEGA_BOOTLOADER))
|
2020-11-19 18:38:41 +01:00
|
|
|
AVRDUDE_PROGRAMMER = arduino
|
2021-01-29 15:27:40 +01:00
|
|
|
ATMEGA_BOOTLOADER_SIZE ?= 2048
|
|
|
|
ATMEGA_BOOTLOADER_BAUD ?= 57600
|
2020-02-10 14:48:39 +01:00
|
|
|
endif
|
|
|
|
|
2021-01-29 15:27:40 +01:00
|
|
|
ifeq (optiboot,$(ATMEGA_BOOTLOADER))
|
2020-11-19 18:38:41 +01:00
|
|
|
AVRDUDE_PROGRAMMER = arduino
|
2020-02-10 14:48:39 +01:00
|
|
|
ifneq (,$(filter $(CPU), atmega128rfa1 atmega256rfr2 atmega1281 atmega1284p atmega2560))
|
|
|
|
# The minimum bootloader size on these CPUs is 1 KiB (so 512 Byte are wasted)
|
2021-01-29 15:27:40 +01:00
|
|
|
ATMEGA_BOOTLOADER_SIZE ?= 1024
|
2020-02-10 14:48:39 +01:00
|
|
|
else
|
2021-01-29 15:27:40 +01:00
|
|
|
ATMEGA_BOOTLOADER_SIZE ?= 512
|
2020-02-10 14:48:39 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2021-01-29 15:27:40 +01:00
|
|
|
ifeq (stk500v1,$(ATMEGA_BOOTLOADER))
|
2020-11-19 18:38:41 +01:00
|
|
|
AVRDUDE_PROGRAMMER = stk500v1
|
2021-01-29 15:27:40 +01:00
|
|
|
ATMEGA_BOOTLOADER_SIZE ?= 8K
|
2020-02-10 14:48:39 +01:00
|
|
|
endif
|
|
|
|
|
2021-01-29 15:27:40 +01:00
|
|
|
ifeq (stk500v2,$(ATMEGA_BOOTLOADER))
|
2020-11-19 18:38:41 +01:00
|
|
|
AVRDUDE_PROGRAMMER = stk500v2
|
2021-01-29 15:27:40 +01:00
|
|
|
ATMEGA_BOOTLOADER_SIZE ?= 8K
|
2020-02-10 14:48:39 +01:00
|
|
|
# Disable auto erase; erasing the flash is done implicitly by the bootloader
|
|
|
|
# and explicit erase is not supported
|
|
|
|
FFLAGS_EXTRA += -D
|
|
|
|
endif
|
|
|
|
|
2021-01-29 15:27:40 +01:00
|
|
|
ifeq (avr109,$(ATMEGA_BOOTLOADER))
|
2020-11-19 18:38:41 +01:00
|
|
|
AVRDUDE_PROGRAMMER = avr109
|
2021-01-29 15:27:40 +01:00
|
|
|
ATMEGA_BOOTLOADER_SIZE ?= 4K
|
2020-02-10 14:48:39 +01:00
|
|
|
endif
|
|
|
|
|
2021-01-29 15:27:40 +01:00
|
|
|
ifeq (derfmega,$(ATMEGA_BOOTLOADER))
|
2020-11-19 18:38:41 +01:00
|
|
|
AVRDUDE_PROGRAMMER = wiring
|
2021-01-29 15:27:40 +01:00
|
|
|
ATMEGA_BOOTLOADER_SIZE ?= 4K
|
2020-02-10 14:48:39 +01:00
|
|
|
endif
|
|
|
|
|
2021-01-29 15:27:40 +01:00
|
|
|
ifneq (,$(ATMEGA_BOOTLOADER_BAUD))
|
|
|
|
FFLAGS_EXTRA += -b $(ATMEGA_BOOTLOADER_BAUD)
|
2020-02-10 14:48:39 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2021-01-29 15:27:40 +01:00
|
|
|
ATMEGA_BOOTLOADER_SIZE ?= 0
|
|
|
|
ROM_RESERVED ?= $(ATMEGA_BOOTLOADER_SIZE)
|