diff --git a/Makefile b/Makefile index ef6eea0..dcefde5 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,3 @@ -########################################################################## -# User configuration and firmware specific object files -########################################################################## - -# The target, flash and ram of the LPC1xxx microprocessor. -# Use for the target the value: LPC11xx, LPC13xx or LPC17xx -TARGET = LPC13xx -FLASH = 32K -SRAM = 8K - -# For USB HID support the LPC134x reserves 384 bytes from the sram, -# if you don't want to use the USB features, just use 0 here. -SRAM_USB = 384 - VPATH = OBJS = main.o @@ -25,26 +11,17 @@ OBJS += basic/basic.o OBJS += eeprom/eeprom.o LIBS += core/libcore.a lcd/libfont.a -########################################################################## -# GNU GCC compiler prefix and location -########################################################################## - -CROSS_COMPILE = arm-none-eabi- -AS = $(CROSS_COMPILE)gcc -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)gcc -SIZE = $(CROSS_COMPILE)size -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump -OUTFILE = firmware -LPCRC = tools/lpcrc - ########################################################################## # GNU GCC compiler flags ########################################################################## ROOT_PATH = . INCLUDE_PATHS = -I$(ROOT_PATH) -I$(ROOT_PATH)/core +include $(ROOT_PATH)/Makefile.inc + +VPATH += lpc1xxx +OBJS += $(TARGET)_handlers.o LPC1xxx_startup.o + ########################################################################## # Startup files ########################################################################## @@ -53,37 +30,16 @@ LD_PATH = lpc1xxx LD_SCRIPT = $(LD_PATH)/linkscript.ld LD_TEMP = $(LD_PATH)/memory.ld -ifeq (LPC11xx,$(TARGET)) - CORTEX_TYPE=m0 -else - CORTEX_TYPE=m3 -endif - -CPU_TYPE = cortex-$(CORTEX_TYPE) -VPATH += lpc1xxx -OBJS += $(TARGET)_handlers.o LPC1xxx_startup.o - -########################################################################## -# Compiler settings, parameters and flags -########################################################################## - -CFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin -LDFLAGS = -nostartfiles -mthumb -mcpu=$(CPU_TYPE) -Wl,--gc-sections -LDLIBS = -lm -LDLIBS += -Lcore -lcore -LDLIBS += -Llcd -lfont -OCFLAGS = --strip-unneeded - all: firmware %.o : %.c $(CC) $(CFLAGS) -o $@ $< core/libcore.a: core/projectconfig.h - cd core && $(MAKE) + cd core && $(MAKE) ROOT_PATH=../$(ROOT_PATH) lcd/libfont.a lcd/render.o lcd/display.o: - cd lcd && $(MAKE) + cd lcd && $(MAKE) ROOT_PATH=../$(ROOT_PATH) tools/lpcrc: cd tools && $(MAKE) diff --git a/Makefile.inc b/Makefile.inc new file mode 100644 index 0000000..b79793a --- /dev/null +++ b/Makefile.inc @@ -0,0 +1,47 @@ +########################################################################## +# User configuration and firmware specific object files +########################################################################## + +# The target, flash and ram of the LPC1xxx microprocessor. +# Use for the target the value: LPC11xx, LPC13xx or LPC17xx +TARGET = LPC13xx +FLASH = 32K +SRAM = 8K + +# For USB HID support the LPC134x reserves 384 bytes from the sram, +# if you don't want to use the USB features, just use 0 here. +SRAM_USB = 384 + +########################################################################## +# GNU GCC compiler prefix and location +########################################################################## + +CROSS_COMPILE = arm-none-eabi- +AS = $(CROSS_COMPILE)gcc +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)gcc +SIZE = $(CROSS_COMPILE)size +OBJCOPY = $(CROSS_COMPILE)objcopy +OBJDUMP = $(CROSS_COMPILE)objdump +OUTFILE = firmware +LPCRC = tools/lpcrc + +ifeq (LPC11xx,$(TARGET)) + CORTEX_TYPE=m0 +else + CORTEX_TYPE=m3 +endif + +CPU_TYPE = cortex-$(CORTEX_TYPE) + +########################################################################## +# Compiler settings, parameters and flags +########################################################################## + +CFLAGS = -std=c99 -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin +LDFLAGS = -nostartfiles -mthumb -mcpu=$(CPU_TYPE) -Wl,--gc-sections +LDLIBS = -lm +LDLIBS += -Lcore -lcore +LDLIBS += -Llcd -lfont +OCFLAGS = --strip-unneeded + diff --git a/core/Makefile b/core/Makefile index e7003f9..1b8554a 100644 --- a/core/Makefile +++ b/core/Makefile @@ -34,45 +34,18 @@ OBJS += timer32/timer32.o #OBJS += usbhid-rom/usbhid.o OBJS += wdt/wdt.o -########################################################################## -# GNU GCC compiler prefix and location -########################################################################## - -CROSS_COMPILE = arm-none-eabi- -AS = $(CROSS_COMPILE)gcc -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)gcc -AR = $(CROSS_COMPILE)ar -SIZE = $(CROSS_COMPILE)size -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump -OUTFILE = firmware - ########################################################################## # GNU GCC compiler flags ########################################################################## -ROOT_PATH = . -INCLUDE_PATHS = -I$(ROOT_PATH) -I.. +ROOT_PATH?= .. +INCLUDE_PATHS = -I$(ROOT_PATH) -I. -########################################################################## -# Startup files -########################################################################## - -ifeq (LPC11xx,$(TARGET)) - CORTEX_TYPE=m0 -else - CORTEX_TYPE=m3 -endif - -CPU_TYPE = cortex-$(CORTEX_TYPE) +include $(ROOT_PATH)/Makefile.inc ########################################################################## # Compiler settings, parameters and flags ########################################################################## -CFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin -LDFLAGS = -nostartfiles -mthumb -mcpu=$(CPU_TYPE) -Wl,--gc-sections - all: libcore.a libcore.a: $(OBJS) diff --git a/lcd/Makefile b/lcd/Makefile index 54ea7a5..8cbd96f 100644 --- a/lcd/Makefile +++ b/lcd/Makefile @@ -2,10 +2,6 @@ # User configuration and firmware specific object files ########################################################################## -# The target, flash and ram of the LPC1xxx microprocessor. -# Use for the target the value: LPC11xx, LPC13xx or LPC17xx -TARGET = LPC13xx - OBJS = OBJS += smallfonts.o @@ -16,46 +12,18 @@ OBJS += display.o OBJS += render.o OBJS += decoder.o -########################################################################## -# GNU GCC compiler prefix and location -########################################################################## - -CROSS_COMPILE = arm-none-eabi- -AS = $(CROSS_COMPILE)gcc -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)gcc -AR = $(CROSS_COMPILE)ar -SIZE = $(CROSS_COMPILE)size -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump -OUTFILE = firmware -LPCRC = ./lpcrc - ########################################################################## # GNU GCC compiler flags ########################################################################## -ROOT_PATH = . -INCLUDE_PATHS = -I$(ROOT_PATH) -I../core +ROOT_PATH?= .. +INCLUDE_PATHS = -I$(ROOT_PATH) -I../core -I. -########################################################################## -# Startup files -########################################################################## - -ifeq (LPC11xx,$(TARGET)) - CORTEX_TYPE=m0 -else - CORTEX_TYPE=m3 -endif - -CPU_TYPE = cortex-$(CORTEX_TYPE) +include $(ROOT_PATH)/Makefile.inc ########################################################################## # Compiler settings, parameters and flags ########################################################################## -CFLAGS = -std=c99 -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin -LDFLAGS = -nostartfiles -mthumb -mcpu=$(CPU_TYPE) -Wl,--gc-sections - all: libfont.a libfont.a: $(OBJS) @@ -69,5 +37,4 @@ clean: render.o: render.c render.h display.h fonts.h smallfonts.o: smallfonts.c smallfonts.h fonts.h -veramono9.o: veramono9.c veramono9.h fonts.h