3 # Copyright (C) Dean Camera, 2015.
5 # dean [at] fourwalledcubicle [dot] com
11 DMBS_BUILD_MANDATORY_VARS
+= LUFA_PATH ARCH F_USB
12 DMBS_BUILD_OPTIONAL_VARS
+= BOARD
13 DMBS_BUILD_PROVIDED_VARS
+=
14 DMBS_BUILD_PROVIDED_MACROS
+=
16 # -----------------------------------------------------------------------------
17 # LUFA Core Build Buildsystem Makefile Module.
18 # -----------------------------------------------------------------------------
20 # Subclass of the standard DMBS GCC build module, with LUFA specific
21 # extensions. This module provides the core build rules for the compilation
22 # of LUFA projects using GCC.
23 # -----------------------------------------------------------------------------
28 # MANDATORY PARAMETERS:
30 # LUFA_PATH - Path to the LUFA library core
31 # ARCH - Device architecture name
32 # F_USB - Speed of the USB core clock, in Hz
34 # OPTIONAL PARAMETERS:
36 # BOARD - LUFA board drivers to use
46 # -----------------------------------------------------------------------------
50 ERROR_IF_UNSET ?
= $(if
$(filter undefined
, $(origin $(strip $(1)))), $(error Makefile
$(strip $(1)) value not set
))
51 ERROR_IF_EMPTY ?
= $(if
$(strip $($(strip $(1)))), , $(error Makefile
$(strip $(1)) option cannot be blank
))
52 ERROR_IF_NONBOOL ?
= $(if
$(filter Y N
, $($(strip $(1)))), , $(error Makefile
$(strip $(1)) option must be Y or N
))
54 # Sanity check user supplied values
55 $(call ERROR_IF_EMPTY
, LUFA_PATH
)
56 $(call ERROR_IF_EMPTY
, ARCH
)
57 $(call ERROR_IF_EMPTY
, F_USB
)
59 # Default values of optionally user-supplied variables
62 # Determine the utility prefix to use for the selected architecture
64 $(warning The XMEGA device support is currently EXPERIMENTAL
(incomplete and
/or non-functional
), and is included for preview purposes only.
)
65 else ifeq ($(ARCH
), UC3
)
66 $(warning The UC3 device support is currently EXPERIMENTAL
(incomplete and
/or non-functional
), and is included for preview purposes only.
)
69 # LUFA specific standard build options
70 C_FLAGS
+= -I.
-I
$(patsubst %/,%,$(LUFA_PATH
))/..
71 C_FLAGS
+= -DARCH
=ARCH_
$(ARCH
) -DBOARD
=BOARD_
$(BOARD
) -DF_USB
=$(F_USB
)UL
73 # This flag is required for bootloaders as GCC will emit invalid jump table
74 # assembly code for devices with large amounts of flash; the jump table target
75 # is extracted from FLASH without using the correct ELPM instruction, resulting
76 # in a pseudo-random jump target.
77 C_FLAGS
+= -fno-jump-tables
79 DMBS_PATH
:= $(LUFA_PATH
)/Build
/DMBS
/DMBS
80 include $(DMBS_PATH
)/gcc.mk