diff --git a/boards/arduino-due/Makefile.include b/boards/arduino-due/Makefile.include index 987a18f5f4ff..f1c5ca541c21 100644 --- a/boards/arduino-due/Makefile.include +++ b/boards/arduino-due/Makefile.include @@ -1,4 +1,3 @@ - # define the cpu used by the arduino due board export CPU = sam3x8e @@ -30,7 +29,7 @@ export PORT # define build specific options export CPU_USAGE = -mcpu=cortex-m3 export CFLAGS += -ggdb -g3 -std=gnu99 -Os -Wall -Wstrict-prototypes $(CPU_USAGE) -mlittle-endian -mthumb -mthumb-interwork -nostartfiles -export CFLAGS += -DREENTRANT_SYSCALLS_PROVIDED +export CFLAGS += -flto -ffunction-sections -fdata-sections -fno-builtin export ASFLAGS += -ggdb -g3 -mcpu=cortex-m4 $(FPU_USAGE) -mlittle-endian export LINKFLAGS += -g3 -ggdb -std=gnu99 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -static -lgcc -mthumb -mthumb-interwork -nostartfiles # linkerscript specified in cpu/Makefile.include @@ -38,11 +37,10 @@ export LINKFLAGS += -T$(LINKERSCRIPT) export OFLAGS += -O binary export FFLAGS += -e -w -v -b bin/$(BOARD)/$(APPLICATION).hex -# additional compiler and linker flags to enable newlib-nano and optimize for it -# CAREFUL: newlib-nano is not supported by the ubuntu arm-none-eabi- toolchain, so its disabled by default -#export CFLAGS += -flto -ffunction-sections -fdata-sections -fno-builtin -#export LINKFLAGS += -specs=nano.specs -lc -lnosys - +# use the nano-specs of the NewLib when available +ifeq ($(shell $(LINK) -specs=nano.specs -E - 2>/dev/null >/dev/null