Merge branch 'master' into dmbs
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 3 Apr 2016 01:34:34 +0000 (11:34 +1000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 3 Apr 2016 01:34:34 +0000 (11:34 +1000)
27 files changed:
LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/HID_EEPROM_Loader.c [new file with mode: 0644]
LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile [new file with mode: 0644]
LUFA/Build/DMBS/DMBS/License.txt [new file with mode: 0644]
LUFA/Build/DMBS/DMBS/atprogram.mk [new file with mode: 0644]
LUFA/Build/DMBS/DMBS/avrdude.mk [new file with mode: 0644]
LUFA/Build/DMBS/DMBS/core.mk [new file with mode: 0644]
LUFA/Build/DMBS/DMBS/cppcheck.mk [new file with mode: 0644]
LUFA/Build/DMBS/DMBS/dfu.mk [new file with mode: 0644]
LUFA/Build/DMBS/DMBS/doxygen.mk [new file with mode: 0644]
LUFA/Build/DMBS/DMBS/gcc.mk [new file with mode: 0644]
LUFA/Build/DMBS/DMBS/hid.mk [new file with mode: 0644]
LUFA/Build/DMBS/Readme.md [new file with mode: 0644]
LUFA/Build/DMBS/Template/Template.c [new file with mode: 0644]
LUFA/Build/DMBS/Template/makefile [new file with mode: 0644]
LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c [deleted file]
LUFA/Build/HID_EEPROM_Loader/makefile [deleted file]
LUFA/Build/lufa_atprogram.mk
LUFA/Build/lufa_avrdude.mk
LUFA/Build/lufa_build.mk
LUFA/Build/lufa_core.mk
LUFA/Build/lufa_cppcheck.mk
LUFA/Build/lufa_dfu.mk
LUFA/Build/lufa_doxygen.mk
LUFA/Build/lufa_hid.mk
LUFA/Build/lufa_sources.mk
LUFA/DoxygenPages/BuildSystem.txt
Projects/XPLAINBridge/makefile

diff --git a/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/HID_EEPROM_Loader.c b/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/HID_EEPROM_Loader.c
new file mode 100644 (file)
index 0000000..35ea2d7
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+             DMBS Build System
+      Released into the public domain.
+
+   dean [at] fourwalledcubicle [dot] com
+         www.fourwalledcubicle.com
+ */
+
+/** \file
+ *
+ *  Special application to extract an EEPROM image stored in FLASH memory, and
+ *  copy it to the device EEPROM. This application is designed to be used with
+ *  the HID build system module of DMBS to program the EEPROM of a target device
+ *  that uses the HID bootloader protocol, which does not have native EEPROM
+ *  programming support.
+ */
+
+#include <avr/io.h>
+#include <avr/eeprom.h>
+#include <avr/pgmspace.h>
+
+/* References to the binary EEPROM data linked in the AVR's FLASH memory space */
+extern const char _binary_InputEEData_bin_start[];
+extern const char _binary_InputEEData_bin_end[];
+extern const char _binary_InputEEData_bin_size[];
+
+/* Friendly names for the embedded binary data stored in FLASH memory space */
+#define InputEEData       _binary_InputEEData_bin_start
+#define InputEEData_size  ((int)_binary_InputEEData_bin_size)
+
+int main(void)
+{
+       /* Copy out the embedded EEPROM data from FLASH to EEPROM memory space */
+       for (uint16_t i = 0; i < InputEEData_size; i++)
+         eeprom_update_byte((uint8_t*)i, pgm_read_byte(&InputEEData[i]));
+
+       /* Infinite loop once complete */
+       for (;;);
+}
diff --git a/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile b/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile
new file mode 100644 (file)
index 0000000..879eda8
--- /dev/null
@@ -0,0 +1,35 @@
+#
+#            DMBS Build System
+#     Released into the public domain.
+#
+#  dean [at] fourwalledcubicle [dot] com
+#        www.fourwalledcubicle.com
+#
+
+# Run "make help" for target help.
+
+MCU          = atmega128
+ARCH         = AVR8
+F_CPU        = 1000000
+OPTIMIZATION = s
+TARGET       = HID_EEPROM_Loader
+SRC          = $(TARGET).c
+CC_FLAGS     =
+LD_FLAGS     =
+OBJECT_FILES = InputEEData.o
+
+# 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)
+
+# 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 $< $@
+
+# Include LUFA build script makefiles
+include ../core.mk
+include ../gcc.mk
+include ../hid.mk
diff --git a/LUFA/Build/DMBS/DMBS/License.txt b/LUFA/Build/DMBS/DMBS/License.txt
new file mode 100644 (file)
index 0000000..322c762
--- /dev/null
@@ -0,0 +1,32 @@
+             DMBS Build System
+      Released into the public domain.
+
+   dean [at] fourwalledcubicle [dot] com
+         www.fourwalledcubicle.com
+
+
+
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
diff --git a/LUFA/Build/DMBS/DMBS/atprogram.mk b/LUFA/Build/DMBS/DMBS/atprogram.mk
new file mode 100644 (file)
index 0000000..de801b0
--- /dev/null
@@ -0,0 +1,103 @@
+#
+#            DMBS Build System
+#     Released into the public domain.
+#
+#  dean [at] fourwalledcubicle [dot] com
+#        www.fourwalledcubicle.com
+#
+
+DMBS_BUILD_MODULES         += ATPROGRAM
+DMBS_BUILD_TARGETS         += atprogram atprogram-ee
+DMBS_BUILD_MANDATORY_VARS  += MCU TARGET
+DMBS_BUILD_OPTIONAL_VARS   += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_PORT
+DMBS_BUILD_PROVIDED_VARS   +=
+DMBS_BUILD_PROVIDED_MACROS +=
+
+# -----------------------------------------------------------------------------
+#             DMBS ATPROGRAM Programmer Buildsystem Makefile Module.
+# -----------------------------------------------------------------------------
+# DESCRIPTION:
+#   Provides a set of targets to re-program a device using the Atmel atprogram
+#   utility in AVR Studio 5.x and Atmel Studio 6.0 onwards.
+# -----------------------------------------------------------------------------
+# TARGETS:
+#
+#    atprogram                 - Program target FLASH with application using
+#                                atprogram
+#    atprogram-ee              - Program target EEPROM with application data
+#                                using atprogram
+#
+# MANDATORY PARAMETERS:
+#
+#    MCU                       - Microcontroller device model name
+#    TARGET                    - Application name
+#
+# OPTIONAL PARAMETERS:
+#
+#    ATPROGRAM_PROGRAMMER      - Name of programming hardware to use
+#    ATPROGRAM_INTERFACE       - Name of programming interface to use
+#    ATPROGRAM_PORT            - Name of communication port to use
+#
+# PROVIDED VARIABLES:
+#
+#    (None)
+#
+# PROVIDED MACROS:
+#
+#    (None)
+#
+# -----------------------------------------------------------------------------
+
+SHELL = /bin/sh
+
+ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
+ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
+ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
+
+# Default values of optionally user-supplied variables
+ATPROGRAM_PROGRAMMER ?= jtagice3
+ATPROGRAM_INTERFACE  ?= jtag
+ATPROGRAM_PORT       ?=
+
+# 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, TARGET)
+$(call ERROR_IF_EMPTY, ATPROGRAM_PROGRAMMER)
+$(call ERROR_IF_EMPTY, ATPROGRAM_INTERFACE)
+
+# Output Messages
+MSG_ATPROGRAM_CMD    := ' [ATPRGRM] :'
+
+# Construct base atprogram command flags
+BASE_ATPROGRAM_FLAGS := --tool $(ATPROGRAM_PROGRAMMER) --interface $(ATPROGRAM_INTERFACE) --device $(MCU)
+ifneq ($(ATPROGRAM_PORT),)
+   BASE_ATPROGRAM_FLAGS += --port $(ATPROGRAM_PORT)
+endif
+
+# Construct the flags to use for the various memory spaces
+ifeq ($(ARCH), AVR8)
+   ATPROGRAM_FLASH_FLAGS  := --chiperase --flash
+   ATPROGRAM_EEPROM_FLAGS := --eeprom
+else ifeq ($(ARCH), XMEGA)
+   ATPROGRAM_FLASH_FLAGS  := --erase --flash
+   ATPROGRAM_EEPROM_FLAGS := --eeprom
+else ifeq ($(ARCH), UC3)
+   ATPROGRAM_FLASH_FLAGS  := --erase
+   ATPROGRAM_EEPROM_FLAGS := --eeprom
+else
+   $(error Unsupported architecture "$(ARCH)")
+endif
+
+# Programs in the target FLASH memory using ATPROGRAM
+atprogram: $(TARGET).elf $(MAKEFILE_LIST)
+       @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\"
+       atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_FLASH_FLAGS) --file $<
+
+# Programs in the target EEPROM memory using ATPROGRAM
+atprogram-ee: $(TARGET).elf $(MAKEFILE_LIST)
+       @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\"
+       atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_EEPROM_FLAGS) --file $<
+
+# Phony build targets for this module
+.PHONY: $(DMBS_BUILD_TARGETS)
diff --git a/LUFA/Build/DMBS/DMBS/avrdude.mk b/LUFA/Build/DMBS/DMBS/avrdude.mk
new file mode 100644 (file)
index 0000000..d9b4df0
--- /dev/null
@@ -0,0 +1,86 @@
+#
+#            DMBS Build System
+#     Released into the public domain.
+#
+#  dean [at] fourwalledcubicle [dot] com
+#        www.fourwalledcubicle.com
+#
+
+DMBS_BUILD_MODULES         += AVRDUDE
+DMBS_BUILD_TARGETS         += avrdude avrdude-ee
+DMBS_BUILD_MANDATORY_VARS  += MCU TARGET
+DMBS_BUILD_OPTIONAL_VARS   += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS
+DMBS_BUILD_PROVIDED_VARS   +=
+DMBS_BUILD_PROVIDED_MACROS +=
+
+# -----------------------------------------------------------------------------
+#             DMBS AVRDUDE Programmer Buildsystem Makefile Module.
+# -----------------------------------------------------------------------------
+# DESCRIPTION:
+#   Provides a set of targets to re-program a device using the open source
+#   avr-dude utility.
+# -----------------------------------------------------------------------------
+# TARGETS:
+#
+#    avrdude                   - Program target FLASH with application using
+#                                avrdude
+#    avrdude-ee                - Program target EEPROM with application data
+#                                using avrdude
+#
+# MANDATORY PARAMETERS:
+#
+#    MCU                       - Microcontroller device model name
+#    TARGET                    - Application name
+#
+# OPTIONAL PARAMETERS:
+#
+#    AVRDUDE_PROGRAMMER        - Name of programming hardware to use
+#    AVRDUDE_PORT              - Name of communication port to use
+#    AVRDUDE_FLAGS             - Flags to pass to avr-dude
+#
+# PROVIDED VARIABLES:
+#
+#    (None)
+#
+# PROVIDED MACROS:
+#
+#    (None)
+#
+# -----------------------------------------------------------------------------
+
+SHELL = /bin/sh
+
+ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
+ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
+ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
+
+# Default values of optionally user-supplied variables
+AVRDUDE_PROGRAMMER ?= jtagicemkii
+AVRDUDE_PORT       ?= usb
+AVRDUDE_FLAGS      ?=
+
+# 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, TARGET)
+$(call ERROR_IF_EMPTY, AVRDUDE_PROGRAMMER)
+$(call ERROR_IF_EMPTY, AVRDUDE_PORT)
+
+# Output Messages
+MSG_AVRDUDE_CMD    := ' [AVRDUDE] :'
+
+# Construct base avrdude command flags
+BASE_AVRDUDE_FLAGS := -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+
+# 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)\"
+       avrdude $(BASE_AVRDUDE_FLAGS) -U flash: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)\"
+       avrdude $(BASE_AVRDUDE_FLAGS) -U eeprom:w:$< $(AVRDUDE_FLAGS)
+
+# Phony build targets for this module
+.PHONY: $(DMBS_BUILD_TARGETS)
diff --git a/LUFA/Build/DMBS/DMBS/core.mk b/LUFA/Build/DMBS/DMBS/core.mk
new file mode 100644 (file)
index 0000000..4199256
--- /dev/null
@@ -0,0 +1,180 @@
+#
+#            DMBS Build System
+#     Released into the public domain.
+#
+#  dean [at] fourwalledcubicle [dot] com
+#        www.fourwalledcubicle.com
+#
+
+DMBS_BUILD_MODULES         += CORE
+DMBS_BUILD_TARGETS         += help list_targets list_modules list_mandatory list_optional list_provided list_macros
+DMBS_BUILD_MANDATORY_VARS  +=
+DMBS_BUILD_OPTIONAL_VARS   +=
+DMBS_BUILD_PROVIDED_VARS   += DMBS_VERSION
+DMBS_BUILD_PROVIDED_MACROS +=
+
+# -----------------------------------------------------------------------------
+#               DMBS Core Build System Makefile Module.
+# -----------------------------------------------------------------------------
+# DESCRIPTION:
+#   Provides a set of core build targets for the DMBS build system
+# -----------------------------------------------------------------------------
+# TARGETS:
+#
+#    help                      - Build system help
+#    list_targets              - List all build targets
+#    list_modules              - List all build modules
+#    list_mandatory            - List all mandatory make variables required by
+#                                the included build modules of the application
+#    list_optional             - List all optional make variables required by
+#                                the included build modules of the application
+#    list_provided             - List all provided make variables from the
+#                                included build modules of the application
+#    list_macros               - List all provided make macros from the
+#                                included build modules of the application
+#
+# MANDATORY PARAMETERS:
+#
+#    (None)
+#
+# OPTIONAL PARAMETERS:
+#
+#    (None)
+#
+# PROVIDED VARIABLES:
+#
+#    DMBS_VERSION
+#
+# PROVIDED MACROS:
+#
+#    (None)
+#
+# -----------------------------------------------------------------------------
+
+SHELL = /bin/sh
+
+
+# Current DMBS release version
+DMBS_VERSION = 0.3
+
+
+# Converts a given input to a printable output using "(None)" if no items are in the list
+CONVERT_TO_PRINTABLE           = $(if $(strip $(1)), $(1), (None))
+
+
+# Build sorted and filtered lists of the included build module data
+SORTED_DMBS_BUILD_MODULES      = $(sort $(DMBS_BUILD_MODULES))
+SORTED_DMBS_BUILD_TARGETS      = $(sort $(DMBS_BUILD_TARGETS))
+SORTED_DMBS_MANDATORY_VARS     = $(sort $(DMBS_BUILD_MANDATORY_VARS))
+SORTED_DMBS_OPTIONAL_VARS      = $(filter-out $(SORTED_DMBS_MANDATORY_VARS), $(sort $(DMBS_BUILD_OPTIONAL_VARS)))
+SORTED_DMBS_PROVIDED_VARS      = $(sort $(DMBS_BUILD_PROVIDED_VARS))
+SORTED_DMBS_PROVIDED_MACROS    = $(sort $(DMBS_BUILD_PROVIDED_MACROS))
+
+# Create printable versions of the sorted build module data (use "(None)" when no data is available)
+PRINTABLE_DMBS_BUILD_MODULES   = $(call CONVERT_TO_PRINTABLE, $(SORTED_DMBS_BUILD_MODULES))
+PRINTABLE_DMBS_BUILD_TARGETS   = $(call CONVERT_TO_PRINTABLE, $(SORTED_DMBS_BUILD_TARGETS))
+PRINTABLE_DMBS_MANDATORY_VARS  = $(call CONVERT_TO_PRINTABLE, $(SORTED_DMBS_MANDATORY_VARS))
+PRINTABLE_DMBS_OPTIONAL_VARS   = $(call CONVERT_TO_PRINTABLE, $(SORTED_DMBS_OPTIONAL_VARS))
+PRINTABLE_DMBS_PROVIDED_VARS   = $(call CONVERT_TO_PRINTABLE, $(SORTED_DMBS_PROVIDED_VARS))
+PRINTABLE_DMBS_PROVIDED_MACROS = $(call CONVERT_TO_PRINTABLE, $(SORTED_DMBS_PROVIDED_MACROS))
+
+help:
+       @echo "==================================================================="
+       @echo "                       The DMBS Build System                       "
+       @echo "         By Dean Camera { dean @ fourwalledcubicle . com }         "
+       @echo "==================================================================="
+       @echo "DESCRIPTION:                                                       "
+       @echo " This build system is a set of makefile modules for (GNU) Make, to "
+       @echo " provide a simple system for building DMBS powered applications.   "
+       @echo " Each makefile module can be included from within a user makefile, "
+       @echo " to expose the build rules documented in the comments at the top of"
+       @echo " each build module.                                                "
+       @echo "                                                                   "
+       @echo "USAGE:                                                             "
+       @echo " To execute a rule, define all variables indicated in the desired  "
+       @echo " module as a required parameter before including the build module  "
+       @echo " in your project makefile. Parameters marked as optional will      "
+       @echo " assume a default value in the modules if not user-assigned.       "
+       @echo "                                                                   "
+       @echo " By default the target output shows both a friendly summary, as    "
+       @echo " well as the actual invoked command. To suppress the output of the "
+       @echo " invoked commands and show only the friendly command output, run   "
+       @echo " make with the \"-s\" switch added before the target(s).           "
+       @echo "==================================================================="
+       @echo "                                                                   "
+       @echo "  Currently used build system modules in this application:         "
+       @echo "                                                                   "
+       @printf " %b" "$(PRINTABLE_DMBS_BUILD_MODULES:%=   - %\n)"
+       @echo "                                                                   "
+       @echo "                                                                   "
+       @echo "  Currently available build targets in this application:           "
+       @echo "                                                                   "
+       @printf " %b" "$(PRINTABLE_DMBS_BUILD_TARGETS:%=   - %\n)"
+       @echo "                                                                   "
+       @echo "                                                                   "
+       @echo "  Mandatory variables required by the selected build Modules:      "
+       @echo "                                                                   "
+       @printf " %b" "$(PRINTABLE_DMBS_MANDATORY_VARS:%=   - %\n)"
+       @echo "                                                                   "
+       @echo "                                                                   "
+       @echo "  Optional variables required by the selected build Modules:       "
+       @echo "                                                                   "
+       @printf " %b" "$(PRINTABLE_DMBS_OPTIONAL_VARS:%=   - %\n)"
+       @echo "                                                                   "
+       @echo "                                                                   "
+       @echo "  Variables provided by the selected build Modules:                "
+       @echo "                                                                   "
+       @printf " %b" "$(PRINTABLE_DMBS_PROVIDED_VARS:%=   - %\n)"
+       @echo "                                                                   "
+       @echo "                                                                   "
+       @echo "  Macros provided by the selected build Modules:                   "
+       @echo "                                                                   "
+       @printf " %b" "$(PRINTABLE_DMBS_PROVIDED_MACROS:%=   - %\n)"
+       @echo "                                                                   "
+       @echo "==================================================================="
+       @echo "          The DMBS Build System $(DMBS_VERSION) - Making MAKE easier."
+       @echo "==================================================================="
+
+# Lists build modules included by the project makefile, in alphabetical order
+list_modules:
+       @echo Currently Used Build System Modules:
+       @printf " %b" "$(PRINTABLE_DMBS_BUILD_MODULES:%=   - %\n)"
+
+# Lists build targets included by the project makefile, in alphabetical order
+list_targets:
+       @echo Currently Available Build Targets:
+       @printf " %b" "$(PRINTABLE_DMBS_BUILD_TARGETS:%=   - %\n)"
+
+# Lists mandatory variables that must be set by the project makefile, in alphabetical order
+list_mandatory:
+       @echo Mandatory Variables for Included Modules:
+       @printf " %b" "$(PRINTABLE_DMBS_MANDATORY_VARS:%=   - %\n)"
+
+# Lists optional variables that must be set by the project makefile, in alphabetical order
+list_optional:
+       @echo Optional Variables for Included Modules:
+       @printf " %b" "$(PRINTABLE_DMBS_OPTIONAL_VARS:%=   - %\n)"
+
+# Lists variables provided by the included build modules, in alphabetical order
+list_provided:
+       @echo Variables Provided by the Included Modules:
+       @printf " %b" "$(PRINTABLE_DMBS_PROVIDED_VARS:%=   - %\n)"
+
+# Lists macros provided by the included build modules, in alphabetical order
+list_macros:
+       @echo Macros Provided by the Included Modules:
+       @printf " %b" "$(PRINTABLE_DMBS_PROVIDED_MACROS:%=   - %\n)"
+
+# Debugging; "make print-VARNAME" will output the variable VARNAME's value
+print-%:
+       @printf "%s = %s" $(@:print-%=%) $($(@:print-%=%))
+
+# Disable default in-built make rules (those that are needed are explicitly
+# defined, and doing so has performance benefits when recursively building)
+ifeq ($(filter -r,$(MAKEFLAGS)),)
+  MAKEFLAGS += -r
+endif
+.SUFFIXES:
+
+# Phony build targets for this module
+.PHONY: $(DMBS_BUILD_TARGETS)
diff --git a/LUFA/Build/DMBS/DMBS/cppcheck.mk b/LUFA/Build/DMBS/DMBS/cppcheck.mk
new file mode 100644 (file)
index 0000000..2e0be12
--- /dev/null
@@ -0,0 +1,107 @@
+#
+#            DMBS Build System
+#     Released into the public domain.
+#
+#  dean [at] fourwalledcubicle [dot] com
+#        www.fourwalledcubicle.com
+#
+
+DMBS_BUILD_MODULES         += CPPCHECK
+DMBS_BUILD_TARGETS         += cppcheck cppcheck-config
+DMBS_BUILD_MANDATORY_VARS  += SRC
+DMBS_BUILD_OPTIONAL_VARS   += CPPCHECK_INCLUDES CPPCHECK_EXCLUDES CPPCHECK_MSG_TEMPLATE CPPCHECK_ENABLE \
+                              CPPCHECK_SUPPRESS CPPCHECK_FAIL_ON_WARNING CPPCHECK_QUIET CPPCHECK_FLAGS
+DMBS_BUILD_PROVIDED_VARS   +=
+DMBS_BUILD_PROVIDED_MACROS +=
+
+# -----------------------------------------------------------------------------
+#                DMBS CPPCheck Buildsystem Makefile Module.
+# -----------------------------------------------------------------------------
+# DESCRIPTION:
+#   Provides a set of targets to scan a project with the free "cppcheck" static
+#   analysis tool, to check for code errors at runtime
+#   (see http://cppcheck.sourceforge.net).
+# -----------------------------------------------------------------------------
+# TARGETS:
+#
+#    cppcheck                  - Scan the project with CPPCheck
+#    cppcheck-config           - Use CPPCheck to look for missing include files
+#
+# MANDATORY PARAMETERS:
+#
+#    SRC                       - List of source files to statically analyze
+#
+# OPTIONAL PARAMETERS:
+#
+#    CPPCHECK_INCLUDES         - Extra include paths to search for missing
+#                                header files
+#    CPPCHECK_EXCLUDES         - Source file paths to exclude checking (can be
+#                                a path fragment if desired)
+#    CPPCHECK_MSG_TEMPLATE     - Template for cppcheck error and warning output
+#    CPPCHECK_ENABLE           - General cppcheck category checks to enable
+#    CPPCHECK_SUPPRESS         - Specific cppcheck warnings to disable by ID
+#    CPPCHECK_FAIL_ON_WARNING  - Set to Y to fail the build on cppcheck
+#                                warnings, N to continue even if warnings occur
+#    CPPCHECK_QUIET            - Enable cppcheck verbose or quiet output mode
+#    CPPCHECK_FLAGS            - Additional flags to pass to cppcheck
+#
+# PROVIDED VARIABLES:
+#
+#    (None)
+#
+# PROVIDED MACROS:
+#
+#    (None)
+#
+# -----------------------------------------------------------------------------
+
+SHELL = /bin/sh
+
+ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
+ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
+ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
+
+# Default values of optionally user-supplied variables
+CPPCHECK_INCLUDES            ?=
+CPPCHECK_EXCLUDES            ?=
+CPPCHECK_MSG_TEMPLATE        ?= {file}:{line}: {severity} ({id}): {message}
+CPPCHECK_ENABLE              ?= all
+CPPCHECK_SUPPRESS            ?= variableScope missingInclude
+CPPCHECK_FAIL_ON_WARNING     ?= Y
+CPPCHECK_QUIET               ?= Y
+CPPCHECK_FLAGS               ?=
+
+# Sanity check user supplied values
+$(foreach MANDATORY_VAR, $(DMBS_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
+$(call ERROR_IF_EMPTY, SRC)
+$(call ERROR_IF_EMPTY, CPPCHECK_MSG_TEMPLATE)
+$(call ERROR_IF_EMPTY, CPPCHECK_ENABLE)
+$(call ERROR_IF_NONBOOL, CPPCHECK_FAIL_ON_WARNING)
+$(call ERROR_IF_NONBOOL, CPPCHECK_QUIET)
+
+# Build a default argument list for cppcheck
+BASE_CPPCHECK_FLAGS := --template="$(CPPCHECK_MSG_TEMPLATE)" $(CPPCHECK_INCLUDES:%=-I%) $(CPPCHECK_EXCLUDES:%=-i%) --inline-suppr --force --std=c99
+
+# Sanity check parameters and construct additional command line arguments to cppcheck
+ifeq ($(CPPCHECK_FAIL_ON_WARNING), Y)
+   BASE_CPPCHECK_FLAGS += --error-exitcode=1
+endif
+ifeq ($(CPPCHECK_QUIET), Y)
+   BASE_CPPCHECK_FLAGS += --quiet
+endif
+
+# Output Messages
+MSG_CPPCHECK_CMD         := ' [CPPCHECK]:'
+
+# Checks the CPPCheck configuration as used in the user project, to determine if any paths are missing or invalid
+cppcheck-config: $(MAKEFILE_LIST)
+       @echo $(MSG_CPPCHECK_CMD) Checking cppcheck configuration check on source files
+       cppcheck $(BASE_CPPCHECK_FLAGS) --check-config $(CPPCHECK_FLAGS) $(SRC)
+
+# Runs a static analysis using CPPCheck to determine if there are any issues
+cppcheck: $(MAKEFILE_LIST)
+       @echo $(MSG_CPPCHECK_CMD) Performing static analysis on source files
+       cppcheck $(BASE_CPPCHECK_FLAGS) --enable=$(CPPCHECK_ENABLE) $(CPPCHECK_SUPPRESS:%=--suppress=%) $(CPPCHECK_FLAGS) $(SRC)
+
+# Phony build targets for this module
+.PHONY: $(DMBS_BUILD_TARGETS)
diff --git a/LUFA/Build/DMBS/DMBS/dfu.mk b/LUFA/Build/DMBS/DMBS/dfu.mk
new file mode 100644 (file)
index 0000000..62365c1
--- /dev/null
@@ -0,0 +1,95 @@
+#
+#            DMBS Build System
+#     Released into the public domain.
+#
+#  dean [at] fourwalledcubicle [dot] com
+#        www.fourwalledcubicle.com
+#
+
+DMBS_BUILD_MODULES         += DFU
+DMBS_BUILD_TARGETS         += flip flip-ee dfu dfu-ee
+DMBS_BUILD_MANDATORY_VARS  += MCU TARGET
+DMBS_BUILD_OPTIONAL_VARS   +=
+DMBS_BUILD_PROVIDED_VARS   +=
+DMBS_BUILD_PROVIDED_MACROS +=
+
+# -----------------------------------------------------------------------------
+#               DMBS DFU Bootloader Buildsystem Makefile Module.
+# -----------------------------------------------------------------------------
+# DESCRIPTION:
+#   Provides a set of targets to re-program a device currently running a DFU
+#   class bootloader with a project's FLASH and EEPROM files.
+# -----------------------------------------------------------------------------
+# TARGETS:
+#
+#    flip                      - Program FLASH into target via Atmel FLIP
+#    flip-ee                   - Program EEPROM into target via Atmel FLIP
+#    dfu                       - Program FLASH into target via dfu-programmer
+#    dfu-ee                    - Program EEPROM into target via dfu-programmer
+#
+# MANDATORY PARAMETERS:
+#
+#    MCU                       - Microcontroller device model name
+#    TARGET                    - Application name
+#
+# OPTIONAL PARAMETERS:
+#
+#    (None)
+#
+# PROVIDED VARIABLES:
+#
+#    (None)
+#
+# PROVIDED MACROS:
+#
+#    (None)
+#
+# -----------------------------------------------------------------------------
+
+SHELL = /bin/sh
+
+ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
+ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
+ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
+
+# Sanity-check values of mandatory user-supplied variables
+$(foreach MANDATORY_VAR, $(DMBS_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
+$(call ERROR_IF_EMPTY, MCU)
+$(call ERROR_IF_EMPTY, TARGET)
+
+# Output Messages
+MSG_COPY_CMD   := ' [CP]      :'
+MSG_REMOVE_CMD := ' [RM]      :'
+MSG_DFU_CMD    := ' [DFU]     :'
+
+# Programs in the target FLASH memory using BATCHISP, the command line tool used by FLIP
+flip: $(TARGET).hex $(MAKEFILE_LIST)
+       @echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$<\"
+       batchisp -hardware usb -device $(MCU) -operation erase f loadbuffer $< program
+       batchisp -hardware usb -device $(MCU) -operation start reset 0
+
+# Programs in the target EEPROM memory using BATCHISP, the command line tool used by FLIP
+flip-ee: $(TARGET).eep $(MAKEFILE_LIST)
+       @echo $(MSG_COPY_CMD) Copying EEP file to temporary file \"$<.hex\"
+       cp $< $<.hex
+       @echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$<.hex\"
+       batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $<.hex program
+       batchisp -hardware usb -device $(MCU) -operation start reset 0
+       @echo $(MSG_REMOVE_CMD) Removing temporary file \"$<.hex\"
+       rm $<.hex
+
+# Programs in the target FLASH memory using DFU-PROGRAMMER
+dfu: $(TARGET).hex $(MAKEFILE_LIST)
+       @echo $(MSG_DFU_CMD) Programming FLASH with dfu-programmer using \"$<\"
+       dfu-programmer $(MCU) erase
+       dfu-programmer $(MCU) flash $<
+       dfu-programmer $(MCU) reset
+
+# Programs in the target EEPROM memory using DFU-PROGRAMMER
+dfu-ee: $(TARGET).eep $(MAKEFILE_LIST)
+       @echo $(MSG_DFU_CMD) Programming EEPROM with dfu-programmer using \"$<\"
+       dfu-programmer $(MCU) flash --eeprom $<
+       dfu-programmer $(MCU) reset
+
+# Phony build targets for this module
+.PHONY: $(DMBS_BUILD_TARGETS)
diff --git a/LUFA/Build/DMBS/DMBS/doxygen.mk b/LUFA/Build/DMBS/DMBS/doxygen.mk
new file mode 100644 (file)
index 0000000..bcde61b
--- /dev/null
@@ -0,0 +1,99 @@
+#
+#            DMBS Build System
+#     Released into the public domain.
+#
+#  dean [at] fourwalledcubicle [dot] com
+#        www.fourwalledcubicle.com
+#
+
+DMBS_BUILD_MODULES         += DOXYGEN
+DMBS_BUILD_TARGETS         += doxygen doxygen_upgrade doxygen_create
+DMBS_BUILD_MANDATORY_VARS  +=
+DMBS_BUILD_OPTIONAL_VARS   += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRIDE_PARAMS
+DMBS_BUILD_PROVIDED_VARS   +=
+DMBS_BUILD_PROVIDED_MACROS +=
+
+# -----------------------------------------------------------------------------
+#                 DMBS Doxygen Buildsystem Makefile Module.
+# -----------------------------------------------------------------------------
+# DESCRIPTION:
+#   Provides a set of targets to automatically build Doxygen documentation for
+#   a project (see www.doxygen.org).
+# -----------------------------------------------------------------------------
+# TARGETS:
+#
+#    doxygen                   - Build Doxygen Documentation
+#    doxygen_create            - Create a new Doxygen configuration file using
+#                                the latest template
+#    doxygen_upgrade           - Upgrade an existing Doxygen configuration file
+#                                to the latest template
+#
+# MANDATORY PARAMETERS:
+#
+#    (None)
+#
+# OPTIONAL PARAMETERS:
+#
+#    DOXYGEN_CONF              - Doxygen configuration filename
+#    DOXYGEN_FAIL_ON_WARNING   - Set to Y to fail the build on Doxygen warnings,
+#                                N to continue even if warnings occur
+#    DOXYGEN_OVERRIDE_PARAMS   - Parameters to override in the doxygen
+#                                configuration file
+# PROVIDED VARIABLES:
+#
+#    (None)
+#
+# PROVIDED MACROS:
+#
+#    (None)
+#
+# -----------------------------------------------------------------------------
+
+SHELL = /bin/sh
+
+ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
+ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
+ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
+
+# Default values of optionally user-supplied variables
+DOXYGEN_CONF            ?= doxyfile
+DOXYGEN_FAIL_ON_WARNING ?= Y
+DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES
+
+# Sanity check user supplied values
+$(foreach MANDATORY_VAR, $(DMBS_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
+$(call ERROR_IF_EMPTY, DOXYGEN_CONF)
+$(call ERROR_IF_NONBOOL, DOXYGEN_FAIL_ON_WARNING)
+
+# Output Messages
+MSG_DOXYGEN_CMD         := ' [DOXYGEN] :'
+
+# Determine Doxygen invocation command
+BASE_DOXYGEN_CMD := ( cat $(DOXYGEN_CONF) $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
+ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
+   DOXYGEN_CMD := if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi;
+else
+   DOXYGEN_CMD := $(BASE_DOXYGEN_CMD)
+endif
+
+# Error if the specified Doxygen configuration file does not exist
+$(DOXYGEN_CONF):
+       $(error Doxygen configuration file $@ does not exist)
+
+# Builds the project documentation using the specified configuration file and the DOXYGEN tool
+doxygen: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
+       @echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\"
+       $(DOXYGEN_CMD)
+
+# Upgrades an existing Doxygen configuration file to the latest Doxygen template, preserving settings
+doxygen_upgrade: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
+       @echo $(MSG_DOXYGEN_CMD) Upgrading configuration file \"$(DOXYGEN_CONF)\" with latest template
+       doxygen -u $(DOXYGEN_CONF) > /dev/null
+
+# Creates a new Doxygen configuration file with the set file name
+doxygen_create: $(MAKEFILE_LIST)
+       @echo $(MSG_DOXYGEN_CMD) Creating new configuration file \"$(DOXYGEN_CONF)\" with latest template
+       doxygen -g $(DOXYGEN_CONF) > /dev/null
+
+# Phony build targets for this module
+.PHONY: $(DMBS_BUILD_TARGETS)
diff --git a/LUFA/Build/DMBS/DMBS/gcc.mk b/LUFA/Build/DMBS/DMBS/gcc.mk
new file mode 100644 (file)
index 0000000..b9347a6
--- /dev/null
@@ -0,0 +1,331 @@
+#
+#            DMBS Build System
+#     Released into the public domain.
+#
+#  dean [at] fourwalledcubicle [dot] com
+#        www.fourwalledcubicle.com
+#
+
+DMBS_BUILD_MODULES         += GCC
+DMBS_BUILD_TARGETS         += size symbol-sizes all lib elf bin hex lss clean mostlyclean
+DMBS_BUILD_MANDATORY_VARS  += TARGET ARCH MCU SRC
+DMBS_BUILD_OPTIONAL_VARS   += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_FLAGS CPP_FLAGS ASM_FLAGS CC_FLAGS LD_FLAGS OBJDIR OBJECT_FILES DEBUG_TYPE DEBUG_LEVEL LINKER_RELAXATIONS COMPILER_PATH
+DMBS_BUILD_PROVIDED_VARS   +=
+DMBS_BUILD_PROVIDED_MACROS +=
+
+# -----------------------------------------------------------------------------
+#               DMBS GCC Compiler Buildsystem Makefile Module.
+# -----------------------------------------------------------------------------
+# DESCRIPTION:
+#   Provides a set of targets to build a C, C++ and/or Assembly application
+#   via the AVR-GCC compiler.
+# -----------------------------------------------------------------------------
+# TARGETS:
+#
+#    size                      - List built application size
+#    symbol-sizes              - Print application symbols from the binary ELF
+#                                file as a list sorted by size in bytes
+#    all                       - Build application and list size
+#    lib                       - Build and archive source files into a library
+#    elf                       - Build application ELF debug object file
+#    bin                       - Build application BIN binary object file
+#    hex                       - Build application HEX object file
+#    lss                       - Build application LSS assembly listing file
+#    clean                     - Remove all project intermediary and binary
+#                                output files
+#    mostlyclean               - Remove intermediary output files, but
+#                                preserve binaries
+#    <filename>.s              - Compile C/C++ source file into an assembly file
+#                                for manual code inspection
+#
+# MANDATORY PARAMETERS:
+#
+#    TARGET                    - Application name
+#    ARCH                      - Device architecture name
+#    MCU                       - Microcontroller device model name
+#    SRC                       - List of input source files (*.c, *.cpp, *.S)
+#
+# OPTIONAL PARAMETERS:
+#
+#    OPTIMIZATION              - Optimization level
+#    C_STANDARD                - C Language Standard to use
+#    CPP_STANDARD              - C++ Language Standard to use
+#    F_CPU                     - Speed of the CPU, in Hz
+#    C_FLAGS                   - Flags to pass to the C compiler only
+#    CPP_FLAGS                 - Flags to pass to the C++ compiler only
+#    ASM_FLAGS                 - Flags to pass to the assembler only
+#    CC_FLAGS                  - Common flags to pass to the C/C++ compiler and
+#                                assembler
+#    LD_FLAGS                  - Flags to pass to the linker
+#    LINKER_RELAXATIONS        - Enable or disable linker relaxations to
+#                                decrease binary size (note: can cause link
+#                                failures on systems with an unpatched binutils)
+#    OBJDIR                    - Directory for the output object and dependency
+#                                files; if equal to ".", the output files will
+#                                be generated in the same folder as the sources
+#    OBJECT_FILES              - Extra object files to link in to the binaries
+#    DEBUG_FORMAT              - Format of the debugging information to
+#                                generate in the compiled object files
+#    DEBUG_LEVEL               - Level the debugging information to generate in
+#                                the compiled object files
+#    COMPILER_PATH             - Location of the GCC toolchain to use
+#
+# PROVIDED VARIABLES:
+#
+#    (None)
+#
+# PROVIDED MACROS:
+#
+#    (None)
+#
+# -----------------------------------------------------------------------------
+
+SHELL = /bin/sh
+
+ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
+ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
+ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
+
+# Default values of optionally user-supplied variables
+COMPILER_PATH      ?=
+OPTIMIZATION       ?= s
+F_CPU              ?=
+C_STANDARD         ?= gnu99
+CPP_STANDARD       ?= gnu++98
+C_FLAGS            ?=
+CPP_FLAGS          ?=
+ASM_FLAGS          ?=
+CC_FLAGS           ?=
+OBJDIR             ?= obj
+OBJECT_FILES       ?=
+DEBUG_FORMAT       ?= dwarf-2
+DEBUG_LEVEL        ?= 2
+LINKER_RELAXATIONS ?= Y
+
+# 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, TARGET)
+$(call ERROR_IF_EMPTY, ARCH)
+$(call ERROR_IF_EMPTY, OPTIMIZATION)
+$(call ERROR_IF_EMPTY, C_STANDARD)
+$(call ERROR_IF_EMPTY, CPP_STANDARD)
+$(call ERROR_IF_EMPTY, OBJDIR)
+$(call ERROR_IF_EMPTY, DEBUG_FORMAT)
+$(call ERROR_IF_EMPTY, DEBUG_LEVEL)
+$(call ERROR_IF_NONBOOL, LINKER_RELAXATIONS)
+
+# Determine the utility prefix to use for the selected architecture
+ifeq ($(ARCH), AVR8)
+   CROSS        := $(COMPILER_PATH)avr
+else ifeq ($(ARCH), XMEGA)
+   CROSS        := $(COMPILER_PATH)avr
+else ifeq ($(ARCH), UC3)
+   CROSS        := $(COMPILER_PATH)avr32
+else
+   $(error Unsupported architecture "$(ARCH)")
+endif
+
+# Output Messages
+MSG_INFO_MESSAGE := ' [INFO]    :'
+MSG_COMPILE_CMD  := ' [GCC]     :'
+MSG_ASSEMBLE_CMD := ' [GAS]     :'
+MSG_NM_CMD       := ' [NM]      :'
+MSG_REMOVE_CMD   := ' [RM]      :'
+MSG_LINK_CMD     := ' [LNK]     :'
+MSG_ARCHIVE_CMD  := ' [AR]      :'
+MSG_SIZE_CMD     := ' [SIZE]    :'
+MSG_OBJCPY_CMD   := ' [OBJCPY]  :'
+MSG_OBJDMP_CMD   := ' [OBJDMP]  :'
+
+# Convert input source file list to differentiate them by type
+C_SOURCE   := $(filter %.c, $(SRC))
+CPP_SOURCE := $(filter %.cpp, $(SRC))
+ASM_SOURCE := $(filter %.S, $(SRC))
+
+# Create a list of unknown source file types, if any are found throw an error
+UNKNOWN_SOURCE := $(filter-out $(C_SOURCE) $(CPP_SOURCE) $(ASM_SOURCE), $(SRC))
+ifneq ($(UNKNOWN_SOURCE),)
+   $(error Unknown input source file formats: $(UNKNOWN_SOURCE))
+endif
+
+# Convert input source filenames into a list of required output object files
+OBJECT_FILES += $(addsuffix .o, $(basename $(SRC)))
+
+# Check if an output object file directory was specified instead of the input file location
+ifneq ($(OBJDIR),.)
+   # Prefix all the object filenames with the output object file directory path
+   OBJECT_FILES    := $(addprefix $(patsubst %/,%,$(OBJDIR))/, $(notdir $(OBJECT_FILES)))
+
+   # Check if any object file (without path) appears more than once in the object file list
+   ifneq ($(words $(sort $(OBJECT_FILES))), $(words $(OBJECT_FILES)))
+       $(error Cannot build with OBJDIR parameter set - one or more object file name is not unique)
+   endif
+
+   # Create the output object file directory if it does not exist and add it to the virtual path list
+   $(shell mkdir $(OBJDIR) 2> /dev/null)
+   VPATH           += $(dir $(SRC))
+endif
+
+# Create a list of dependency files from the list of object files
+DEPENDENCY_FILES := $(OBJECT_FILES:%.o=%.d)
+
+# Create a list of common flags to pass to the compiler/linker/assembler
+BASE_CC_FLAGS    := -pipe -g$(DEBUG_FORMAT) -g$(DEBUG_LEVEL)
+ifneq ($(findstring $(ARCH), AVR8 XMEGA),)
+   BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct
+else ifneq ($(findstring $(ARCH), UC3),)
+   BASE_CC_FLAGS += -mpart=$(MCU:at32%=%) -masm-addr-pseudos
+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
+ifeq ($(LINKER_RELAXATIONS), Y)
+BASE_CC_FLAGS += -mrelax
+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)
+BASE_ASM_FLAGS := -x assembler-with-cpp
+
+# 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)
+   BASE_LD_FLAGS += -Wl,--relax
+endif
+ifneq ($(findstring $(ARCH), AVR8 XMEGA),)
+   BASE_LD_FLAGS += -mmcu=$(MCU)
+else ifneq ($(findstring $(ARCH), UC3),)
+   BASE_LD_FLAGS += -mpart=$(MCU:at32%=%) --rodata-writable --direct-data
+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
+ifneq ($(ARCH), UC3)
+size: SIZE_MCU_FLAG    := $(shell $(CROSS)-size --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
+size: SIZE_FORMAT_FLAG := $(shell $(CROSS)-size --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
+endif
+
+# Pre-build informational target, to give compiler and project name information when building
+build_begin:
+       @echo $(MSG_INFO_MESSAGE) Begin compilation of project \"$(TARGET)\"...
+       @echo ""
+       @$(CROSS)-gcc --version
+
+# Post-build informational target, to project name information when building has completed
+build_end:
+       @echo $(MSG_INFO_MESSAGE) Finished building project \"$(TARGET)\".
+
+# Prints size information of a compiled application (FLASH, RAM and EEPROM usages)
+size: $(TARGET).elf
+       @echo $(MSG_SIZE_CMD) Determining size of \"$<\"
+       @echo ""
+       $(CROSS)-size $(SIZE_MCU_FLAG) $(SIZE_FORMAT_FLAG) $<
+
+# Prints size information on the symbols within a compiled application in decimal bytes
+symbol-sizes: $(TARGET).elf
+       @echo $(MSG_NM_CMD) Extracting \"$<\" symbols with decimal byte sizes
+       $(CROSS)-nm --size-sort --demangle --radix=d $<
+
+# Cleans intermediary build files, leaving only the compiled application files
+mostlyclean:
+       @echo $(MSG_REMOVE_CMD) Removing object files of \"$(TARGET)\"
+       rm -f $(OBJECT_FILES)
+       @echo $(MSG_REMOVE_CMD) Removing dependency files of \"$(TARGET)\"
+       rm -f $(DEPENDENCY_FILES)
+
+# Cleans all build files, leaving only the original source code
+clean: mostlyclean
+       @echo $(MSG_REMOVE_CMD) Removing output files of \"$(TARGET)\"
+       rm -f $(TARGET).elf $(TARGET).hex $(TARGET).bin $(TARGET).eep $(TARGET).map $(TARGET).lss $(TARGET).sym lib$(TARGET).a
+
+# Performs a complete build of the user application and prints size information afterwards
+all: build_begin elf hex bin lss sym size build_end
+
+# Helper targets, to build a specific type of output file without having to know the project target name
+lib: lib$(TARGET).a
+elf: $(TARGET).elf
+hex: $(TARGET).hex $(TARGET).eep
+bin: $(TARGET).bin
+lss: $(TARGET).lss
+sym: $(TARGET).sym
+
+# Default target to *create* the user application's specified source files; if this rule is executed by
+# make, the input source file doesn't exist and an error needs to be presented to the user
+$(SRC):
+       $(error Source file does not exist: $@)
+
+# Compiles an input C source file and generates an assembly listing for it
+%.s: %.c $(MAKEFILE_LIST)
+       @echo $(MSG_COMPILE_CMD) Generating assembly from C file \"$(notdir $<)\"
+       $(CROSS)-gcc -S $(BASE_CC_FLAGS) $(BASE_C_FLAGS) $(CC_FLAGS) $(C_FLAGS) $< -o $@
+
+# Compiles an input C++ source file and generates an assembly listing for it
+%.s: %.cpp $(MAKEFILE_LIST)
+       @echo $(MSG_COMPILE_CMD) Generating assembly from C++ file \"$(notdir $<)\"
+       $(CROSS)-gcc -S $(BASE_CC_FLAGS) $(BASE_CPP_FLAGS) $(CC_FLAGS) $(CPP_FLAGS) $< -o $@
+
+# Compiles an input C source file and generates a linkable object file for it
+$(OBJDIR)/%.o: %.c $(MAKEFILE_LIST)
+       @echo $(MSG_COMPILE_CMD) Compiling C file \"$(notdir $<)\"
+       $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_C_FLAGS) $(CC_FLAGS) $(C_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
+
+# Compiles an input C++ source file and generates a linkable object file for it
+$(OBJDIR)/%.o: %.cpp $(MAKEFILE_LIST)
+       @echo $(MSG_COMPILE_CMD) Compiling C++ file \"$(notdir $<)\"
+       $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_CPP_FLAGS) $(CC_FLAGS) $(CPP_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
+
+# Assembles an input ASM source file and generates a linkable object file for it
+$(OBJDIR)/%.o: %.S $(MAKEFILE_LIST)
+       @echo $(MSG_ASSEMBLE_CMD) Assembling \"$(notdir $<)\"
+       $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_ASM_FLAGS) $(CC_FLAGS) $(ASM_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
+
+# Generates a library archive file from the user application, which can be linked into other applications
+.PRECIOUS  : $(OBJECT_FILES)
+.SECONDARY : %.a
+%.a: $(OBJECT_FILES)
+       @echo $(MSG_ARCHIVE_CMD) Archiving object files into \"$@\"
+       $(CROSS)-ar rcs $@ $(OBJECT_FILES)
+
+# Generates an ELF debug file from the user application, which can be further processed for FLASH and EEPROM data
+# files, or used for programming and debugging directly
+.PRECIOUS  : $(OBJECT_FILES)
+.SECONDARY : %.elf
+%.elf: $(OBJECT_FILES)
+       @echo $(MSG_LINK_CMD) Linking object files into \"$@\"
+       $(CROSS)-gcc $^ -o $@ $(BASE_LD_FLAGS) $(LD_FLAGS)
+
+# Extracts out the loadable FLASH memory data from the project ELF file, and creates an Intel HEX format file of it
+%.hex: %.elf
+       @echo $(MSG_OBJCPY_CMD) Extracting HEX file data from \"$<\"
+       $(CROSS)-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@
+
+# Extracts out the loadable FLASH memory data from the project ELF file, and creates an Binary format file of it
+%.bin: %.elf
+       @echo $(MSG_OBJCPY_CMD) Extracting BIN file data from \"$<\"
+       $(CROSS)-objcopy -O binary -R .eeprom -R .fuse -R .lock -R .signature $< $@
+
+# Extracts out the loadable EEPROM memory data from the project ELF file, and creates an Intel HEX format file of it
+%.eep: %.elf
+       @echo $(MSG_OBJCPY_CMD) Extracting EEP file data from \"$<\"
+       $(CROSS)-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings $< $@ || exit 0
+
+# Creates an assembly listing file from an input project ELF file, containing interleaved assembly and source data
+%.lss: %.elf
+       @echo $(MSG_OBJDMP_CMD) Extracting LSS file data from \"$<\"
+       $(CROSS)-objdump -h -d -S -z $< > $@
+
+# Creates a symbol file listing the loadable and discarded symbols from an input project ELF file
+%.sym: %.elf
+       @echo $(MSG_NM_CMD) Extracting SYM file data from \"$<\"
+       $(CROSS)-nm -n $< > $@
+
+# Include build dependency files
+-include $(DEPENDENCY_FILES)
+
+# Phony build targets for this module
+.PHONY: build_begin build_end $(DMBS_BUILD_TARGETS)
diff --git a/LUFA/Build/DMBS/DMBS/hid.mk b/LUFA/Build/DMBS/DMBS/hid.mk
new file mode 100644 (file)
index 0000000..3f0d456
--- /dev/null
@@ -0,0 +1,96 @@
+#
+#            DMBS Build System
+#     Released into the public domain.
+#
+#  dean [at] fourwalledcubicle [dot] com
+#        www.fourwalledcubicle.com
+#
+
+DMBS_BUILD_MODULES         += HID
+DMBS_BUILD_TARGETS         += hid hid-ee teensy teensy-ee
+DMBS_BUILD_MANDATORY_VARS  += MCU TARGET
+DMBS_BUILD_OPTIONAL_VARS   +=
+DMBS_BUILD_PROVIDED_VARS   +=
+DMBS_BUILD_PROVIDED_MACROS +=
+
+# -----------------------------------------------------------------------------
+#               DMBS HID Bootloader Buildsystem Makefile Module.
+# -----------------------------------------------------------------------------
+# DESCRIPTION:
+#   Provides a set of targets to re-program a device currently running a HID
+#   class bootloader with a project's FLASH files.
+# -----------------------------------------------------------------------------
+# TARGETS:
+#
+#    hid                       - Program FLASH into target via
+#                                hid_bootloader_cli
+#    hid-ee                    - Program EEPROM into target via a temporary
+#                                AVR application and hid_bootloader_cli
+#    teensy                    - Program FLASH into target via
+#                                teensy_loader_cli
+#    teensy-ee                 - Program EEPROM into target via a temporary
+#                                AVR application and teensy_loader_cli
+#
+# MANDATORY PARAMETERS:
+#
+#    MCU                       - Microcontroller device model name
+#    TARGET                    - Application name
+#
+# OPTIONAL PARAMETERS:
+#
+#    (None)
+#
+# PROVIDED VARIABLES:
+#
+#    (None)
+#
+# PROVIDED MACROS:
+#
+#    (None)
+#
+# -----------------------------------------------------------------------------
+
+SHELL = /bin/sh
+
+DMBS_MODULE_PATH := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
+
+ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
+ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
+ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
+
+# Sanity-check values of mandatory user-supplied variables
+$(foreach MANDATORY_VAR, $(DMBS_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
+$(call ERROR_IF_EMPTY, MCU)
+$(call ERROR_IF_EMPTY, TARGET)
+
+# Output Messages
+MSG_HID_BOOTLOADER_CMD := ' [HID]     :'
+MSG_OBJCPY_CMD         := ' [OBJCPY]  :'
+MSG_MAKE_CMD           := ' [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 \"$<\"
+       hid_bootloader_cli -mmcu=$(MCU) -v $<
+
+# 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
+       @echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\"
+       $(MAKE) -C $(DMBS_MODULE_PATH)/HID_EEPROM_Loader/ MCU=$(MCU) clean hid
+
+# Programs in the target FLASH memory using the TEENSY_BOOTLOADER_CLI tool
+teensy: $(TARGET).hex $(MAKEFILE_LIST)
+       @echo $(MSG_HID_BOOTLOADER_CMD) Programming FLASH with teensy_loader_cli using \"$<\"
+       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
+       @echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\"
+       $(MAKE) -s -C $(DMBS_MODULE_PATH)/HID_EEPROM_Loader/ MCU=$(MCU) clean teensy
+
+# Phony build targets for this module
+.PHONY: $(DMBS_BUILD_TARGETS)
diff --git a/LUFA/Build/DMBS/Readme.md b/LUFA/Build/DMBS/Readme.md
new file mode 100644 (file)
index 0000000..f5533a9
--- /dev/null
@@ -0,0 +1,105 @@
+DMBS - Dean's Makefile Build System
+===================================
+
+
+Project Overview
+----------------
+
+GNU Make is scary, and it's tough to get the rules right sometimes. Many
+projects get by via simple copy-pasting of old makefiles, resulting in many
+redundant copies of the same old rules. DMBS aims to solve this by providing a
+simple modular set of makefiles which can be included by your project to quickly
+add various build functionality.
+
+This aims to replace the old WinAVR "mfile" makefile template, giving better
+functionality and much simpler user makefiles.
+
+
+Benefits:
+----------------
+
+Apart from much simpler, cleaner makefiles DMBS carries the aim of making the
+process of troubleshooting build issues a little easier. Lots can go wrong, so
+DMBS tries to sanity check its inputs wherever possible, and produce
+human-readable error messages. Forgotten to set a variable? Get a
+`Makefile {X} value not set.` message, rather than a possibly unrelated message.
+Have the wrong filename? See `Source file does not exist: {X}` rather than the
+infamous `No rule to make target {X}` message.
+
+
+Use:
+----------------
+
+A template user makefile is provided in the `Template` directory. DMBS modules
+are included via a GNU Make `include` directive. While the DMBS `core` module is
+always required, you can pick and choose what other modules you wish to add to
+your user project.
+
+Here's an example user makefile:
+
+       MCU          = atmega128
+       ARCH         = AVR8
+       F_CPU        = 8000000
+       OPTIMIZATION = s
+       TARGET       = Template
+       SRC          = $(TARGET).c
+       CC_FLAGS     =
+       LD_FLAGS     =
+
+       # Default target
+       all:
+
+       # Include DMBS build script makefiles
+       DMBS_PATH   ?= ../DMBS
+       include $(DMBS_PATH)/core.mk
+       include $(DMBS_PATH)/gcc.mk
+       include $(DMBS_PATH)/cppcheck.mk
+       include $(DMBS_PATH)/doxygen.mk
+       include $(DMBS_PATH)/dfu.mk
+       include $(DMBS_PATH)/hid.mk
+       include $(DMBS_PATH)/avrdude.mk
+       include $(DMBS_PATH)/atprogram.mk
+
+Each DMBS module can optionally supply one or more Make variables and macros,
+which you can reference in your user makefile. Additionally, modules can require
+one or more variables to be set by the user makefile, with (in some cases) sane
+defaults used if left out.
+
+As modules are added, you can get a list of available targets by simply typing
+`make help` from the command line. This will produce a formatted list of targets
+as well as mandatory and optional variables and exposed variables and macros.
+
+
+License
+----------------
+
+DMBS is released into the public domain, making is suitable for use everywhere,
+by everyone. Contributions are greatly appreciated however, in order to make
+DMBS better for everyone.
+
+The actual license text is as follows:
+
+       This is free and unencumbered software released into the public domain.
+
+       Anyone is free to copy, modify, publish, use, compile, sell, or
+       distribute this software, either in source code form or as a compiled
+       binary, for any purpose, commercial or non-commercial, and by any
+       means.
+
+       In jurisdictions that recognize copyright laws, the author or authors
+       of this software dedicate any and all copyright interest in the
+       software to the public domain. We make this dedication for the benefit
+       of the public at large and to the detriment of our heirs and
+       successors. We intend this dedication to be an overt act of
+       relinquishment in perpetuity of all present and future rights to this
+       software under copyright law.
+
+       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+       EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+       MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+       IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+       OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+       ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+       OTHER DEALINGS IN THE SOFTWARE.
+
+       For more information, please refer to <http://unlicense.org/>
diff --git a/LUFA/Build/DMBS/Template/Template.c b/LUFA/Build/DMBS/Template/Template.c
new file mode 100644 (file)
index 0000000..95d36f7
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+             DMBS Build System
+      Released into the public domain.
+
+   dean [at] fourwalledcubicle [dot] com
+         www.fourwalledcubicle.com
+ */
+
+int main(void)
+{
+       // Application code here.
+}
diff --git a/LUFA/Build/DMBS/Template/makefile b/LUFA/Build/DMBS/Template/makefile
new file mode 100644 (file)
index 0000000..d882923
--- /dev/null
@@ -0,0 +1,32 @@
+#
+#            DMBS Build System
+#     Released into the public domain.
+#
+#  dean [at] fourwalledcubicle [dot] com
+#        www.fourwalledcubicle.com
+#
+
+# Run "make help" for target help.
+
+MCU          = atmega128
+ARCH         = AVR8
+F_CPU        = 8000000
+OPTIMIZATION = s
+TARGET       = Template
+SRC          = $(TARGET).c
+CC_FLAGS     =
+LD_FLAGS     =
+
+# Default target
+all:
+
+# Include DMBS build script makefiles
+DMBS_PATH   ?= ../DMBS
+include $(DMBS_PATH)/core.mk
+include $(DMBS_PATH)/gcc.mk
+include $(DMBS_PATH)/cppcheck.mk
+include $(DMBS_PATH)/doxygen.mk
+include $(DMBS_PATH)/dfu.mk
+include $(DMBS_PATH)/hid.mk
+include $(DMBS_PATH)/avrdude.mk
+include $(DMBS_PATH)/atprogram.mk
diff --git a/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c b/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c
deleted file mode 100644 (file)
index b4a4065..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-             LUFA Library
-     Copyright (C) Dean Camera, 2016.
-
-  dean [at] fourwalledcubicle [dot] com
-           www.lufa-lib.org
-*/
-
-/*
-  Copyright 2016  Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
-  Permission to use, copy, modify, distribute, and sell this
-  software and its documentation for any purpose is hereby granted
-  without fee, provided that the above copyright notice appear in
-  all copies and that both that the copyright notice and this
-  permission notice and warranty disclaimer appear in supporting
-  documentation, and that the name of the author not be used in
-  advertising or publicity pertaining to distribution of the
-  software without specific, written prior permission.
-
-  The author disclaims all warranties with regard to this
-  software, including all implied warranties of merchantability
-  and fitness.  In no event shall the author be liable for any
-  special, indirect or consequential damages or any damages
-  whatsoever resulting from loss of use, data or profits, whether
-  in an action of contract, negligence or other tortious action,
-  arising out of or in connection with the use or performance of
-  this software.
-*/
-
-/** \file
- *
- *  Special application to extract an EEPROM image stored in FLASH memory, and
- *  copy it to the device EEPROM. This application is designed to be used with
- *  the HID build system module of LUFA to program the EEPROM of a target device
- *  that uses the HID bootloader protocol, which does not have native EEPROM
- *  programming support.
- */
-
-#include <avr/io.h>
-#include <avr/eeprom.h>
-#include <avr/pgmspace.h>
-
-/* References to the binary EEPROM data linked in the AVR's FLASH memory space */
-extern const char _binary_InputEEData_bin_start[];
-extern const char _binary_InputEEData_bin_end[];
-extern const char _binary_InputEEData_bin_size[];
-
-/* Friendly names for the embedded binary data stored in FLASH memory space */
-#define InputEEData       _binary_InputEEData_bin_start
-#define InputEEData_size  ((int)_binary_InputEEData_bin_size)
-
-int main(void)
-{
-       /* Copy out the embedded EEPROM data from FLASH to EEPROM memory space */
-       for (uint16_t i = 0; i < InputEEData_size; i++)
-         eeprom_update_byte((uint8_t*)i, pgm_read_byte(&InputEEData[i]));
-
-       /* Infinite loop once complete */
-       for (;;);
-}
diff --git a/LUFA/Build/HID_EEPROM_Loader/makefile b/LUFA/Build/HID_EEPROM_Loader/makefile
deleted file mode 100644 (file)
index 249c877..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#\r
-#             LUFA Library\r
-#     Copyright (C) Dean Camera, 2016.\r
-#\r
-#  dean [at] fourwalledcubicle [dot] com\r
-#           www.lufa-lib.org\r
-#\r
-# --------------------------------------\r
-#         LUFA Project Makefile.\r
-# --------------------------------------\r
-\r
-# Run "make help" for target help.\r
-\r
-MCU          = at90usb1287\r
-ARCH         = AVR8\r
-F_CPU        = 1000000\r
-F_USB        = $(F_CPU)\r
-OPTIMIZATION = s\r
-TARGET       = HID_EEPROM_Loader\r
-SRC          = $(TARGET).c\r
-LUFA_PATH    = ../../../LUFA\r
-CC_FLAGS     =\r
-LD_FLAGS     =\r
-OBJECT_FILES = InputEEData.o\r
-\r
-# Default target\r
-all:\r
-\r
-# Determine the AVR sub-architecture of the build main application object file\r
-FIND_AVR_SUBARCH = avr$(shell avr-objdump -f $(TARGET).o | grep architecture | cut -d':' -f3 | cut -d',' -f1)\r
-\r
-# Create a linkable object file with the input binary EEPROM data stored in the FLASH section\r
-InputEEData.o: InputEEData.bin $(TARGET).o $(MAKEFILE_LIST)\r
-       @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a object file \"$@\"\r
-       avr-objcopy -I binary -O elf32-avr -B $(call FIND_AVR_SUBARCH) --rename-section .data=.progmem.data,contents,alloc,readonly,data $< $@\r
-\r
-# Include LUFA build script makefiles\r
-include $(LUFA_PATH)/Build/lufa_core.mk\r
-include $(LUFA_PATH)/Build/lufa_build.mk\r
-include $(LUFA_PATH)/Build/lufa_cppcheck.mk\r
-include $(LUFA_PATH)/Build/lufa_doxygen.mk\r
-include $(LUFA_PATH)/Build/lufa_hid.mk\r
index e5ad33e..86988d1 100644 (file)
 #
 #             LUFA Library
-#     Copyright (C) Dean Camera, 2016.
+#     Copyright (C) Dean Camera, 2015.
 #
 #  dean [at] fourwalledcubicle [dot] com
 #           www.lufa-lib.org
 #
 
-LUFA_BUILD_MODULES         += ATPROGRAM
-LUFA_BUILD_TARGETS         += atprogram atprogram-ee
-LUFA_BUILD_MANDATORY_VARS  += MCU TARGET
-LUFA_BUILD_OPTIONAL_VARS   += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_PORT
-LUFA_BUILD_PROVIDED_VARS   +=
-LUFA_BUILD_PROVIDED_MACROS +=
-
-# -----------------------------------------------------------------------------
-#             LUFA ATPROGRAM Programmer Buildsystem Makefile Module.
-# -----------------------------------------------------------------------------
-# DESCRIPTION:
-#   Provides a set of targets to re-program a device using the Atmel atprogram
-#   utility in AVR Studio 5.x and Atmel Studio 6.0 onwards.
-# -----------------------------------------------------------------------------
-# TARGETS:
-#
-#    atprogram                 - Program target FLASH with application using
-#                                atprogram
-#    atprogram-ee              - Program target EEPROM with application data
-#                                using atprogram
-#
-# MANDATORY PARAMETERS:
-#
-#    MCU                       - Microcontroller device model name
-#    TARGET                    - Application name
-#
-# OPTIONAL PARAMETERS:
-#
-#    ATPROGRAM_PROGRAMMER      - Name of programming hardware to use
-#    ATPROGRAM_INTERFACE       - Name of programming interface to use
-#    ATPROGRAM_PORT            - Name of communication port to use
-#
-# PROVIDED VARIABLES:
-#
-#    (None)
-#
-# PROVIDED MACROS:
-#
-#    (None)
-#
-# -----------------------------------------------------------------------------
-
-SHELL = /bin/sh
-
-ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
-ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
-ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
-
-# Default values of optionally user-supplied variables
-ATPROGRAM_PROGRAMMER ?= atmelice
-ATPROGRAM_INTERFACE  ?= jtag
-ATPROGRAM_PORT       ?=
-
-# Sanity check user supplied values
-$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
-$(call ERROR_IF_EMPTY, MCU)
-$(call ERROR_IF_EMPTY, TARGET)
-$(call ERROR_IF_EMPTY, ATPROGRAM_PROGRAMMER)
-$(call ERROR_IF_EMPTY, ATPROGRAM_INTERFACE)
-
-# Output Messages
-MSG_ATPROGRAM_CMD    := ' [ATPRGRM] :'
-
-# Construct base atprogram command flags
-BASE_ATPROGRAM_FLAGS := --tool $(ATPROGRAM_PROGRAMMER) --interface $(ATPROGRAM_INTERFACE) --device $(MCU)
-ifneq ($(ATPROGRAM_PORT),)
-   BASE_ATPROGRAM_FLAGS += --port $(ATPROGRAM_PORT)
-endif
-
-# Construct the flags to use for the various memory spaces
-ifeq ($(ARCH), AVR8)
-   ATPROGRAM_FLASH_FLAGS  := --chiperase --flash
-   ATPROGRAM_EEPROM_FLAGS := --eeprom
-else ifeq ($(ARCH), XMEGA)
-   ATPROGRAM_FLASH_FLAGS  := --erase --flash
-   ATPROGRAM_EEPROM_FLAGS := --eeprom
-else ifeq ($(ARCH), UC3)
-   ATPROGRAM_FLASH_FLAGS  := --erase
-   ATPROGRAM_EEPROM_FLAGS := --eeprom
-else
-   $(error Unsupported architecture "$(ARCH)")
-endif
-
-# Programs in the target FLASH memory using ATPROGRAM
-atprogram: $(TARGET).elf $(MAKEFILE_LIST)
-       @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\"
-       atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_FLASH_FLAGS) --file $<
-
-# Programs in the target EEPROM memory using ATPROGRAM
-atprogram-ee: $(TARGET).elf $(MAKEFILE_LIST)
-       @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\"
-       atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_EEPROM_FLAGS) --file $<
-
-# Phony build targets for this module
-.PHONY: atprogram atprogram-ee
+DMBS_PATH := $(LUFA_PATH)/Build/DMBS/DMBS
+include $(DMBS_PATH)/atprogram.mk
index d035e07..649215f 100644 (file)
@@ -1,89 +1,10 @@
 #
 #             LUFA Library
-#     Copyright (C) Dean Camera, 2016.
+#     Copyright (C) Dean Camera, 2015.
 #
 #  dean [at] fourwalledcubicle [dot] com
 #           www.lufa-lib.org
 #
 
-LUFA_BUILD_MODULES         += AVRDUDE
-LUFA_BUILD_TARGETS         += avrdude avrdude-ee
-LUFA_BUILD_MANDATORY_VARS  += MCU TARGET
-LUFA_BUILD_OPTIONAL_VARS   += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS AVRDUDE_MEMORY
-LUFA_BUILD_PROVIDED_VARS   +=
-LUFA_BUILD_PROVIDED_MACROS +=
-
-# -----------------------------------------------------------------------------
-#             LUFA AVRDUDE Programmer Buildsystem Makefile Module.
-# -----------------------------------------------------------------------------
-# DESCRIPTION:
-#   Provides a set of targets to re-program a device using the open source
-#   avr-dude utility.
-# -----------------------------------------------------------------------------
-# TARGETS:
-#
-#    avrdude                   - Program target FLASH with application using
-#                                avrdude
-#    avrdude-ee                - Program target EEPROM with application data
-#                                using avrdude
-#
-# MANDATORY PARAMETERS:
-#
-#    MCU                       - Microcontroller device model name
-#    TARGET                    - Application name
-#
-# OPTIONAL PARAMETERS:
-#
-#    AVRDUDE_PROGRAMMER        - Name of programming hardware to use
-#    AVRDUDE_PORT              - Name of communication port to use
-#    AVRDUDE_FLAGS             - Flags to pass to avr-dude
-#    AVRDUDE_MEMORY            - Memory space to program application into (e.g.
-#                                "application" for an XMEGA DFU device)
-#
-# PROVIDED VARIABLES:
-#
-#    (None)
-#
-# PROVIDED MACROS:
-#
-#    (None)
-#
-# -----------------------------------------------------------------------------
-
-SHELL = /bin/sh
-
-ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
-ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
-ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
-
-# Default values of optionally user-supplied variables
-AVRDUDE_PROGRAMMER ?= jtagicemkii
-AVRDUDE_PORT       ?= usb
-AVRDUDE_FLAGS      ?=
-AVRDUDE_MEMORY     ?= flash
-
-# Sanity check user supplied values
-$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
-$(call ERROR_IF_EMPTY, MCU)
-$(call ERROR_IF_EMPTY, TARGET)
-$(call ERROR_IF_EMPTY, AVRDUDE_PROGRAMMER)
-$(call ERROR_IF_EMPTY, AVRDUDE_PORT)
-
-# Output Messages
-MSG_AVRDUDE_CMD    := ' [AVRDUDE] :'
-
-# Construct base avrdude command flags
-BASE_AVRDUDE_FLAGS := -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
-
-# 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)\"
-       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)\"
-       avrdude $(BASE_AVRDUDE_FLAGS) -U eeprom:w:$< $(AVRDUDE_FLAGS)
-
-# Phony build targets for this module
-.PHONY: avrdude avrdude-ee
+DMBS_PATH := $(LUFA_PATH)/Build/DMBS/DMBS
+include $(DMBS_PATH)/avrdude.mk
index 09ab182..d20493e 100644 (file)
@@ -1,78 +1,39 @@
 #
 #             LUFA Library
-#     Copyright (C) Dean Camera, 2016.
+#     Copyright (C) Dean Camera, 2015.
 #
 #  dean [at] fourwalledcubicle [dot] com
 #           www.lufa-lib.org
 #
 
-LUFA_BUILD_MODULES         += BUILD
-LUFA_BUILD_TARGETS         += size symbol-sizes all lib elf bin hex lss clean mostlyclean
-LUFA_BUILD_MANDATORY_VARS  += TARGET ARCH MCU SRC F_USB LUFA_PATH
-LUFA_BUILD_OPTIONAL_VARS   += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_FLAGS CPP_FLAGS ASM_FLAGS CC_FLAGS LD_FLAGS OBJDIR OBJECT_FILES DEBUG_TYPE DEBUG_LEVEL LINKER_RELAXATIONS COMPILER_PATH
-LUFA_BUILD_PROVIDED_VARS   +=
-LUFA_BUILD_PROVIDED_MACROS +=
+DMBS_BUILD_MODULES         +=
+DMBS_BUILD_TARGETS         +=
+DMBS_BUILD_MANDATORY_VARS  += LUFA_PATH ARCH F_USB
+DMBS_BUILD_OPTIONAL_VARS   += BOARD
+DMBS_BUILD_PROVIDED_VARS   +=
+DMBS_BUILD_PROVIDED_MACROS +=
 
 # -----------------------------------------------------------------------------
-#               LUFA GCC Compiler Buildsystem Makefile Module.
+#               LUFA Core Build Buildsystem Makefile Module.
 # -----------------------------------------------------------------------------
 # DESCRIPTION:
-#   Provides a set of targets to build a C, C++ and/or Assembly application
-#   via the AVR-GCC compiler.
+#   Subclass of the standard DMBS GCC build module, with LUFA specific
+#   extensions. This module provides the core build rules for the compilation
+#   of LUFA projects using GCC.
 # -----------------------------------------------------------------------------
 # TARGETS:
 #
-#    size                      - List built application size
-#    symbol-sizes              - Print application symbols from the binary ELF
-#                                file as a list sorted by size in bytes
-#    all                       - Build application and list size
-#    lib                       - Build and archive source files into a library
-#    elf                       - Build application ELF debug object file
-#    bin                       - Build application BIN binary object file
-#    hex                       - Build application HEX object file
-#    lss                       - Build application LSS assembly listing file
-#    clean                     - Remove all project intermediary and binary
-#                                output files
-#    mostlyclean               - Remove intermediary output files, but
-#                                preserve binaries
-#    <filename>.s              - Compile C/C++ source file into an assembly file
-#                                for manual code inspection
+#    (None)
 #
 # MANDATORY PARAMETERS:
 #
-#    TARGET                    - Application name
-#    ARCH                      - Device architecture name
-#    MCU                       - Microcontroller device model name
-#    SRC                       - List of input source files (*.c, *.cpp, *.S)
-#    F_USB                     - Speed of the input clock of the USB controller
-#                                in Hz
 #    LUFA_PATH                 - Path to the LUFA library core
+#    ARCH                      - Device architecture name
+#    F_USB                     - Speed of the USB core clock, in Hz
 #
 # OPTIONAL PARAMETERS:
 #
-#    BOARD                     - LUFA board hardware
-#    OPTIMIZATION              - Optimization level
-#    C_STANDARD                - C Language Standard to use
-#    CPP_STANDARD              - C++ Language Standard to use
-#    F_CPU                     - Speed of the CPU, in Hz
-#    C_FLAGS                   - Flags to pass to the C compiler only
-#    CPP_FLAGS                 - Flags to pass to the C++ compiler only
-#    ASM_FLAGS                 - Flags to pass to the assembler only
-#    CC_FLAGS                  - Common flags to pass to the C/C++ compiler and
-#                                assembler
-#    LD_FLAGS                  - Flags to pass to the linker
-#    LINKER_RELAXATIONS        - Enable or disable linker relaxations to
-#                                decrease binary size (note: can cause link
-#                                failures on systems with an unpatched binutils)
-#    OBJDIR                    - Directory for the output object and dependency
-#                                files; if equal to ".", the output files will
-#                                be generated in the same folder as the sources
-#    OBJECT_FILES              - Extra object files to link in to the binaries
-#    DEBUG_FORMAT              - Format of the debugging information to
-#                                generate in the compiled object files
-#    DEBUG_LEVEL               - Level the debugging information to generate in
-#                                the compiled object files
-#    COMPILER_PATH             - Location of the GCC toolchain to use
+#    BOARD                     - LUFA board drivers to use
 #
 # PROVIDED VARIABLES:
 #
@@ -90,262 +51,34 @@ ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error M
 ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
 ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
 
-# Default values of optionally user-supplied variables
-COMPILER_PATH      ?=
-BOARD              ?= NONE
-OPTIMIZATION       ?= s
-F_CPU              ?=
-C_STANDARD         ?= gnu99
-CPP_STANDARD       ?= gnu++98
-C_FLAGS            ?=
-CPP_FLAGS          ?=
-ASM_FLAGS          ?=
-CC_FLAGS           ?=
-OBJDIR             ?= .
-OBJECT_FILES       ?=
-DEBUG_FORMAT       ?= dwarf-2
-DEBUG_LEVEL        ?= 2
-LINKER_RELAXATIONS ?= Y
-
 # Sanity check user supplied values
-$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
-$(call ERROR_IF_EMPTY, MCU)
-$(call ERROR_IF_EMPTY, TARGET)
+$(call ERROR_IF_EMPTY, LUFA_PATH)
 $(call ERROR_IF_EMPTY, ARCH)
 $(call ERROR_IF_EMPTY, F_USB)
-$(call ERROR_IF_EMPTY, LUFA_PATH)
-$(call ERROR_IF_EMPTY, BOARD)
-$(call ERROR_IF_EMPTY, OPTIMIZATION)
-$(call ERROR_IF_EMPTY, C_STANDARD)
-$(call ERROR_IF_EMPTY, CPP_STANDARD)
-$(call ERROR_IF_EMPTY, OBJDIR)
-$(call ERROR_IF_EMPTY, DEBUG_FORMAT)
-$(call ERROR_IF_EMPTY, DEBUG_LEVEL)
-$(call ERROR_IF_NONBOOL, LINKER_RELAXATIONS)
+
+# Default values of optionally user-supplied variables
+BOARD ?= NONE
 
 # Determine the utility prefix to use for the selected architecture
-ifeq ($(ARCH), AVR8)
-   CROSS        := $(COMPILER_PATH)avr
-else ifeq ($(ARCH), XMEGA)
-   CROSS        := $(COMPILER_PATH)avr
+ifeq ($(ARCH), XMEGA)
    $(warning The XMEGA device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.)
 else ifeq ($(ARCH), UC3)
-   CROSS        := $(COMPILER_PATH)avr32
    $(warning The UC3 device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.)
-else
-   $(error Unsupported architecture "$(ARCH)")
-endif
-
-# Output Messages
-MSG_INFO_MESSAGE := ' [INFO]    :'
-MSG_COMPILE_CMD  := ' [GCC]     :'
-MSG_ASSEMBLE_CMD := ' [GAS]     :'
-MSG_NM_CMD       := ' [NM]      :'
-MSG_REMOVE_CMD   := ' [RM]      :'
-MSG_LINK_CMD     := ' [LNK]     :'
-MSG_ARCHIVE_CMD  := ' [AR]      :'
-MSG_SIZE_CMD     := ' [SIZE]    :'
-MSG_OBJCPY_CMD   := ' [OBJCPY]  :'
-MSG_OBJDMP_CMD   := ' [OBJDMP]  :'
-
-# Convert input source file list to differentiate them by type
-C_SOURCE   := $(filter %.c, $(SRC))
-CPP_SOURCE := $(filter %.cpp, $(SRC))
-ASM_SOURCE := $(filter %.S, $(SRC))
-
-# Create a list of unknown source file types, if any are found throw an error
-UNKNOWN_SOURCE := $(filter-out $(C_SOURCE) $(CPP_SOURCE) $(ASM_SOURCE), $(SRC))
-ifneq ($(UNKNOWN_SOURCE),)
-   $(error Unknown input source file formats: $(UNKNOWN_SOURCE))
 endif
 
-# Convert input source filenames into a list of required output object files
-OBJECT_FILES += $(addsuffix .o, $(basename $(SRC)))
-
-# Check if an output object file directory was specified instead of the input file location
-ifneq ($(OBJDIR),.)
-   # Prefix all the object filenames with the output object file directory path
-   OBJECT_FILES    := $(addprefix $(patsubst %/,%,$(OBJDIR))/, $(notdir $(OBJECT_FILES)))
-
-   # Check if any object file (without path) appears more than once in the object file list
-   ifneq ($(words $(sort $(OBJECT_FILES))), $(words $(OBJECT_FILES)))
-       $(error Cannot build with OBJDIR parameter set - one or more object file name is not unique)
-   endif
-
-   # Create the output object file directory if it does not exist and add it to the virtual path list
-   $(shell mkdir $(OBJDIR) 2> /dev/null)
-   VPATH           += $(dir $(SRC))
-endif
-
-# Create a list of dependency files from the list of object files
-DEPENDENCY_FILES := $(OBJECT_FILES:%.o=%.d)
-
-# Create a list of common flags to pass to the compiler/linker/assembler
-BASE_CC_FLAGS    := -pipe -g$(DEBUG_FORMAT) -g$(DEBUG_LEVEL)
-ifeq ($(ARCH), AVR8)
-   BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct
-else ifeq ($(ARCH), XMEGA)
-   BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct
-else ifeq ($(ARCH), UC3)
-   BASE_CC_FLAGS += -mpart=$(MCU:at32%=%) -masm-addr-pseudos
-endif
-BASE_CC_FLAGS += -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections
-BASE_CC_FLAGS += -I. -I$(patsubst %/,%,$(LUFA_PATH))/..
-BASE_CC_FLAGS += -DARCH=ARCH_$(ARCH) -DBOARD=BOARD_$(BOARD) -DF_USB=$(F_USB)UL
-ifneq ($(F_CPU),)
-   BASE_CC_FLAGS += -DF_CPU=$(F_CPU)UL
-endif
-ifeq ($(LINKER_RELAXATIONS), Y)
-BASE_CC_FLAGS += -mrelax
-endif
+# Common LUFA C/C++ includes/definitions
+LUFA_CXX_INCLUDES = -I. -I$(patsubst %/,%,$(LUFA_PATH))/..
+LUFA_CXX_DEFINES  = -DARCH=ARCH_$(ARCH) -DBOARD=BOARD_$(BOARD) -DF_USB=$(F_USB)UL
 
 # This flag is required for bootloaders as GCC will emit invalid jump table
 # assembly code for devices with large amounts of flash; the jump table target
 # is extracted from FLASH without using the correct ELPM instruction, resulting
 # in a pseudo-random jump target.
-BASE_CC_FLAGS += -fno-jump-tables
-
-# 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)
-BASE_ASM_FLAGS := -x assembler-with-cpp
-
-# 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)
-   BASE_LD_FLAGS += -Wl,--relax
-endif
-ifeq ($(ARCH), AVR8)
-   BASE_LD_FLAGS += -mmcu=$(MCU)
-else ifeq ($(ARCH), XMEGA)
-   BASE_LD_FLAGS += -mmcu=$(MCU)
-else ifeq ($(ARCH), UC3)
-   BASE_LD_FLAGS += -mpart=$(MCU:at32%=%) --rodata-writable --direct-data
-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
-ifneq ($(ARCH), UC3)
-size: SIZE_MCU_FLAG    := $(shell $(CROSS)-size --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
-size: SIZE_FORMAT_FLAG := $(shell $(CROSS)-size --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
-endif
-
-# Pre-build informational target, to give compiler and project name information when building
-build_begin:
-       @echo $(MSG_INFO_MESSAGE) Begin compilation of project \"$(TARGET)\"...
-       @echo ""
-       @$(CROSS)-gcc --version
-
-# Post-build informational target, to project name information when building has completed
-build_end:
-       @echo $(MSG_INFO_MESSAGE) Finished building project \"$(TARGET)\".
-
-# Prints size information of a compiled application (FLASH, RAM and EEPROM usages)
-size: $(TARGET).elf
-       @echo $(MSG_SIZE_CMD) Determining size of \"$<\"
-       @echo ""
-       $(CROSS)-size $(SIZE_MCU_FLAG) $(SIZE_FORMAT_FLAG) $<
-
-# Prints size information on the symbols within a compiled application in decimal bytes
-symbol-sizes: $(TARGET).elf
-       @echo $(MSG_NM_CMD) Extracting \"$<\" symbols with decimal byte sizes
-       $(CROSS)-nm --size-sort --demangle --radix=d $<
-
-# Cleans intermediary build files, leaving only the compiled application files
-mostlyclean:
-       @echo $(MSG_REMOVE_CMD) Removing object files of \"$(TARGET)\"
-       rm -f $(OBJECT_FILES)
-       @echo $(MSG_REMOVE_CMD) Removing dependency files of \"$(TARGET)\"
-       rm -f $(DEPENDENCY_FILES)
-
-# Cleans all build files, leaving only the original source code
-clean: mostlyclean
-       @echo $(MSG_REMOVE_CMD) Removing output files of \"$(TARGET)\"
-       rm -f $(TARGET).elf $(TARGET).hex $(TARGET).bin $(TARGET).eep $(TARGET).map $(TARGET).lss $(TARGET).sym lib$(TARGET).a
-
-# Performs a complete build of the user application and prints size information afterwards
-all: build_begin elf hex bin lss sym size build_end
-
-# Helper targets, to build a specific type of output file without having to know the project target name
-lib: lib$(TARGET).a
-elf: $(TARGET).elf
-hex: $(TARGET).hex $(TARGET).eep
-bin: $(TARGET).bin
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-
-# Default target to *create* the user application's specified source files; if this rule is executed by
-# make, the input source file doesn't exist and an error needs to be presented to the user
-$(SRC):
-       $(error Source file does not exist: $@)
-
-# Compiles an input C source file and generates an assembly listing for it
-%.s: %.c $(MAKEFILE_LIST)
-       @echo $(MSG_COMPILE_CMD) Generating assembly from C file \"$(notdir $<)\"
-       $(CROSS)-gcc -S $(BASE_CC_FLAGS) $(BASE_C_FLAGS) $(CC_FLAGS) $(C_FLAGS) $< -o $@
-
-# Compiles an input C++ source file and generates an assembly listing for it
-%.s: %.cpp $(MAKEFILE_LIST)
-       @echo $(MSG_COMPILE_CMD) Generating assembly from C++ file \"$(notdir $<)\"
-       $(CROSS)-gcc -S $(BASE_CC_FLAGS) $(BASE_CPP_FLAGS) $(CC_FLAGS) $(CPP_FLAGS) $< -o $@
-
-# Compiles an input C source file and generates a linkable object file for it
-$(OBJDIR)/%.o: %.c $(MAKEFILE_LIST)
-       @echo $(MSG_COMPILE_CMD) Compiling C file \"$(notdir $<)\"
-       $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_C_FLAGS) $(CC_FLAGS) $(C_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
-
-# Compiles an input C++ source file and generates a linkable object file for it
-$(OBJDIR)/%.o: %.cpp $(MAKEFILE_LIST)
-       @echo $(MSG_COMPILE_CMD) Compiling C++ file \"$(notdir $<)\"
-       $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_CPP_FLAGS) $(CC_FLAGS) $(CPP_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
-
-# Assembles an input ASM source file and generates a linkable object file for it
-$(OBJDIR)/%.o: %.S $(MAKEFILE_LIST)
-       @echo $(MSG_ASSEMBLE_CMD) Assembling \"$(notdir $<)\"
-       $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_ASM_FLAGS) $(CC_FLAGS) $(ASM_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@
-
-# Generates a library archive file from the user application, which can be linked into other applications
-.PRECIOUS  : $(OBJECT_FILES)
-.SECONDARY : %.a
-%.a: $(OBJECT_FILES)
-       @echo $(MSG_ARCHIVE_CMD) Archiving object files into \"$@\"
-       $(CROSS)-ar rcs $@ $(OBJECT_FILES)
-
-# Generates an ELF debug file from the user application, which can be further processed for FLASH and EEPROM data
-# files, or used for programming and debugging directly
-.PRECIOUS  : $(OBJECT_FILES)
-.SECONDARY : %.elf
-%.elf: $(OBJECT_FILES)
-       @echo $(MSG_LINK_CMD) Linking object files into \"$@\"
-       $(CROSS)-gcc $^ -o $@ $(BASE_LD_FLAGS) $(LD_FLAGS)
-
-# Extracts out the loadable FLASH memory data from the project ELF file, and creates an Intel HEX format file of it
-%.hex: %.elf
-       @echo $(MSG_OBJCPY_CMD) Extracting HEX file data from \"$<\"
-       $(CROSS)-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@
-
-# Extracts out the loadable FLASH memory data from the project ELF file, and creates an Binary format file of it
-%.bin: %.elf
-       @echo $(MSG_OBJCPY_CMD) Extracting BIN file data from \"$<\"
-       $(CROSS)-objcopy -O binary -R .eeprom -R .fuse -R .lock -R .signature $< $@
-
-# Extracts out the loadable EEPROM memory data from the project ELF file, and creates an Intel HEX format file of it
-%.eep: %.elf
-       @echo $(MSG_OBJCPY_CMD) Extracting EEP file data from \"$<\"
-       $(CROSS)-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings $< $@ || exit 0
-
-# Creates an assembly listing file from an input project ELF file, containing interleaved assembly and source data
-%.lss: %.elf
-       @echo $(MSG_OBJDMP_CMD) Extracting LSS file data from \"$<\"
-       $(CROSS)-objdump -h -d -S -z $< > $@
-
-# Creates a symbol file listing the loadable and discarded symbols from an input project ELF file
-%.sym: %.elf
-       @echo $(MSG_NM_CMD) Extracting SYM file data from \"$<\"
-       $(CROSS)-nm -n $< > $@
+LUFA_CXX_FLAGS    = -fno-jump-tables
 
-# Include build dependency files
--include $(DEPENDENCY_FILES)
+# LUFA specific standard build options
+C_FLAGS   += $(LUFA_CXX_INCLUDES) $(LUFA_CXX_DEFINES) $(LUFA_CXX_FLAGS)
+CPP_FLAGS += $(LUFA_CXX_INCLUDES) $(LUFA_CXX_DEFINES) $(LUFA_CXX_FLAGS)
 
-# Phony build targets for this module
-.PHONY: build_begin build_end size symbol-sizes lib elf hex lss clean mostlyclean
+DMBS_PATH := $(LUFA_PATH)/Build/DMBS/DMBS
+include $(DMBS_PATH)/gcc.mk
index 1b45c86..62cef90 100644 (file)
 #
 #             LUFA Library
-#     Copyright (C) Dean Camera, 2016.
+#     Copyright (C) Dean Camera, 2015.
 #
 #  dean [at] fourwalledcubicle [dot] com
 #           www.lufa-lib.org
 #
 
-LUFA_BUILD_MODULES         += CORE
-LUFA_BUILD_TARGETS         += help list_targets list_modules list_mandatory list_optional list_provided list_macros
-LUFA_BUILD_MANDATORY_VARS  +=
-LUFA_BUILD_OPTIONAL_VARS   +=
-LUFA_BUILD_PROVIDED_VARS   +=
-LUFA_BUILD_PROVIDED_MACROS +=
-
-# -----------------------------------------------------------------------------
-#               LUFA Core Build System Makefile Module.
-# -----------------------------------------------------------------------------
-# DESCRIPTION:
-#   Provides a set of core build targets for the LUFA build system
-# -----------------------------------------------------------------------------
-# TARGETS:
-#
-#    help                      - Build system help
-#    list_targets              - List all build targets
-#    list_modules              - List all build modules
-#    list_mandatory            - List all mandatory make variables required by
-#                                the included build modules of the application
-#    list_optional             - List all optional make variables required by
-#                                the included build modules of the application
-#    list_provided             - List all provided make variables from the
-#                                included build modules of the application
-#    list_macros               - List all provided make macros from the
-#                                included build modules of the application
-#
-# MANDATORY PARAMETERS:
-#
-#    (None)
-#
-# OPTIONAL PARAMETERS:
-#
-#    (None)
-#
-# PROVIDED VARIABLES:
-#
-#    (None)
-#
-# PROVIDED MACROS:
-#
-#    (None)
-#
-# -----------------------------------------------------------------------------
-
-SHELL = /bin/sh
-
-# Converts a given input to a printable output using "(None)" if no items are in the list
-CONVERT_TO_PRINTABLE           = $(if $(strip $(1)), $(1), (None))
-
-
-# Build sorted and filtered lists of the included build module data
-SORTED_LUFA_BUILD_MODULES      = $(sort $(LUFA_BUILD_MODULES))
-SORTED_LUFA_BUILD_TARGETS      = $(sort $(LUFA_BUILD_TARGETS))
-SORTED_LUFA_MANDATORY_VARS     = $(sort $(LUFA_BUILD_MANDATORY_VARS))
-SORTED_LUFA_OPTIONAL_VARS      = $(filter-out $(SORTED_LUFA_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS)))
-SORTED_LUFA_PROVIDED_VARS      = $(sort $(LUFA_BUILD_PROVIDED_VARS))
-SORTED_LUFA_PROVIDED_MACROS    = $(sort $(LUFA_BUILD_PROVIDED_MACROS))
-
-# Create printable versions of the sorted build module data (use "(None)" when no data is available)
-PRINTABLE_LUFA_BUILD_MODULES   = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_BUILD_MODULES))
-PRINTABLE_LUFA_BUILD_TARGETS   = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_BUILD_TARGETS))
-PRINTABLE_LUFA_MANDATORY_VARS  = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_MANDATORY_VARS))
-PRINTABLE_LUFA_OPTIONAL_VARS   = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_OPTIONAL_VARS))
-PRINTABLE_LUFA_PROVIDED_VARS   = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_PROVIDED_VARS))
-PRINTABLE_LUFA_PROVIDED_MACROS = $(call CONVERT_TO_PRINTABLE, $(SORTED_LUFA_PROVIDED_MACROS))
-
-help:
-       @echo "==================================================================="
-       @echo "                       LUFA Build System 2.0                       "
-       @echo "      (C) Dean Camera, 2016 { dean @ fourwalledcubicle . com }     "
-       @echo "==================================================================="
-       @echo "DESCRIPTION:                                                       "
-       @echo " This build system is a set of makefile modules for (GNU) Make, to "
-       @echo " provide a simple system for building LUFA powered applications.   "
-       @echo " Each makefile module can be included from within a user makefile, "
-       @echo " to expose the build rules documented in the comments at the top of"
-       @echo " each build module.                                                "
-       @echo "                                                                   "
-       @echo "USAGE:                                                             "
-       @echo " To execute a rule, define all variables indicated in the desired  "
-       @echo " module as a required parameter before including the build module  "
-       @echo " in your project makefile. Parameters marked as optional will      "
-       @echo " assume a default value in the modules if not user-assigned.       "
-       @echo "                                                                   "
-       @echo " By default the target output shows both a friendly summary, as    "
-       @echo " well as the actual invoked command. To suppress the output of the "
-       @echo " invoked commands and show only the friendly command output, run   "
-       @echo " make with the \"-s\" switch added before the target(s).           "
-       @echo "                                                                   "
-       @echo "SEE ALSO:                                                          "
-       @echo " For more information, see the 'Build System' chapter of the LUFA  "
-       @echo " project documentation.                                            "
-       @echo "==================================================================="
-       @echo "                                                                   "
-       @echo "  Currently used build system modules in this application:         "
-       @echo "                                                                   "
-       @printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%=   - %\n)"
-       @echo "                                                                   "
-       @echo "                                                                   "
-       @echo "  Currently available build targets in this application:           "
-       @echo "                                                                   "
-       @printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%=   - %\n)"
-       @echo "                                                                   "
-       @echo "                                                                   "
-       @echo "  Mandatory variables required by the selected build Modules:      "
-       @echo "                                                                   "
-       @printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%=   - %\n)"
-       @echo "                                                                   "
-       @echo "                                                                   "
-       @echo "  Optional variables required by the selected build Modules:       "
-       @echo "                                                                   "
-       @printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%=   - %\n)"
-       @echo "                                                                   "
-       @echo "                                                                   "
-       @echo "  Variables provided by the selected build Modules:                "
-       @echo "                                                                   "
-       @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%=   - %\n)"
-       @echo "                                                                   "
-       @echo "                                                                   "
-       @echo "  Macros provided by the selected build Modules:                   "
-       @echo "                                                                   "
-       @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%=   - %\n)"
-       @echo "                                                                   "
-       @echo "==================================================================="
-       @echo "   The LUFA BuildSystem 2.0 - Powered By Positive Thinking (tm)    "
-       @echo "==================================================================="
-
-# Lists build modules included by the project makefile, in alphabetical order
-list_modules:
-       @echo Currently Used Build System Modules:
-       @printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%=   - %\n)"
-
-# Lists build targets included by the project makefile, in alphabetical order
-list_targets:
-       @echo Currently Available Build Targets:
-       @printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%=   - %\n)"
-
-# Lists mandatory variables that must be set by the project makefile, in alphabetical order
-list_mandatory:
-       @echo Mandatory Variables for Included Modules:
-       @printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%=   - %\n)"
-
-# Lists optional variables that must be set by the project makefile, in alphabetical order
-list_optional:
-       @echo Optional Variables for Included Modules:
-       @printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%=   - %\n)"
-
-# Lists variables provided by the included build modules, in alphabetical order
-list_provided:
-       @echo Variables Provided by the Included Modules:
-       @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%=   - %\n)"
-
-# Lists macros provided by the included build modules, in alphabetical order
-list_macros:
-       @echo Macros Provided by the Included Modules:
-       @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%=   - %\n)"
-
-# Disable default in-built make rules (those that are needed are explicitly
-# defined, and doing so has performance benefits when recursively building)
-ifeq ($(filter -r,$(MAKEFLAGS)),)
-  MAKEFLAGS += -r
-endif
-.SUFFIXES:
-
-# Phony build targets for this module
-.PHONY: help list_modules list_targets list_mandatory list_optional list_provided list_macros
+DMBS_PATH := $(LUFA_PATH)/Build/DMBS/DMBS
+include $(DMBS_PATH)/core.mk
index 25fa340..801a4c1 100644 (file)
 #
 #             LUFA Library
