Commit 53be5292 authored by Dean Camera's avatar Dean Camera
Browse files

Change the build system build module makefiles to have a set of sanity check...

Change the build system build module makefiles to have a set of sanity check macros they can call to verify user data. Add additional sanity checks.
parent 3808f5c3
...@@ -38,22 +38,22 @@ LUFA_BUILD_OPTIONAL_VARS += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_ ...@@ -38,22 +38,22 @@ LUFA_BUILD_OPTIONAL_VARS += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Sanity-check values of mandatory user-supplied variables ERROR_IF_UNSET = $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
MCU ?= $(error Makefile MCU value not set) ERROR_IF_EMPTY = $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
TARGET ?= $(error Makefile TARGET value not set) ERROR_IF_NONBOOL = $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
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 # Default values of optionally user-supplied variables
ATPROGRAM_PROGRAMMER ?= jtagice3 ATPROGRAM_PROGRAMMER ?= jtagice3
ATPROGRAM_INTERFACE ?= jtag ATPROGRAM_INTERFACE ?= jtag
ATPROGRAM_PORT ?= 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 # Output Messages
MSG_ATPROGRAM_CMD := ' [ATPRGRM] :' MSG_ATPROGRAM_CMD := ' [ATPRGRM] :'
......
...@@ -38,22 +38,22 @@ LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS ...@@ -38,22 +38,22 @@ LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Sanity-check values of mandatory user-supplied variables ERROR_IF_UNSET = $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
MCU ?= $(error Makefile MCU value not set) ERROR_IF_EMPTY = $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
TARGET ?= $(error Makefile TARGET value not set) ERROR_IF_NONBOOL = $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
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 # Default values of optionally user-supplied variables
AVRDUDE_PROGRAMMER ?= jtagicemkii AVRDUDE_PROGRAMMER ?= jtagicemkii
AVRDUDE_PORT ?= usb AVRDUDE_PORT ?= usb
AVRDUDE_FLAGS ?= AVRDUDE_FLAGS ?=
# 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 # Output Messages
MSG_AVRDUDE_CMD := ' [AVRDUDE] :' MSG_AVRDUDE_CMD := ' [AVRDUDE] :'
......
...@@ -55,26 +55,9 @@ LUFA_BUILD_OPTIONAL_VARS += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_ ...@@ -55,26 +55,9 @@ LUFA_BUILD_OPTIONAL_VARS += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Sanity-check values of mandatory user-supplied variables ERROR_IF_UNSET = $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
MCU ?= $(error Makefile MCU value not set) ERROR_IF_EMPTY = $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
TARGET ?= $(error Makefile TARGET value not set) ERROR_IF_NONBOOL = $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
ARCH ?= $(error Makefile ARCH value not set)
SRC ?= $(error Makefile SRC value not set)
F_USB ?= $(error Makefile F_USB value not set)
LUFA_PATH ?= $(error Makefile LUFA_PATH value not set)
ifeq ($(MCU),)
$(error Makefile MCU option cannot be blank)
endif
ifeq ($(TARGET),)
$(error Makefile TARGET option cannot be blank)
endif
ifeq ($(ARCH),)
$(error Makefile ARCH option cannot be blank)
endif
ifeq ($(F_USB),)
$(error Makefile F_USB option cannot be blank)
endif
# Default values of optionally user-supplied variables # Default values of optionally user-supplied variables
BOARD ?= NONE BOARD ?= NONE
...@@ -87,6 +70,18 @@ CPP_FLAGS ?= ...@@ -87,6 +70,18 @@ CPP_FLAGS ?=
ASM_FLAGS ?= ASM_FLAGS ?=
CC_FLAGS ?= CC_FLAGS ?=
# 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, 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)
# Determine the utility prefix to use for the selected architecture # Determine the utility prefix to use for the selected architecture
ifeq ($(ARCH), AVR8) ifeq ($(ARCH), AVR8)
CROSS := avr- CROSS := avr-
......
...@@ -46,6 +46,10 @@ LUFA_BUILD_OPTIONAL_VARS += CPPCHECK_PATH CPPCHECK_INCLUDES CPPCHECK_EXCLUDES C ...@@ -46,6 +46,10 @@ LUFA_BUILD_OPTIONAL_VARS += CPPCHECK_PATH CPPCHECK_INCLUDES CPPCHECK_EXCLUDES C
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
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 # Default values of optionally user-supplied variables
CPPCHECK_PATH ?= . CPPCHECK_PATH ?= .
CPPCHECK_INCLUDES ?= CPPCHECK_INCLUDES ?=
...@@ -57,20 +61,23 @@ CPPCHECK_FAIL_ON_WARNING ?= Y ...@@ -57,20 +61,23 @@ CPPCHECK_FAIL_ON_WARNING ?= Y
CPPCHECK_QUIET ?= Y CPPCHECK_QUIET ?= Y
CPPCHECK_FLAGS ?= CPPCHECK_FLAGS ?=
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, CPPCHECK_PATH)
$(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 # 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 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 # Sanity check parameters and construct additional command line arguments to cppcheck
ifeq ($(CPPCHECK_FAIL_ON_WARNING), Y) ifeq ($(CPPCHECK_FAIL_ON_WARNING), Y)
BASE_CPPCHECK_FLAGS += --error-exitcode=1 BASE_CPPCHECK_FLAGS += --error-exitcode=1
else ifneq ($(CPPCHECK_FAIL_ON_WARNING), N)
$(error CPPCHECK_FAIL_ON_WARNING must be Y or N)
endif endif
ifeq ($(CPPCHECK_QUIET), Y) ifeq ($(CPPCHECK_QUIET), Y)
BASE_CPPCHECK_FLAGS += --quiet BASE_CPPCHECK_FLAGS += --quiet
else ifneq ($(CPPCHECK_QUIET), N)
$(error CPPCHECK_QUIET must be Y or N)
endif endif
# Output Messages # Output Messages
......
...@@ -36,16 +36,16 @@ LUFA_BUILD_OPTIONAL_VARS += ...@@ -36,16 +36,16 @@ LUFA_BUILD_OPTIONAL_VARS +=
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Sanity-check values of mandatory user-supplied variables ERROR_IF_UNSET = $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
MCU ?= $(error Makefile MCU value not set) ERROR_IF_EMPTY = $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
TARGET ?= $(error Makefile TARGET value not set) ERROR_IF_NONBOOL = $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
ifeq ($(MCU),) # Sanity-check values of mandatory user-supplied variables
$(error Makefile MCU option cannot be blank) $(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
endif $(call ERROR_IF_UNSET, MCU)
ifeq ($(TARGET),) $(call ERROR_IF_UNSET, TARGET)
$(error Makefile TARGET option cannot be blank) $(call ERROR_IF_EMPTY, MCU)
endif $(call ERROR_IF_EMPTY, TARGET)
# Output Messages # Output Messages
MSG_COPY_CMD := ' [CP] :' MSG_COPY_CMD := ' [CP] :'
......
...@@ -35,25 +35,30 @@ LUFA_BUILD_OPTIONAL_VARS += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRI ...@@ -35,25 +35,30 @@ LUFA_BUILD_OPTIONAL_VARS += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRI
# configuration file # configuration file
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Sanity-check values of mandatory user-supplied variables ERROR_IF_UNSET = $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
LUFA_PATH ?= $(error Makefile LUFA_PATH 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 # Default values of optionally user-supplied variables
DOXYGEN_CONF ?= Doxygen.conf DOXYGEN_CONF ?= Doxygen.conf
DOXYGEN_FAIL_ON_WARNING ?= Y DOXYGEN_FAIL_ON_WARNING ?= Y
DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_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, LUFA_PATH)
$(call ERROR_IF_EMPTY, LUFA_PATH)
$(call ERROR_IF_NONBOOL, DOXYGEN_FAIL_ON_WARNING)
# Output Messages # Output Messages
MSG_DOXYGEN_CMD := ' [DOXYGEN] :' MSG_DOXYGEN_CMD := ' [DOXYGEN] :'
# Determine Doxygen invocation command # Determine Doxygen invocation command
BASE_DOXYGEN_CMD = ( cat Doxygen.conf $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen - BASE_DOXYGEN_CMD = ( cat $(DOXYGEN_CONF) $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y) ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
DOXYGEN_CMD = if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi; DOXYGEN_CMD = if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi;
else ifeq ($(DOXYGEN_FAIL_ON_WARNING), N)
DOXYGEN_CMD = $(BASE_DOXYGEN_CMD)
else else
$(error DOXYGEN_FAIL_ON_WARNING must be Y or N.) DOXYGEN_CMD = $(BASE_DOXYGEN_CMD)
endif endif
doxygen: doxygen:
......
...@@ -35,13 +35,14 @@ LUFA_BUILD_OPTIONAL_VARS += ...@@ -35,13 +35,14 @@ LUFA_BUILD_OPTIONAL_VARS +=
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Sanity-check values of mandatory user-supplied variables ERROR_IF_UNSET = $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ARCH ?= $(error Makefile ARCH value not set) ERROR_IF_EMPTY = $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
LUFA_PATH ?= $(error Makefile LUFA_PATH value not set) ERROR_IF_NONBOOL = $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
ifeq ($(ARCH),) # Sanity check user supplied values
$(error Makefile ARCH option cannot be blank) $(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
endif $(call ERROR_IF_EMPTY, LUFA_PATH)
$(call ERROR_IF_EMPTY, ARCH)
# Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles # Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles
LUFA_ROOT_PATH ?= $(patsubst %/,%,$(LUFA_PATH)) LUFA_ROOT_PATH ?= $(patsubst %/,%,$(LUFA_PATH))
......
...@@ -129,7 +129,8 @@ ...@@ -129,7 +129,8 @@
/** /**
* \page Page_UC3Support Atmel 32-Bit UC3 AVR (UC3) * \page Page_UC3Support Atmel 32-Bit UC3 AVR (UC3)
* Note: <i>The AVR32 UC3 device support is currently <b>experimental</b>, and is included for preview purposes only.</i> *
* \warning The AVR32 UC3 device support is currently <b>experimental</b>, and is included for preview purposes only.
* *
* \section Sec_UC3Support_Devices Supported Microcontroller Models * \section Sec_UC3Support_Devices Supported Microcontroller Models
* *
...@@ -298,7 +299,8 @@ ...@@ -298,7 +299,8 @@
/** /**
* \page Page_XMEGASupport Atmel USB XMEGA AVR (XMEGA) * \page Page_XMEGASupport Atmel USB XMEGA AVR (XMEGA)
* Note: <i>The XMEGA device support is currently <b>experimental</b> (incomplete and/or non-functional), and is included for preview purposes only.</i> *
* \warning The XMEGA device support is currently <b>experimental</b> (incomplete and/or non-functional), and is included for preview purposes only.
* *
* \section Sec_XMEGASupport_Devices Supported Microcontroller Models * \section Sec_XMEGASupport_Devices Supported Microcontroller Models
* *
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
* - AVR8 Architecture * - AVR8 Architecture
* - No known issues. * - No known issues.
* - XMEGA Architecture * - XMEGA Architecture
* \warning The XMEGA device support is currently <b>experimental</b> (incomplete and/or non-functional), and is included for preview purposes only.
*
* - No demos, bootloaders or projects have been ported for the XMEGA devices in the current release, * - No demos, bootloaders or projects have been ported for the XMEGA devices in the current release,
* although the architecture is supported in the LUFA core library. * although the architecture is supported in the LUFA core library.
* - Endpoints of more than 64 bytes are not currently supported in this release. * - Endpoints of more than 64 bytes are not currently supported in this release.
...@@ -22,6 +24,8 @@ ...@@ -22,6 +24,8 @@
* - Early revisions of the ATXMEGA128A1U are incompatible with LUFA, due to their various errata * - Early revisions of the ATXMEGA128A1U are incompatible with LUFA, due to their various errata
* relating to the USB controller. * relating to the USB controller.
* - UC3 Architecture * - UC3 Architecture
* \warning The UC3 device support is currently <b>experimental</b> (incomplete and/or non-functional), and is included for preview purposes only. \n
*
* - No demos, bootloaders or projects have been ported for the UC3 devices in the current release, * - No demos, bootloaders or projects have been ported for the UC3 devices in the current release,
* although the architecture is supported in the LUFA core library. * although the architecture is supported in the LUFA core library.
* - DMA transfers to and from the USB controller are not yet implemented for this release. * - DMA transfers to and from the USB controller are not yet implemented for this release.
...@@ -29,7 +33,7 @@ ...@@ -29,7 +33,7 @@
* altered USB controller design. * altered USB controller design.
* - The various \c CreateStream() functions for creating standard \c <stdio.h> compatible virtual file * - The various \c CreateStream() functions for creating standard \c <stdio.h> compatible virtual file
* streams are not available on the UC3 architecture, due to a lack of suitable library support. * streams are not available on the UC3 architecture, due to a lack of suitable library support.
* - Architecture Independant * - Architecture Independent
* - The HID parser fails for array type elements that have a MIN and MAX usage applied; each element * - The HID parser fails for array type elements that have a MIN and MAX usage applied; each element
* in the array will receive a unique incrementing usage from the MIN value, up to MAX. * in the array will receive a unique incrementing usage from the MIN value, up to MAX.
* - The current application makefiles do not work if the output directory is not the same directory * - The current application makefiles do not work if the output directory is not the same directory
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment