From 305ca461acf37a5a2237afe7d2ce552ce25075a5 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 19 Jul 2020 11:50:52 +1000 Subject: [PATCH] Build: Update to latest DMBS version. --- LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile | 12 +++-- LUFA/Build/DMBS/DMBS/avrdude.md | 59 ++++++++++++++++--------- LUFA/Build/DMBS/DMBS/avrdude.mk | 34 +++++++++----- LUFA/Build/DMBS/DMBS/core.mk | 2 +- LUFA/Build/DMBS/DMBS/gcc.md | 11 ++++- LUFA/Build/DMBS/DMBS/gcc.mk | 23 +++++----- LUFA/Build/DMBS/DMBS/hid.mk | 11 ++--- 7 files changed, 96 insertions(+), 56 deletions(-) diff --git a/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile b/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile index 879eda8cf..1b1185b1d 100644 --- a/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile +++ b/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile @@ -17,17 +17,21 @@ SRC = $(TARGET).c CC_FLAGS = LD_FLAGS = OBJECT_FILES = InputEEData.o +OBJDIR = obj # Default target all: # Determine the AVR sub-architecture of the build main application object file -FIND_AVR_SUBARCH = avr$(shell avr-objdump -f $(TARGET).o | grep architecture | cut -d':' -f3 | cut -d',' -f1) +FIND_AVR_SUBARCH = avr$(shell avr-objdump -f $(OBJDIR)/$(TARGET).o | grep architecture | cut -d':' -f3 | cut -d',' -f1) # Create a linkable object file with the input binary EEPROM data stored in the FLASH section -InputEEData.o: InputEEData.bin $(TARGET).o $(MAKEFILE_LIST) - @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a object file \"$@\" - avr-objcopy -I binary -O elf32-avr -B $(call FIND_AVR_SUBARCH) --rename-section .data=.progmem.data,contents,alloc,readonly,data $< $@ +$(OBJDIR)/InputEEData.o: $(OBJDIR)/$(TARGET).o + @echo $(MSG_OBJCPY_CMD) Converting \"InputEEData.eep\" to a binary file \"InputEEData.bin\" + avr-objcopy -I ihex -O binary InputEEData.eep InputEEData.bin + + @echo $(MSG_OBJCPY_CMD) Converting \"InputEEData.bin\" to a object file \"InputEEData.o\" + avr-objcopy -I binary -O elf32-avr -B $(call FIND_AVR_SUBARCH) --rename-section .data=.progmem.data,contents,alloc,readonly,data InputEEData.bin $@ # Include LUFA build script makefiles include ../core.mk diff --git a/LUFA/Build/DMBS/DMBS/avrdude.md b/LUFA/Build/DMBS/DMBS/avrdude.md index 9d6a1bbf9..11ea46c02 100644 --- a/LUFA/Build/DMBS/DMBS/avrdude.md +++ b/LUFA/Build/DMBS/DMBS/avrdude.md @@ -48,7 +48,10 @@ The following targets are supported by this module: avrdude-fuses - Program the device fuses (lfuse, hfuse, efuse, lock bits). + + Program the device fuses (lfuse, hfuse, efuse, lock bits).
+ Requires AVRDUDE_LFUSE, AVRDUDE_HFUSE and AVRDUDE_LOCK variable set. AVRDUDE_EFUSE is optional. + avrdude @@ -96,6 +99,10 @@ be assumed. + + + + @@ -111,25 +118,30 @@ be assumed. - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +
AVRDUDE_MCUOverride the `MCU` variable for `avrdude`. On some controllers, `avrdude` expects another spelling than the compiler needs. Default is `MCU`.
AVRDUDE_PROGRAMMER Name of the programmer/debugger tool or bootloader to communicate with (e.g. `jtagicemkii`). Default is `jtagicemkii`.
AVRDUDE_MEMORY Memory space to program when executing the `avrdude` target (e.g. 'application` for an XMEGA device). Default is `flash`.
AVRDUDE_BAUDBaud rate to use when executing the `avrdude` target (e.g. '115200` for an Optiboot device). Default is empty.
AVRDUDE_HFUSEFuse setting to use when executing the `avrdude-hfuse` target (format: 0x??). Default is empty.
AVRDUDE_EFUSEFuse setting to use when executing the `avrdude-efuse` target (format: 0x??). Default is empty.
AVRDUDE_LFUSEFuse setting to use when executing the `avrdude-lfuse` target (format: 0x??). Default is empty.
AVRDUDE_LOCKBit bits setting to use when executing the `avrdude-lock` target (format: 0x??). Default is empty.
AVRDUDE_BAUDBaud rate to use when executing the `avrdude` target (e.g. '115200` for an Optiboot device). Default is empty.
AVRDUDE_BITCLKISP bit clock period in microseconds to use when executing the `avrdude` target (format: float). Must be minimum 4x longer than MCU clock period. Default is 1 us.
AVRDUDE_HFUSEFuse setting to use when executing the `avrdude-hfuse` target (format: 0x??). Default is empty.
AVRDUDE_EFUSEFuse setting to use when executing the `avrdude-efuse` target (format: 0x??). Default is empty.
AVRDUDE_LFUSEFuse setting to use when executing the `avrdude-lfuse` target (format: 0x??). Default is empty.
AVRDUDE_LOCKBit bits setting to use when executing the `avrdude-lock` target (format: 0x??). Default is empty.
@@ -167,5 +179,12 @@ this module. The changes to this module since its initial release are listed below, as of the DMBS version where the change was made. +### 20200412 +Made `AVRDUDE_EFUSE` optional for `avrdude-fuses` because not every AVR has this fuse. + +### 20171231 +Added `AVRDUDE_BAUD`, `AVRDUDE_HFUSE`, `AVRDUDE_EFUSE`, `AVRDUDE_LFUSE` and +`AVRDUDE_LOCK` optional variables. + ### 20160403 Initial release. diff --git a/LUFA/Build/DMBS/DMBS/avrdude.mk b/LUFA/Build/DMBS/DMBS/avrdude.mk index 7b5f64ac1..64cb44589 100644 --- a/LUFA/Build/DMBS/DMBS/avrdude.mk +++ b/LUFA/Build/DMBS/DMBS/avrdude.mk @@ -10,8 +10,8 @@ DMBS_BUILD_MODULES += AVRDUDE DMBS_BUILD_TARGETS += avrdude-lfuse avrdude-hfuse avrdude-efuse avrdude-lock avrdude-fuses DMBS_BUILD_TARGETS += avrdude avrdude-ee avrdude-all avrdude-all-ee DMBS_BUILD_MANDATORY_VARS += MCU TARGET -DMBS_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS AVRDUDE_MEMORY AVRDUDE_BAUD -DMBS_BUILD_OPTIONAL_VARS += AVRDUDE_LFUSE AVRDUDE_HFUSE AVRDUDE_EUSE AVRDUDE_LOCK +DMBS_BUILD_OPTIONAL_VARS += AVRDUDE_MCU AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS AVRDUDE_MEMORY AVRDUDE_BAUD +DMBS_BUILD_OPTIONAL_VARS += AVRDUDE_LFUSE AVRDUDE_HFUSE AVRDUDE_EFUSE AVRDUDE_LOCK AVRDUDE_BITCLK DMBS_BUILD_PROVIDED_VARS += DMBS_BUILD_PROVIDED_MACROS += @@ -20,6 +20,7 @@ DMBS_MODULE_PATH := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) include $(DMBS_MODULE_PATH)/core.mk # Default values of optionally user-supplied variables +AVRDUDE_MCU ?= $(MCU) AVRDUDE_PROGRAMMER ?= jtagicemkii AVRDUDE_PORT ?= usb AVRDUDE_FLAGS ?= @@ -29,10 +30,18 @@ AVRDUDE_HFUSE ?= AVRDUDE_EFUSE ?= AVRDUDE_LOCK ?= AVRDUDE_BAUD ?= +AVRDUDE_BITCLK ?= + +# Set avrdude-efuse-target as dependency for avrdude-fuses only if defined, because not every AVR has this fuse +ifneq ($(AVRDUDE_EFUSE),) + AVRDUDE_EFUSE_TARGET := avrdude-efuse +else + AVRDUDE_EFUSE_TARGET := +endif # Sanity check user supplied values $(foreach MANDATORY_VAR, $(DMBS_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) -$(call ERROR_IF_EMPTY, MCU) +$(call ERROR_IF_EMPTY, AVRDUDE_MCU) $(call ERROR_IF_EMPTY, TARGET) $(call ERROR_IF_EMPTY, AVRDUDE_PROGRAMMER) $(call ERROR_IF_EMPTY, AVRDUDE_PORT) @@ -41,43 +50,46 @@ $(call ERROR_IF_EMPTY, AVRDUDE_PORT) MSG_AVRDUDE_CMD := ' [AVRDUDE] :' # Construct base avrdude command flags -BASE_AVRDUDE_FLAGS := -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +BASE_AVRDUDE_FLAGS := -p $(AVRDUDE_MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) ifneq ($(AVRDUDE_BAUD),) BASE_AVRDUDE_FLAGS += -b $(AVRDUDE_BAUD) endif +ifneq ($(AVRDUDE_BITCLK),) + BASE_AVRDUDE_FLAGS += -B $(AVRDUDE_BITCLK) +endif # Programs in the target FLASH memory using AVRDUDE avrdude: $(TARGET).hex $(MAKEFILE_LIST) - @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" FLASH using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" + @echo $(MSG_AVRDUDE_CMD) Programming device \"$(AVRDUDE_MCU)\" FLASH using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" avrdude $(BASE_AVRDUDE_FLAGS) -U $(AVRDUDE_MEMORY):w:$< $(AVRDUDE_FLAGS) # Programs in the target EEPROM memory using AVRDUDE avrdude-ee: $(TARGET).eep $(MAKEFILE_LIST) - @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" EEPROM using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" + @echo $(MSG_AVRDUDE_CMD) Programming device \"$(AVRDUDE_MCU)\" EEPROM using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" avrdude $(BASE_AVRDUDE_FLAGS) -U eeprom:w:$< $(AVRDUDE_FLAGS) # Programs in the target fuses using AVRDUDE avrdude-lfuse: $(MAKEFILE_LIST) - @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" low fuse using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" + @echo $(MSG_AVRDUDE_CMD) Programming device \"$(AVRDUDE_MCU)\" low fuse using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" $(call ERROR_IF_EMPTY, AVRDUDE_LFUSE) avrdude $(BASE_AVRDUDE_FLAGS) -Ulfuse:w:$(AVRDUDE_LFUSE):m $(AVRDUDE_FLAGS) avrdude-hfuse: $(MAKEFILE_LIST) - @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" high fuse using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" + @echo $(MSG_AVRDUDE_CMD) Programming device \"$(AVRDUDE_MCU)\" high fuse using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" $(call ERROR_IF_EMPTY, AVRDUDE_HFUSE) avrdude $(BASE_AVRDUDE_FLAGS) -Uhfuse:w:$(AVRDUDE_HFUSE):m $(AVRDUDE_FLAGS) avrdude-efuse: $(MAKEFILE_LIST) - @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" extended fuse using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" + @echo $(MSG_AVRDUDE_CMD) Programming device \"$(AVRDUDE_MCU)\" extended fuse using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" $(call ERROR_IF_EMPTY, AVRDUDE_EFUSE) avrdude $(BASE_AVRDUDE_FLAGS) -Uefuse:w:$(AVRDUDE_EFUSE):m $(AVRDUDE_FLAGS) avrdude-lock: $(MAKEFILE_LIST) - @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" lock bits using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" + @echo $(MSG_AVRDUDE_CMD) Programming device \"$(AVRDUDE_MCU)\" lock bits using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" $(call ERROR_IF_EMPTY, AVRDUDE_LOCK) avrdude $(BASE_AVRDUDE_FLAGS) -Ulock:w:$(AVRDUDE_LOCK):m $(AVRDUDE_FLAGS) -avrdude-fuses: avrdude-lfuse avrdude-hfuse avrdude-efuse avrdude-lock +avrdude-fuses: avrdude-lfuse avrdude-hfuse $(AVRDUDE_EFUSE_TARGET) avrdude-lock avrdude-all: avrdude avrdude-fuses diff --git a/LUFA/Build/DMBS/DMBS/core.mk b/LUFA/Build/DMBS/DMBS/core.mk index d18d4ef48..c9d6e21b5 100644 --- a/LUFA/Build/DMBS/DMBS/core.mk +++ b/LUFA/Build/DMBS/DMBS/core.mk @@ -19,7 +19,7 @@ DMBS_BUILD_PROVIDED_MACROS += DMBS_CHECK_VERSION ERROR_IF_UNSET ERROR_IF_EMPTY E SHELL = /bin/sh # Current DMBS release version -DMBS_VERSION := 20171231 +DMBS_VERSION := 20200719 # Macro to check the DMBS version, aborts if the given DMBS version is below the current version DMBS_CHECK_VERSION ?= $(if $(filter-out 0, $(shell test $(DMBS_VERSION) -lt $(1); echo $$?)), , $(error DMBS version $(1) or newer required, current version is $(DMBS_VERSION))) diff --git a/LUFA/Build/DMBS/DMBS/gcc.md b/LUFA/Build/DMBS/DMBS/gcc.md index f7f3480db..760de24b3 100644 --- a/LUFA/Build/DMBS/DMBS/gcc.md +++ b/LUFA/Build/DMBS/DMBS/gcc.md @@ -117,7 +117,7 @@ be assumed. CPP_STANDARD - C++ language standard used when compiling C++ language source files. Default is `gnu++98` (C++98 standard with GNU extensions)./td> + C++ language standard used when compiling C++ language source files. Default is `gnu++11` (C++11 standard with GNU extensions)./td> F_CPU @@ -208,6 +208,15 @@ this module. The changes to this module since its initial release are listed below, as of the DMBS version where the change was made. +### 20180122 +Changed C++ default language standard from gnu++98 to gnu++11. + +### 20171231 +Added `-fpack-struct` for C files only (not C++). +Added `-fno-exceptions` and `-fno-threadsafe-statics` for C++ source files. +Added file-specific compilation flags. +Added `LTO` optional variable. + ### 20170426 Added `JUMP_TABLES` optional variable. diff --git a/LUFA/Build/DMBS/DMBS/gcc.mk b/LUFA/Build/DMBS/DMBS/gcc.mk index 73065dcec..24c9b070b 100644 --- a/LUFA/Build/DMBS/DMBS/gcc.mk +++ b/LUFA/Build/DMBS/DMBS/gcc.mk @@ -24,7 +24,7 @@ COMPILER_PATH ?= OPTIMIZATION ?= s F_CPU ?= C_STANDARD ?= gnu99 -CPP_STANDARD ?= gnu++98 +CPP_STANDARD ?= gnu++11 C_FLAGS ?= CPP_FLAGS ?= ASM_FLAGS ?= @@ -117,10 +117,7 @@ else ifneq ($(findstring $(ARCH), UC3),) endif BASE_CC_FLAGS += -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections BASE_CC_FLAGS += -I. -BASE_CC_FLAGS += -DARCH=ARCH_$(ARCH) -ifneq ($(F_CPU),) - BASE_CC_FLAGS += -DF_CPU=$(F_CPU)UL -endif +BASE_CC_FLAGS += -DARCH=ARCH_$(ARCH) -DDMBS_ARCH_$(ARCH) ifeq ($(LINKER_RELAXATIONS), Y) BASE_CC_FLAGS += -mrelax endif @@ -131,17 +128,16 @@ ifeq ($(JUMP_TABLES), N) # in a pseudo-random jump target. BASE_CC_FLAGS += -fno-jump-tables endif -ifeq ($(LTO), Y) - # Enable link time optimization to reduce overall flash size. - BASE_CC_FLAGS += -flto -fuse-linker-plugin - BASE_LD_FLAGS += -flto -fuse-linker-plugin -endif # Additional language specific compiler flags BASE_C_FLAGS := -x c -O$(OPTIMIZATION) -std=$(C_STANDARD) -Wstrict-prototypes BASE_CPP_FLAGS := -x c++ -O$(OPTIMIZATION) -std=$(CPP_STANDARD) -fno-exceptions -fno-threadsafe-statics BASE_ASM_FLAGS := -x assembler-with-cpp - +ifneq ($(F_CPU),) + BASE_C_FLAGS += -DF_CPU=$(F_CPU)UL + BASE_CPP_FLAGS += -DF_CPU=$(F_CPU)UL + BASE_ASM_FLAGS += -DF_CPU=$(F_CPU) +endif # Create a list of flags to pass to the linker BASE_LD_FLAGS := -lm -Wl,-Map=$(TARGET).map,--cref -Wl,--gc-sections ifeq ($(LINKER_RELAXATIONS), Y) @@ -152,6 +148,11 @@ ifneq ($(findstring $(ARCH), AVR8 XMEGA),) else ifneq ($(findstring $(ARCH), UC3),) BASE_LD_FLAGS += -mpart=$(MCU:at32%=%) --rodata-writable --direct-data endif +ifeq ($(LTO), Y) + # Enable link time optimization to reduce overall flash size. + BASE_CC_FLAGS += -flto -fuse-linker-plugin + BASE_LD_FLAGS += -flto -fuse-linker-plugin +endif # Determine flags to pass to the size utility based on its reported features (only invoke if size target required) # and on an architecture where this non-standard patch is available diff --git a/LUFA/Build/DMBS/DMBS/hid.mk b/LUFA/Build/DMBS/DMBS/hid.mk index d3195b2ab..392750480 100644 --- a/LUFA/Build/DMBS/DMBS/hid.mk +++ b/LUFA/Build/DMBS/DMBS/hid.mk @@ -27,9 +27,6 @@ MSG_HID_BOOTLOADER_CMD := ' [HID] :' MSG_OBJCPY_CMD := ' [OBJCPY] :' MSG_MAKE_CMD := ' [MAKE] :' -# Set MAKE variable if the environment does not already define it -MAKE ?= make - # Programs in the target FLASH memory using the HID_BOOTLOADER_CLI tool hid: $(TARGET).hex $(MAKEFILE_LIST) @echo $(MSG_HID_BOOTLOADER_CMD) Programming FLASH with hid_bootloader_cli using \"$<\" @@ -37,8 +34,7 @@ hid: $(TARGET).hex $(MAKEFILE_LIST) # Programs in the target EEPROM memory using the HID_BOOTLOADER_CLI tool (note: clears target FLASH memory) hid-ee: $(TARGET).eep $(MAKEFILE_LIST) - @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a binary file \"InputEEData.bin\" - avr-objcopy -I ihex -O binary $< $(DMBS_MODULE_PATH)/HID_EEPROM_Loader/InputEEData.bin + cp $< $(DMBS_MODULE_PATH)/HID_EEPROM_Loader/InputEEData.eep @echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\" $(MAKE) -C $(DMBS_MODULE_PATH)/HID_EEPROM_Loader/ MCU=$(MCU) clean hid @@ -48,9 +44,8 @@ teensy: $(TARGET).hex $(MAKEFILE_LIST) teensy_loader_cli -mmcu=$(MCU) -v $< # Programs in the target EEPROM memory using the TEENSY_BOOTLOADER_CLI tool (note: clears target FLASH memory) -teensy-ee: $(TARGET).hex $(MAKEFILE_LIST) - @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a binary file \"InputEEData.bin\" - avr-objcopy -I ihex -O binary $< $(DMBS_MODULE_PATH)/HID_EEPROM_Loader/InputEEData.bin +teensy-ee: $(TARGET).eep $(MAKEFILE_LIST) + cp $< $(DMBS_MODULE_PATH)/HID_EEPROM_Loader/InputEEData.eep @echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\" $(MAKE) -s -C $(DMBS_MODULE_PATH)/HID_EEPROM_Loader/ MCU=$(MCU) clean teensy -- 2.11.0