-#     Copyright (C) Dean Camera, 2016.
+#     Copyright (C) Dean Camera, 2015.
 #
 #  dean [at] fourwalledcubicle [dot] com
 #           www.lufa-lib.org
 #
 
-LUFA_BUILD_MODULES         += CPPCHECK
-LUFA_BUILD_TARGETS         += cppcheck cppcheck-config
-LUFA_BUILD_MANDATORY_VARS  += SRC
-LUFA_BUILD_OPTIONAL_VARS   += CPPCHECK_INCLUDES CPPCHECK_EXCLUDES CPPCHECK_MSG_TEMPLATE CPPCHECK_ENABLE \
-                              CPPCHECK_SUPPRESS CPPCHECK_FAIL_ON_WARNING CPPCHECK_QUIET CPPCHECK_FLAGS
-LUFA_BUILD_PROVIDED_VARS   +=
-LUFA_BUILD_PROVIDED_MACROS +=
-
-# -----------------------------------------------------------------------------
-#                LUFA CPPCheck Buildsystem Makefile Module.
-# -----------------------------------------------------------------------------
-# DESCRIPTION:
-#   Provides a set of targets to scan a project with the free "cppcheck" static
-#   analysis tool, to check for code errors at runtime
-#   (see http://cppcheck.sourceforge.net).
-# -----------------------------------------------------------------------------
-# TARGETS:
-#
-#    cppcheck                  - Scan the project with CPPCheck
-#    cppcheck-config           - Use CPPCheck to look for missing include files
-#
-# MANDATORY PARAMETERS:
-#
-#    SRC                       - List of source files to statically analyze
-#
-# OPTIONAL PARAMETERS:
-#
-#    CPPCHECK_INCLUDES         - Extra include paths to search for missing
-#                                header files
-#    CPPCHECK_EXCLUDES         - Source file paths to exclude checking (can be
-#                                a path fragment if desired)
-#    CPPCHECK_MSG_TEMPLATE     - Template for cppcheck error and warning output
-#    CPPCHECK_ENABLE           - General cppcheck category checks to enable
-#    CPPCHECK_SUPPRESS         - Specific cppcheck warnings to disable by ID
-#    CPPCHECK_FAIL_ON_WARNING  - Set to Y to fail the build on cppcheck
-#                                warnings, N to continue even if warnings occur
-#    CPPCHECK_QUIET            - Enable cppcheck verbose or quiet output mode
-#    CPPCHECK_FLAGS            - Additional flags to pass to cppcheck
-#
-# PROVIDED VARIABLES:
-#
-#    (None)
-#
-# PROVIDED MACROS:
-#
-#    (None)
-#
-# -----------------------------------------------------------------------------
-
-SHELL = /bin/sh
-
-ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
-ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
-ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
-
-# Default values of optionally user-supplied variables
-CPPCHECK_INCLUDES            ?=
-CPPCHECK_EXCLUDES            ?=
-CPPCHECK_MSG_TEMPLATE        ?= {file}:{line}: {severity} ({id}): {message}
-CPPCHECK_ENABLE              ?= all
-CPPCHECK_SUPPRESS            ?= variableScope missingInclude
-CPPCHECK_FAIL_ON_WARNING     ?= Y
-CPPCHECK_QUIET               ?= Y
-CPPCHECK_FLAGS               ?=
-
-# Sanity check user supplied values
-$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
-$(call ERROR_IF_EMPTY, SRC)
-$(call ERROR_IF_EMPTY, CPPCHECK_MSG_TEMPLATE)
-$(call ERROR_IF_EMPTY, CPPCHECK_ENABLE)
-$(call ERROR_IF_NONBOOL, CPPCHECK_FAIL_ON_WARNING)
-$(call ERROR_IF_NONBOOL, CPPCHECK_QUIET)
-
-# Build a default argument list for cppcheck
-BASE_CPPCHECK_FLAGS := --template="$(CPPCHECK_MSG_TEMPLATE)" $(CPPCHECK_INCLUDES:%=-I%) $(CPPCHECK_EXCLUDES:%=-i%) --inline-suppr --force --std=c99
-
-# Sanity check parameters and construct additional command line arguments to cppcheck
-ifeq ($(CPPCHECK_FAIL_ON_WARNING), Y)
-   BASE_CPPCHECK_FLAGS += --error-exitcode=1
-endif
-ifeq ($(CPPCHECK_QUIET), Y)
-   BASE_CPPCHECK_FLAGS += --quiet
-endif
-
-# Output Messages
-MSG_CPPCHECK_CMD         := ' [CPPCHECK]:'
-
-# Checks the CPPCheck configuration as used in the user project, to determine if any paths are missing or invalid
-cppcheck-config: $(MAKEFILE_LIST)
-       @echo $(MSG_CPPCHECK_CMD) Checking cppcheck configuration check on source files
-       cppcheck $(BASE_CPPCHECK_FLAGS) --check-config $(CPPCHECK_FLAGS) $(SRC)
-
-# Runs a static analysis using CPPCheck to determine if there are any issues
-cppcheck: $(MAKEFILE_LIST)
-       @echo $(MSG_CPPCHECK_CMD) Performing static analysis on source files
-       cppcheck $(BASE_CPPCHECK_FLAGS) --enable=$(CPPCHECK_ENABLE) $(CPPCHECK_SUPPRESS:%=--suppress=%) $(CPPCHECK_FLAGS) $(SRC)
-
-# Phony build targets for this module
-.PHONY: cppcheck-config cppcheck
+DMBS_PATH := $(LUFA_PATH)/Build/DMBS/DMBS
+include $(DMBS_PATH)/cppcheck.mk
index 368ead0..2100ae8 100644 (file)
@@ -1,95 +1,10 @@
 #
 #             LUFA Library
