From 49ca5c3c8306b2c85019eb24584da8c67dd042dc Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Mon, 4 Jun 2012 16:31:50 +0000 Subject: Add new ATPROGRAM build system module. Add ATPROGRAM and CPPCHECK modules to all application makefiles. --- LUFA/Build/lufa.atprogram.in | 75 ++++++++++++++++++++++++++++++++++++ LUFA/Build/lufa.avrdude.in | 17 ++++---- LUFA/Build/lufa.build.in | 2 +- LUFA/Build/lufa.core.in | 12 +++--- LUFA/Build/lufa.cppcheck.in | 3 ++ LUFA/Build/lufa.dfu.in | 2 +- LUFA/Build/lufa.doxygen.in | 2 +- LUFA/Build/lufa.sources.in | 2 +- LUFA/CodeTemplates/makefile_template | 2 + 9 files changed, 99 insertions(+), 18 deletions(-) create mode 100644 LUFA/Build/lufa.atprogram.in (limited to 'LUFA') diff --git a/LUFA/Build/lufa.atprogram.in b/LUFA/Build/lufa.atprogram.in new file mode 100644 index 000000000..f42354c19 --- /dev/null +++ b/LUFA/Build/lufa.atprogram.in @@ -0,0 +1,75 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2012. +# +# 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 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 +# +# ----------------------------------------------------------------------------- + +# Sanity-check values of mandatory user-supplied variables +MCU ?= $(error Makefile MCU value not set) +TARGET ?= $(error Makefile TARGET value not set) + +ifeq ($(MCU),) + $(error Makefile MCU option cannot be blank) +endif +ifeq ($(TARGET),) + $(error Makefile TARGET option cannot be blank) +endif + +# Default values of optionally user-supplied variables +ATPROGRAM_PROGRAMMER ?= jtagice3 +ATPROGRAM_INTERFACE ?= jtag +ATPROGRAM_PORT ?= + +# 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 + +atprogram: $(TARGET).hex $(MAKEFILE_LIST) + @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\" + atprogram $(BASE_ATPROGRAM_FLAGS) program --chiperase --flash --file $(TARGET).hex + +atprogram-ee: $(TARGET).eep $(MAKEFILE_LIST) + @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\" + atprogram $(BASE_ATPROGRAM_FLAGS) program --eeprom --file $(TARGET).eep + +# Phony build targets for this module +.PHONY: atprogram atprogram-ee diff --git a/LUFA/Build/lufa.avrdude.in b/LUFA/Build/lufa.avrdude.in index a0bef19cc..256fdff28 100644 --- a/LUFA/Build/lufa.avrdude.in +++ b/LUFA/Build/lufa.avrdude.in @@ -7,7 +7,7 @@ # LUFA_BUILD_MODULES += AVRDUDE -LUFA_BUILD_TARGETS += program program-ee +LUFA_BUILD_TARGETS += avrdude avrdude-ee LUFA_BUILD_MANDATORY_VARS += MCU TARGET LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS @@ -20,9 +20,9 @@ LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS # ----------------------------------------------------------------------------- # TARGETS: # -# program - Program target FLASH with application using +# avrdude - Program target FLASH with application using # avrdude -# program-ee - Program target EEPROM with application data +# avrdude-ee - Program target EEPROM with application data # using avrdude # # MANDATORY PARAMETERS: @@ -57,16 +57,17 @@ AVRDUDE_FLAGS ?= # Output Messages MSG_AVRDUDE_CMD := ' [AVRDUDE] :' +# Construct flags to use for the different memory spaces AVRDUDE_FLASH_FLAGS = -U flash:w:$< $(AVRDUDE_FLAGS) AVRDUDE_EEP_FLAGS = -U eeprom:w:$< $(AVRDUDE_FLAGS) -program: $(TARGET).hex $(MAKEFILE_LIST) - @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_FLASH_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" +avrdude: $(TARGET).hex $(MAKEFILE_LIST) + @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" FLASH with settings \"$(AVRDUDE_FLASH_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) $(AVRDUDE_FLASH_FLAGS) -program-ee: $(TARGET).eep $(MAKEFILE_LIST) - @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_EEP_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" +avrdude-ee: $(TARGET).eep $(MAKEFILE_LIST) + @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" EEPROM with settings \"$(AVRDUDE_EEP_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) $(AVRDUDE_EEP_FLAGS) # Phony build targets for this module -.PHONY: program program-ee \ No newline at end of file +.PHONY: avrdude avrdude-ee diff --git a/LUFA/Build/lufa.build.in b/LUFA/Build/lufa.build.in index 8be02c37b..d399d82d9 100644 --- a/LUFA/Build/lufa.build.in +++ b/LUFA/Build/lufa.build.in @@ -235,4 +235,4 @@ lss: $(TARGET).lss -include $(DEPENDENCY_FILES) # Phony build targets for this module -.PHONY: begin end gcc_version check_source size symbol-sizes elf hex lss clean \ No newline at end of file +.PHONY: begin end gcc_version check_source size symbol-sizes elf hex lss clean diff --git a/LUFA/Build/lufa.core.in b/LUFA/Build/lufa.core.in index 13372c454..722e92fd7 100644 --- a/LUFA/Build/lufa.core.in +++ b/LUFA/Build/lufa.core.in @@ -59,14 +59,14 @@ help: @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 module if not user-assigned. " + @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 " Currently used modules in this application: " + @echo " Currently used build system modules in this application: " @echo " " @printf " %b" "$(SORTED_LUFA_BUILD_MODULES:%= - %\n)" @echo " " @@ -90,7 +90,7 @@ help: @echo "===================================================================" list_modules: - @echo Currently Build Modules: $(SORTED_LUFA_BUILD_MODULES) + @echo Currently Used Build System Modules: $(SORTED_LUFA_BUILD_MODULES) list_targets: @echo Currently Available Build Targets: $(SORTED_LUFA_BUILD_TARGETS) @@ -101,9 +101,9 @@ list_mandatory: list_optional: @echo Optional Variables for Included Modules: $(SORTED_LUFA_OPTIONAL_VARS) -# Phony build targets for this module -.PHONY: help list_modules list_targets list_mandatory list_optional - # Disable default in-built make rules (those that are needed are explicitly # defined, and doing so has performance benefits when recursively building) .SUFFIXES: + +# Phony build targets for this module +.PHONY: help list_modules list_targets list_mandatory list_optional diff --git a/LUFA/Build/lufa.cppcheck.in b/LUFA/Build/lufa.cppcheck.in index f329cb32d..d30758013 100644 --- a/LUFA/Build/lufa.cppcheck.in +++ b/LUFA/Build/lufa.cppcheck.in @@ -82,3 +82,6 @@ cppcheck-config: cppcheck: @echo $(MSG_CPPCHECK_CMD) Performing cppcheck analysis on path \"$(CPPCHECK_PATH)\" cppcheck $(CPPCHECK_OPTIONS) --enable=$(CPPCHECK_ENABLE) $(CPPCHECK_SUPPRESS:%=--suppress=%) $(CPPCHECK_PATH) + +# Phony build targets for this module +.PHONY: cppcheck-config cppcheck diff --git a/LUFA/Build/lufa.dfu.in b/LUFA/Build/lufa.dfu.in index 33b5b7dc0..63789936b 100644 --- a/LUFA/Build/lufa.dfu.in +++ b/LUFA/Build/lufa.dfu.in @@ -80,4 +80,4 @@ dfu-ee: $(TARGET).eep $(MAKEFILE_LIST) dfu-programmer $(MCU) reset # Phony build targets for this module -.PHONY: flip flip-ee dfu dfu-ee \ No newline at end of file +.PHONY: flip flip-ee dfu dfu-ee diff --git a/LUFA/Build/lufa.doxygen.in b/LUFA/Build/lufa.doxygen.in index 1a5ede8e9..f4a5db705 100644 --- a/LUFA/Build/lufa.doxygen.in +++ b/LUFA/Build/lufa.doxygen.in @@ -61,4 +61,4 @@ doxygen: $(DOXYGEN_CMD) # Phony build targets for this module -.PHONY: doxygen \ No newline at end of file +.PHONY: doxygen diff --git a/LUFA/Build/lufa.sources.in b/LUFA/Build/lufa.sources.in index 47cda0c99..9df85c2ae 100644 --- a/LUFA/Build/lufa.sources.in +++ b/LUFA/Build/lufa.sources.in @@ -92,4 +92,4 @@ LUFA_SRC_ALL_FILES = $(LUFA_SRC_USB) \ $(LUFA_SRC_TEMPERATURE) \ $(LUFA_SRC_SERIAL) \ $(LUFA_SRC_TWI) \ - $(LUFA_SRC_PLATFORM) \ No newline at end of file + $(LUFA_SRC_PLATFORM) diff --git a/LUFA/CodeTemplates/makefile_template b/LUFA/CodeTemplates/makefile_template index 6f3c1c706..0be15b2c9 100644 --- a/LUFA/CodeTemplates/makefile_template +++ b/LUFA/CodeTemplates/makefile_template @@ -28,6 +28,8 @@ all: include $(LUFA_PATH)/Build/lufa.core.in include $(LUFA_PATH)/Build/lufa.sources.in include $(LUFA_PATH)/Build/lufa.build.in +include $(LUFA_PATH)/Build/lufa.cppcheck.in include $(LUFA_PATH)/Build/lufa.doxygen.in include $(LUFA_PATH)/Build/lufa.dfu.in include $(LUFA_PATH)/Build/lufa.avrdude.in +include $(LUFA_PATH)/Build/lufa.atprogram.in -- cgit v1.2.3