Add DEBUG_FORMAT and DEBUG_LEVEL optional parameters to the BUILD module. Turn off...
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 15 Jul 2012 09:59:35 +0000 (09:59 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 15 Jul 2012 09:59:35 +0000 (09:59 +0000)
BuildTests/BoardDriverTest/makefile.test
BuildTests/BootloaderTest/makefile
BuildTests/ModuleTest/makefile.test
BuildTests/SingleUSBModeTest/makefile.test
LUFA/Build/lufa_build.mk
LUFA/DoxygenPages/BuildSystem.txt
Maintenance/makefile

index ea2c836..234add1 100644 (file)
@@ -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
\ No newline at end of file
index 7b6b5d0..e3f60d7 100644 (file)
@@ -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
         
index b61c42b..b01998f 100644 (file)
@@ -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
index 4d8ddc5..800e3c3 100644 (file)
@@ -13,6 +13,7 @@ MCU          =
 ARCH         = 
 BOARD        = NONE
 F_CPU        = $(F_USB)
+DEBUG_LEVEL  = 0
 
 ifeq ($(ARCH), AVR8)
    F_USB     = 8000000
index a78d0f9..bed98c2 100644 (file)
@@ -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 \"$<\"
index 3ecb945..c30a88b 100644 (file)
  *    <td>Version of the C++ standard to apply when compiling C++ source files (see GCC manual).</td>\r
  *   </tr>\r
  *   <tr>\r
+ *    <td><tt>DEBUG_FORMAT</tt></td>\r
+ *    <td>Format of the debug information to embed in the generated object files (see GCC manual).</td>\r
+ *   </tr>\r
+ *   <tr>\r
+ *    <td><tt>DEBUG_LEVEL</tt></td>\r
+ *    <td>Level of the debugging information to embed in the generated object files (see GCC manual).</td>\r
+ *   </tr>\r
+ *   <tr>\r
  *    <td><tt>F_CPU</tt></td>\r
  *    <td>Speed of the processor CPU clock, in Hz.</td>\r
  *   </tr>\r
  *   </tr>\r
  *   <tr>\r
  *    <td><tt>CC_FLAGS</tt></td>\r
- *    <td>Common flags to pass to the compiler, assembler and linker, after the automatically generated flags.</td>\r
+ *    <td>Common flags to pass to the C/C++ compiler and assembler, after the automatically generated flags.</td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td><tt>LD_FLAGS</tt></td>\r
index d31a384..ca30599 100644 (file)
@@ -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