-#     Copyright (C) Dean Camera, 2016.
+#     Copyright (C) Dean Camera, 2015.
 #
 #  dean [at] fourwalledcubicle [dot] com
 #           www.lufa-lib.org
 #
 
-LUFA_BUILD_MODULES         += DFU
-LUFA_BUILD_TARGETS         += flip flip-ee dfu dfu-ee
-LUFA_BUILD_MANDATORY_VARS  += MCU TARGET
-LUFA_BUILD_OPTIONAL_VARS   +=
-LUFA_BUILD_PROVIDED_VARS   +=
-LUFA_BUILD_PROVIDED_MACROS +=
-
-# -----------------------------------------------------------------------------
-#               LUFA DFU Bootloader Buildsystem Makefile Module.
-# -----------------------------------------------------------------------------
-# DESCRIPTION:
-#   Provides a set of targets to re-program a device currently running a DFU
-#   class bootloader with a project's FLASH and EEPROM files.
-# -----------------------------------------------------------------------------
-# TARGETS:
-#
-#    flip                      - Program FLASH into target via Atmel FLIP
-#    flip-ee                   - Program EEPROM into target via Atmel FLIP
-#    dfu                       - Program FLASH into target via dfu-programmer
-#    dfu-ee                    - Program EEPROM into target via dfu-programmer
-#
-# MANDATORY PARAMETERS:
-#
-#    MCU                       - Microcontroller device model name
-#    TARGET                    - Application name
-#
-# OPTIONAL PARAMETERS:
-#
-#    (None)
-#
-# PROVIDED VARIABLES:
-#
-#    (None)
-#
-# PROVIDED MACROS:
-#
-#    (None)
-#
-# -----------------------------------------------------------------------------
-
-SHELL = /bin/sh
-
-ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
-ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
-ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
-
-# Sanity-check values of mandatory user-supplied variables
-$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
-$(call ERROR_IF_EMPTY, MCU)
-$(call ERROR_IF_EMPTY, TARGET)
-
-# Output Messages
-MSG_COPY_CMD   := ' [CP]      :'
-MSG_REMOVE_CMD := ' [RM]      :'
-MSG_DFU_CMD    := ' [DFU]     :'
-
-# Programs in the target FLASH memory using BATCHISP, the command line tool used by FLIP
-flip: $(TARGET).hex $(MAKEFILE_LIST)
-       @echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$<\"
-       batchisp -hardware usb -device $(MCU) -operation erase f loadbuffer $< program
-       batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-# Programs in the target EEPROM memory using BATCHISP, the command line tool used by FLIP
-flip-ee: $(TARGET).eep $(MAKEFILE_LIST)
-       @echo $(MSG_COPY_CMD) Copying EEP file to temporary file \"$<.hex\"
-       cp $< $<.hex
-       @echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$<.hex\"
-       batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $<.hex program
-       batchisp -hardware usb -device $(MCU) -operation start reset 0
-       @echo $(MSG_REMOVE_CMD) Removing temporary file \"$<.hex\"
-       rm $<.hex
-
-# Programs in the target FLASH memory using DFU-PROGRAMMER
-dfu: $(TARGET).hex $(MAKEFILE_LIST)
-       @echo $(MSG_DFU_CMD) Programming FLASH with dfu-programmer using \"$<\"
-       dfu-programmer $(MCU) erase
-       dfu-programmer $(MCU) flash $<
-       dfu-programmer $(MCU) reset
-
-# Programs in the target EEPROM memory using DFU-PROGRAMMER
-dfu-ee: $(TARGET).eep $(MAKEFILE_LIST)
-       @echo $(MSG_DFU_CMD) Programming EEPROM with dfu-programmer using \"$<\"
-       dfu-programmer $(MCU) flash --eeprom $<
-       dfu-programmer $(MCU) reset
-
-# Phony build targets for this module
-.PHONY: flip flip-ee dfu dfu-ee
+DMBS_PATH := $(LUFA_PATH)/Build/DMBS/DMBS
+include $(DMBS_PATH)/dfu.mk
index d4f63d0..64afd4a 100644 (file)
 #
 #             LUFA Library
