2016-03-21 09:25:42 +01:00
|
|
|
# Target architecture for the build. Use avr if you are unsure.
|
|
|
|
export TARGET_ARCH ?= avr
|
2014-07-15 12:08:52 +02:00
|
|
|
|
2017-02-02 20:08:06 +01:00
|
|
|
export CFLAGS_CPU = -mmcu=$(CPU) $(CFLAGS_FPU)
|
|
|
|
export CFLAGS_LINK = -ffunction-sections -fdata-sections -fno-builtin -fshort-enums
|
|
|
|
export CFLAGS_DBG ?= -ggdb -g3
|
|
|
|
export CFLAGS_OPT ?= -Os
|
2016-08-18 22:04:41 +02:00
|
|
|
|
2017-02-02 20:08:06 +01:00
|
|
|
export CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT)
|
|
|
|
export ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG)
|
|
|
|
export LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) -static -lgcc -e reset_handler -Wl,--gc-sections
|
2016-08-18 22:04:41 +02:00
|
|
|
|
2016-06-06 17:54:42 +02:00
|
|
|
# export the peripheral drivers to be linked into the final binary
|
2017-11-06 11:38:26 +01:00
|
|
|
export USEMODULE += atmega_common_periph
|
2017-01-09 18:36:14 +01:00
|
|
|
export USEMODULE += periph_common
|
2016-06-06 17:54:42 +02:00
|
|
|
|
2018-07-05 14:09:08 +02:00
|
|
|
# the atmel port uses stdio_uart
|
|
|
|
export USEMODULE += stdio_uart
|
2016-06-06 17:54:42 +02:00
|
|
|
|
2014-07-15 12:08:52 +02:00
|
|
|
# include module specific includes
|
2018-04-27 07:03:22 +02:00
|
|
|
export INCLUDES += -I$(RIOTCPU)/atmega_common/include -isystem$(RIOTCPU)/atmega_common/include/vendor
|
2017-02-02 20:08:06 +01:00
|
|
|
|
|
|
|
ifeq ($(LTO),1)
|
|
|
|
# avr-gcc <4.8.3 has a bug when using LTO which causes a warning to be printed always:
|
|
|
|
# '_vector_25' appears to be a misspelled signal handler [enabled by default]
|
|
|
|
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396
|
|
|
|
export LINKFLAGS += -Wno-error
|
|
|
|
endif
|
2018-08-15 13:12:54 +02:00
|
|
|
|
|
|
|
# Use ROM_LEN and RAM_LEN during link
|
|
|
|
# It is made optional until all boards are updated
|
|
|
|
LINKFLAGS += $(if $(ROM_LEN),$(LINKFLAGPREFIX)--defsym=__TEXT_REGION_LENGTH__=$(ROM_LEN))
|
|
|
|
LINKFLAGS += $(if $(RAM_LEN),$(LINKFLAGPREFIX)--defsym=__DATA_REGION_LENGTH__=$(RAM_LEN))
|
2018-08-15 12:26:35 +02:00
|
|
|
|
|
|
|
# Use newer linker script to have ROM/RAM configuration symbols in binutils<2.26
|
|
|
|
LDSCRIPT_COMPAT = $(if $(shell $(TARGET_ARCH)-ld --verbose | grep __TEXT_REGION_LENGTH__),,\
|
|
|
|
-T$(RIOTCPU)/$(CPU)/ldscripts_compat/avr_2.26.ld)
|
|
|
|
LINKFLAGS += $(LDSCRIPT_COMPAT)
|