X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/4bacec6c7f5c9dc23f74f267676d88363fee3b30..20c30c8c53dc90381bf24a56d4d5f98d407406dd:/Makefile diff --git a/Makefile b/Makefile index b5a1d4c..78bfbf7 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,14 @@ SRAM_USB = 384 VPATH = OBJS = main.o +########################################################################## +# Debug settings +########################################################################## + +# Set DEBUGBUILD to 'TRUE' for full debugging (larger, slower binaries), +# or to 'FALSE' for release builds (smallest, fastest binaries) +DEBUGBUILD = FALSE + ########################################################################## # Project-specific files ########################################################################## @@ -98,6 +106,10 @@ OBJS += pn532.o VPATH += drivers/sensors/tcs3414 drivers/sensors/tsl2561 OBJS += tcs3414.o tsl2561.o +# SPI Flash +VPATH += drivers/spiflash/w25q16bv +OBJS += w25q16bv.o + ########################################################################## # Library files ########################################################################## @@ -124,7 +136,6 @@ OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump OUTFILE = firmware LPCRC = ./lpcrc -LPCRC_DIR = ./tools/lpcrc CP = cp ########################################################################## @@ -154,9 +165,14 @@ OBJS += $(TARGET)_handlers.o LPC1xxx_startup.o ########################################################################## # Compiler settings, parameters and flags ########################################################################## +ifeq (TRUE,$(DEBUGBUILD)) + CFLAGS = -c -g -O0 $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin + ASFLAGS = -c -g -O0 $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -D__ASSEMBLY__ -x assembler-with-cpp +else + CFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin + ASFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -D__ASSEMBLY__ -x assembler-with-cpp +endif -CFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin -ASFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -D__ASSEMBLY__ -x assembler-with-cpp LDFLAGS = -nostartfiles -mthumb -mcpu=$(CPU_TYPE) -Wl,--gc-sections LDLIBS = -lm OCFLAGS = --strip-unneeded @@ -169,10 +185,7 @@ all: firmware %.o : %.s $(AS) $(ASFLAGS) -o $@ $< -$(LPCRC) : - $(MAKE) -C $(LPCRC_DIR) && $(CP) $(LPCRC_DIR)/lpcrc . - -firmware: $(OBJS) $(SYS_OBJS) $(LPCRC) +firmware: $(OBJS) $(SYS_OBJS) -@echo "MEMORY" > $(LD_TEMP) -@echo "{" >> $(LD_TEMP) -@echo " flash(rx): ORIGIN = 0x00000000, LENGTH = $(FLASH)" >> $(LD_TEMP)