-#     Copyright (C) Dean Camera, 2016.
+#     Copyright (C) Dean Camera, 2015.
 #
 #  dean [at] fourwalledcubicle [dot] com
 #           www.lufa-lib.org
 #
 
-LUFA_BUILD_MODULES         += DOXYGEN
-LUFA_BUILD_TARGETS         += doxygen doxygen_upgrade doxygen_create
-LUFA_BUILD_MANDATORY_VARS  += LUFA_PATH
-LUFA_BUILD_OPTIONAL_VARS   += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRIDE_PARAMS
-LUFA_BUILD_PROVIDED_VARS   +=
-LUFA_BUILD_PROVIDED_MACROS +=
-
-# -----------------------------------------------------------------------------
-#                 LUFA Doxygen Buildsystem Makefile Module.
-# -----------------------------------------------------------------------------
-# DESCRIPTION:
-#   Provides a set of targets to automatically build Doxygen documentation for
-#   a project (see www.doxygen.org).
-# -----------------------------------------------------------------------------
-# TARGETS:
-#
-#    doxygen                   - Build Doxygen Documentation
-#    doxygen_create            - Create a new Doxygen configuration file using
-#                                the latest template
-#    doxygen_upgrade           - Upgrade an existing Doxygen configuration file
-#                                to the latest template
-#
-# MANDATORY PARAMETERS:
-#
-#    LUFA_PATH                 - Path to the LUFA library core
-#
-# OPTIONAL PARAMETERS:
-#
-#    DOXYGEN_CONF              - Doxygen configuration filename
-#    DOXYGEN_FAIL_ON_WARNING   - Set to Y to fail the build on Doxygen warnings,
-#                                N to continue even if warnings occur
-#    DOXYGEN_OVERRIDE_PARAMS   - Parameters to override in the doxygen
-#                                configuration file
-# PROVIDED VARIABLES:
-#
-#    (None)
-#
-# PROVIDED MACROS:
-#
-#    (None)
-#
-# -----------------------------------------------------------------------------
-
-SHELL = /bin/sh
-
-ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
-ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
-ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
-
-# Default values of optionally user-supplied variables
-DOXYGEN_CONF            ?= doxyfile
-DOXYGEN_FAIL_ON_WARNING ?= Y
-DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_EXTRA_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css
-
-# Sanity check user supplied values
-$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
-$(call ERROR_IF_EMPTY, DOXYGEN_CONF)
-$(call ERROR_IF_EMPTY, LUFA_PATH)
-$(call ERROR_IF_NONBOOL, DOXYGEN_FAIL_ON_WARNING)
-
-# Output Messages
-MSG_DOXYGEN_CMD         := ' [DOXYGEN] :'
-
-# Determine Doxygen invocation command
-BASE_DOXYGEN_CMD := ( cat $(DOXYGEN_CONF) $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
-ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
-   DOXYGEN_CMD := if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v -e "[Ww]arning:\|recompile doxygen" ;); then exit 1; fi;
-else
-   DOXYGEN_CMD := $(BASE_DOXYGEN_CMD)
-endif
-
-# Error if the specified Doxygen configuration file does not exist
-$(DOXYGEN_CONF):
-       $(error Doxygen configuration file $@ does not exist)
-
-# Builds the project documentation using the specified configuration file and the DOXYGEN tool
-doxygen: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
-       @echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\"
-       $(DOXYGEN_CMD)
-
-# Upgrades an existing Doxygen configuration file to the latest Doxygen template, preserving settings
-doxygen_upgrade: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
-       @echo $(MSG_DOXYGEN_CMD) Upgrading configuration file \"$(DOXYGEN_CONF)\" with latest template
-       doxygen -u $(DOXYGEN_CONF) > /dev/null
-
-# Creates a new Doxygen configuration file with the set file name
-doxygen_create: $(MAKEFILE_LIST)
-       @echo $(MSG_DOXYGEN_CMD) Creating new configuration file \"$(DOXYGEN_CONF)\" with latest template
-       doxygen -g $(DOXYGEN_CONF) > /dev/null
-
-# Phony build targets for this module
-.PHONY: doxygen doxygen_upgrade doxygen_create
+DMBS_PATH := $(LUFA_PATH)/Build/DMBS/DMBS
+include $(DMBS_PATH)/doxygen.mk
index 921f4c4..86ca145 100644 (file)
@@ -1,96 +1,10 @@
 #
 #             LUFA Library
