Add DEBUG_FORMAT and DEBUG_LEVEL optional parameters to the BUILD module. Turn off generation of debug information when performing a validation build, and when running the build tests.

pull/1469/head
Dean Camera 12 years ago
parent 3c1b28cf5f
commit 3ca025f214

@ -19,6 +19,7 @@ TARGET = Test
SRC = $(TARGET).c
LUFA_PATH = ../../LUFA
CC_FLAGS = -Werror
DEBUG_LEVEL = 0
# Include LUFA build script makefiles
include $(LUFA_PATH)/Build/lufa_build.mk

@ -46,7 +46,7 @@ testbootloaders:
printf "Found '%s' bootloader configuration (FLASH: %3s KB | BOOT: %3s KB | MCU: %12s / %4s)\n" $$build_bootloader $$build_flashsize $$build_bootsize $$build_mcu $$build_arch; \
\
printf "\t@echo Building bootloader %s - %s - FLASH: %s KB, BOOT: %s KB\n" $$build_bootloader $$build_mcu $$build_flashsize $$build_bootsize >> BuildMakefile; \
printf "\t$(MAKE) -C $(patsubst %/,%,$(LUFA_PATH))/../Bootloaders/%s/ clean elf ARCH=%s MCU=%s BOARD=%s FLASH_SIZE_KB=%s BOOT_SECTION_SIZE_KB=%s\n\n" $$build_bootloader $$build_arch $$build_mcu $$build_board $$build_flashsize $$build_bootsize >> BuildMakefile; \
printf "\t$(MAKE) -C $(patsubst %/,%,$(LUFA_PATH))/../Bootloaders/%s/ clean elf ARCH=%s MCU=%s BOARD=%s FLASH_SIZE_KB=%s BOOT_SECTION_SIZE_KB=%s DEBUG_LEVEL=0\n\n" $$build_bootloader $$build_arch $$build_mcu $$build_board $$build_flashsize $$build_bootsize >> BuildMakefile; \
fi; \
done < BootloaderDeviceMap.cfg

@ -17,6 +17,7 @@ OPTIMIZATION = 1
TARGET = Test
SRC = $(TARGET)_C.c $(TARGET)_CPP.cpp Dummy.S $(LUFA_SRC_USB)
LUFA_PATH = ../../LUFA
DEBUG_LEVEL = 0
ifeq ($(ARCH), AVR8)
F_USB = 8000000

@ -13,6 +13,7 @@ MCU =
ARCH =
BOARD = NONE
F_CPU = $(F_USB)
DEBUG_LEVEL = 0
ifeq ($(ARCH), AVR8)
F_USB = 8000000

@ -9,7 +9,7 @@
LUFA_BUILD_MODULES += BUILD
LUFA_BUILD_TARGETS += size check-source symbol-sizes all lib elf 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
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
LUFA_BUILD_PROVIDED_VARS +=
LUFA_BUILD_PROVIDED_MACROS +=
@ -64,6 +64,10 @@ LUFA_BUILD_PROVIDED_MACROS +=
# 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
#
# PROVIDED VARIABLES:
#
@ -93,6 +97,8 @@ ASM_FLAGS ?=
CC_FLAGS ?=
OBJDIR ?= .
OBJECT_FILES ?=
DEBUG_FORMAT ?= dwarf-2
DEBUG_LEVEL ?= 3
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
@ -106,6 +112,8 @@ $(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)
# Determine the utility prefix to use for the selected architecture
ifeq ($(ARCH), AVR8)
@ -159,13 +167,13 @@ endif
DEPENDENCY_FILES := $(OBJECT_FILES:%.o=%.d)
# Create a list of common flags to pass to the compiler/linker/assembler
BASE_CC_FLAGS := -pipe
BASE_CC_FLAGS := -pipe -g$(DEBUG_FORMAT) -g$(DEBUG_LEVEL)
ifeq ($(ARCH), AVR8)
BASE_CC_FLAGS += -mmcu=$(MCU) -gdwarf-2 -fshort-enums -fno-inline-small-functions -fpack-struct
BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct
else ifeq ($(ARCH), XMEGA)
BASE_CC_FLAGS += -mmcu=$(MCU) -gdwarf-2 -fshort-enums -fno-inline-small-functions -fpack-struct
BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct
else ifeq ($(ARCH), UC3)
BASE_CC_FLAGS += -mpart=$(MCU:at32%=%) -g3 -masm-addr-pseudos
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))/..
@ -180,11 +188,13 @@ 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 ($(ARCH), UC3)
BASE_LD_FLAGS += --rodata-writable --direct-data
else
BASE_LD_FLAGS += -Wl,--relax
BASE_LD_FLAGS := -lm -Wl,-Map=$(TARGET).map,--cref -Wl,--gc-sections -Wl,--relax
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)
@ -261,7 +271,7 @@ $(OBJDIR)/%.o: %.S $(MAKEFILE_LIST)
.SECONDARY : %.elf
%.elf: $(OBJECT_FILES)
@echo $(MSG_LINK_CMD) Linking object files into \"$@\"
$(CROSS)-gcc $(BASE_CC_FLAGS) $(BASE_LD_FLAGS) $(CC_FLAGS) $(LD_FLAGS) $^ -o $@
$(CROSS)-gcc $(BASE_LD_FLAGS) $(LD_FLAGS) $^ -o $@
%.hex: %.elf
@echo $(MSG_OBJCPY_CMD) Extracting HEX file data from \"$<\"

@ -155,6 +155,14 @@
* <td>Version of the C++ standard to apply when compiling C++ source files (see GCC manual).</td>
* </tr>
* <tr>
* <td><tt>DEBUG_FORMAT</tt></td>
* <td>Format of the debug information to embed in the generated object files (see GCC manual).</td>
* </tr>
* <tr>
* <td><tt>DEBUG_LEVEL</tt></td>
* <td>Level of the debugging information to embed in the generated object files (see GCC manual).</td>
* </tr>
* <tr>
* <td><tt>F_CPU</tt></td>
* <td>Speed of the processor CPU clock, in Hz.</td>
* </tr>
@ -172,7 +180,7 @@
* </tr>
* <tr>
* <td><tt>CC_FLAGS</tt></td>
* <td>Common flags to pass to the compiler, assembler and linker, after the automatically generated flags.</td>
* <td>Common flags to pass to the C/C++ compiler and assembler, after the automatically generated flags.</td>
* </tr>
* <tr>
* <td><tt>LD_FLAGS</tt></td>

@ -84,7 +84,7 @@ check-documentation-placeholders:
# Validate the working branch - compile all documentation, demos/projects/examples and run build tests
validate-branch:
$(MAKE) -C $(LUFA_ROOT) doxygen
$(MAKE) -C $(LUFA_ROOT) all
$(MAKE) -C $(LUFA_ROOT) all DEBUG_LEVEL=0
$(MAKE) -C $(LUFA_ROOT)/BuildTests all
# Validate the working branch for general release, check for placeholder documentation then build and test everything

Loading…
Cancel
Save