-#     Copyright (C) Dean Camera, 2016.
+#     Copyright (C) Dean Camera, 2015.
 #
 #  dean [at] fourwalledcubicle [dot] com
 #           www.lufa-lib.org
 #
 
-LUFA_BUILD_MODULES         += HID
-LUFA_BUILD_TARGETS         += hid hid-ee teensy teensy-ee
-LUFA_BUILD_MANDATORY_VARS  += MCU TARGET
-LUFA_BUILD_OPTIONAL_VARS   +=
-LUFA_BUILD_PROVIDED_VARS   +=
-LUFA_BUILD_PROVIDED_MACROS +=
-
-# -----------------------------------------------------------------------------
-#               LUFA HID Bootloader Buildsystem Makefile Module.
-# -----------------------------------------------------------------------------
-# DESCRIPTION:
-#   Provides a set of targets to re-program a device currently running a HID
-#   class bootloader with a project's FLASH files.
-# -----------------------------------------------------------------------------
-# TARGETS:
-#
-#    hid                       - Program FLASH into target via
-#                                hid_bootloader_cli
-#    hid-ee                    - Program EEPROM into target via a temporary
-#                                AVR application and hid_bootloader_cli
-#    teensy                    - Program FLASH into target via
-#                                teensy_loader_cli
-#    teensy-ee                 - Program EEPROM into target via a temporary
-#                                AVR application and teensy_loader_cli
-#
-# MANDATORY PARAMETERS:
-#
-#    MCU                       - Microcontroller device model name
-#    TARGET                    - Application name
-#
-# OPTIONAL PARAMETERS:
-#
-#    (None)
-#
-# PROVIDED VARIABLES:
-#
-#    (None)
-#
-# PROVIDED MACROS:
-#
-#    (None)
-#
-# -----------------------------------------------------------------------------
-
-SHELL = /bin/sh
-
-LUFA_MODULE_PATH := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
-
-ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
-ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
-ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
-
-# Sanity-check values of mandatory user-supplied variables
-$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
-$(call ERROR_IF_EMPTY, MCU)
-$(call ERROR_IF_EMPTY, TARGET)
-
-# Output Messages
-MSG_HID_BOOTLOADER_CMD := ' [HID]     :'
-MSG_OBJCPY_CMD         := ' [OBJCPY]  :'
-MSG_MAKE_CMD           := ' [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 \"$<\"
-       hid_bootloader_cli -mmcu=$(MCU) -v $<
-
-# 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 $< $(LUFA_MODULE_PATH)/HID_EEPROM_Loader/InputEEData.bin
-       @echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\"
-       $(MAKE) -C $(LUFA_MODULE_PATH)/HID_EEPROM_Loader/ MCU=$(MCU) clean hid
-
-# Programs in the target FLASH memory using the TEENSY_BOOTLOADER_CLI tool
-teensy: $(TARGET).hex $(MAKEFILE_LIST)
-       @echo $(MSG_HID_BOOTLOADER_CMD) Programming FLASH with teensy_loader_cli using \"$<\"
-       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 $< $(LUFA_MODULE_PATH)/HID_EEPROM_Loader/InputEEData.bin
-       @echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\"
-       $(MAKE) -s -C $(LUFA_MODULE_PATH)/HID_EEPROM_Loader/ MCU=$(MCU) clean teensy
-
-# Phony build targets for this module
-.PHONY: hid hid-ee teensy teensy-ee
+DMBS_PATH := $(LUFA_PATH)/Build/DMBS/DMBS
+include $(DMBS_PATH)/hid.mk
index 8a0172e..0764d30 100644 (file)
@@ -1,21 +1,21 @@
 #
 #             LUFA Library
-#     Copyright (C) Dean Camera, 2016.
+#     Copyright (C) Dean Camera, 2015.
 #
 #  dean [at] fourwalledcubicle [dot] com
 #           www.lufa-lib.org
 #
 
-LUFA_BUILD_MODULES         += SOURCES
-LUFA_BUILD_TARGETS         +=
-LUFA_BUILD_MANDATORY_VARS  += LUFA_PATH ARCH
-LUFA_BUILD_OPTIONAL_VARS   +=
-LUFA_BUILD_PROVIDED_VARS   += LUFA_SRC_USB_DEVICE LUFA_SRC_USB_HOST    \
+DMBS_BUILD_MODULES         += LUFA_SOURCES
+DMBS_BUILD_TARGETS         +=
+DMBS_BUILD_MANDATORY_VARS  += LUFA_PATH ARCH
+DMBS_BUILD_OPTIONAL_VARS   +=
+DMBS_BUILD_PROVIDED_VARS   += LUFA_SRC_USB_DEVICE LUFA_SRC_USB_HOST    \
                               LUFA_SRC_USB LUFA_SRC_USBCLASS_DEVICE    \
                               LUFA_SRC_USBCLASS_HOST LUFA_SRC_USBCLASS \
                               LUFA_SRC_TEMPERATURE LUFA_SRC_SERIAL     \
                               LUFA_SRC_TWI LUFA_SRC_PLATFORM
-LUFA_BUILD_PROVIDED_MACROS +=
+DMBS_BUILD_PROVIDED_MACROS +=
 
 # -----------------------------------------------------------------------------
 #               LUFA Sources Buildsystem Makefile Module.
index e06727e..d5e051b 100644 (file)
@@ -7,10 +7,23 @@
 /** \page Page_BuildSystem The LUFA Build System\r
  *\r
  *  \section Sec_BuildSystem_Overview Overview of the LUFA Build System\r
- *  The LUFA build system is an attempt at making a set of re-usable, modular build make files which\r
- *  can be referenced in a LUFA powered project, to minimize the amount of code required in an\r
- *  application makefile. The system is written in GNU Make, and each module is independent of\r
- *  one-another.\r
+ *  The LUFA build system was originally an attempt at making a set of\r
+ *  re-usable, modular build make files which could be referenced in a LUFA\r
+ *  powered project, to minimize the amount of code required in an\r
+ *  application makefile.\r
+ *\r
+ *  As it turned out to be fairly generic in nature, it was split out into its\r
+ *  own separate project, called DMBS (<i>Dean's Makefile Build System</i>)\r
+ *  which is released into the public domain. LUFA specific portions of the\r
+ *  LUFA build system extend DMBS, and provide a universal build system for all\r
+ *  LUFA projects.\r
+ *\r
+ *  The latest DMBS project information can be found at:\r
+ *  https://github.com/abcminiuser/dmbs\r
+ *\r
+ *  DMBS is written in GNU Make, and each module is independent of one-another.\r
+ *\r
+ *  \section SSec_BuildSystem_Using Using the LUFA Build System\r
  *\r
  *  For details on the prerequisites needed for Linux and Windows machines to be able to use the LUFA\r
  *  build system, see \ref Sec_CompilingApps_Prerequisites.\r
index 8ff794a..3913801 100644 (file)
@@ -31,13 +31,13 @@ LD_FLAGS     =
 # Default target
 all:
 
+OBJDIR      := obj
+
 # Since this project borrows files from the AVRISP-MKII project which may also have an
 # identical OBJDIR directory, we need to enforce the use of this project's object file
 # directory as the one where the build object files are to be stored by pre-pending the
 # absolute path of the current project to the OBJDIR variable.
-ifneq ($(OBJDIR),)
-  override OBJDIR:=$(shell pwd)/$(OBJDIR)
-endif
+override OBJDIR:=$(shell pwd)/$(OBJDIR)
 
 # Include LUFA build script makefiles
 include $(LUFA_PATH)/Build/lufa_core.mk