2011-05-11 21:17:30 +00:00
|
|
|
VPATH =
|
|
|
|
OBJS = main.o
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Project-specific files
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
VPATH +=
|
|
|
|
OBJS +=
|
2011-06-13 21:17:09 +00:00
|
|
|
OBJS += basic/basic.o basic/reinvoke_isp.o basic/delayms.o basic/voltage.o
|
2011-06-13 21:53:02 +00:00
|
|
|
OBJS += basic/keyin.o
|
2011-06-17 10:31:42 +00:00
|
|
|
LIBS += core/libcore.a lcd/liblcd.a modules/libmodules.a filesystem/libfat.a usb/libusb.a
|
2011-05-11 21:17:30 +00:00
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# GNU GCC compiler flags
|
|
|
|
##########################################################################
|
|
|
|
ROOT_PATH = .
|
|
|
|
INCLUDE_PATHS = -I$(ROOT_PATH) -I$(ROOT_PATH)/core
|
|
|
|
|
2011-05-21 00:16:03 +00:00
|
|
|
include $(ROOT_PATH)/Makefile.inc
|
2011-05-11 21:17:30 +00:00
|
|
|
|
2011-06-15 21:31:02 +00:00
|
|
|
LDFLAGS+= -Wl,--gc-sections
|
2011-05-11 21:17:30 +00:00
|
|
|
VPATH += lpc1xxx
|
|
|
|
OBJS += $(TARGET)_handlers.o LPC1xxx_startup.o
|
|
|
|
|
|
|
|
##########################################################################
|
2011-05-21 00:16:03 +00:00
|
|
|
# Startup files
|
2011-05-11 21:17:30 +00:00
|
|
|
##########################################################################
|
2011-05-21 10:05:48 +00:00
|
|
|
LDLIBS = -lm
|
|
|
|
LDLIBS += -Lmodules -lmodules
|
2011-05-22 15:46:25 +00:00
|
|
|
LDLIBS += -Llcd -llcd
|
2011-06-17 10:31:42 +00:00
|
|
|
LDLIBS += -Lusb -lusb
|
|
|
|
LDLIBS += -Lfilesystem -lfat
|
2011-06-15 14:17:42 +00:00
|
|
|
LDLIBS += -Lcore -lcore
|
2011-05-21 10:05:48 +00:00
|
|
|
OCFLAGS = --strip-unneeded
|
2011-05-11 21:17:30 +00:00
|
|
|
|
2011-05-21 00:16:03 +00:00
|
|
|
LD_PATH = lpc1xxx
|
|
|
|
LD_SCRIPT = $(LD_PATH)/linkscript.ld
|
|
|
|
LD_TEMP = $(LD_PATH)/memory.ld
|
2011-05-11 21:17:30 +00:00
|
|
|
|
2011-06-15 21:31:02 +00:00
|
|
|
### User targets:
|
|
|
|
|
2011-06-09 11:20:03 +00:00
|
|
|
all: $(OUTFILE).bin
|
2011-05-11 21:17:30 +00:00
|
|
|
|
2011-06-15 21:31:02 +00:00
|
|
|
protect: $(OUTFILE).bin
|
|
|
|
$(LPCFIX) -p 2 $(OUTFILE).bin
|
|
|
|
|
|
|
|
loadables: $(OUTFILE).elf
|
|
|
|
@cd loadable && $(MAKE)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex
|
|
|
|
@cd core && $(MAKE) clean
|
|
|
|
@cd tools && $(MAKE) clean
|
|
|
|
@cd lcd && $(MAKE) clean
|
|
|
|
@cd modules && $(MAKE) clean
|
|
|
|
@cd filesystem && $(MAKE) clean
|
2011-06-17 10:31:42 +00:00
|
|
|
@cd usb && $(MAKE) clean
|
2011-06-15 21:31:02 +00:00
|
|
|
@cd loadable && $(MAKE) clean
|
|
|
|
|
|
|
|
### Internal targets
|
|
|
|
|
2011-05-11 21:17:30 +00:00
|
|
|
%.o : %.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
core/libcore.a: core/projectconfig.h
|
2011-05-21 00:16:03 +00:00
|
|
|
cd core && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
2011-05-11 21:17:30 +00:00
|
|
|
|
2011-05-22 15:46:25 +00:00
|
|
|
lcd/liblcd.a lcd/render.o lcd/display.o:
|
2011-05-21 00:16:03 +00:00
|
|
|
cd lcd && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
2011-05-11 21:17:30 +00:00
|
|
|
|
2011-05-21 10:05:48 +00:00
|
|
|
modules/libmodules.a:
|
|
|
|
cd modules && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
|
|
|
|
2011-06-15 08:51:22 +00:00
|
|
|
filesystem/libfat.a:
|
|
|
|
cd filesystem && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
|
|
|
|
2011-06-17 10:31:42 +00:00
|
|
|
usb/libusb.a:
|
|
|
|
cd usb && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
|
|
|
|
2011-06-09 11:20:03 +00:00
|
|
|
tools/lpcfix:
|
2011-05-11 21:17:30 +00:00
|
|
|
cd tools && $(MAKE)
|
|
|
|
|
2011-06-15 21:31:02 +00:00
|
|
|
$(LD_TEMP):
|
2011-05-11 21:17:30 +00:00
|
|
|
-@echo "MEMORY" > $(LD_TEMP)
|
|
|
|
-@echo "{" >> $(LD_TEMP)
|
|
|
|
-@echo " flash(rx): ORIGIN = 0x00000000, LENGTH = $(FLASH)" >> $(LD_TEMP)
|
2011-06-15 21:31:02 +00:00
|
|
|
-@echo " sram(rwx): ORIGIN = 0x10000000+$(SRAM_USB), LENGTH = $(SRAM)-$(SRAM_USB)-$(RAMCODE)" >> $(LD_TEMP)
|
2011-05-11 21:17:30 +00:00
|
|
|
-@echo "}" >> $(LD_TEMP)
|
|
|
|
-@echo "INCLUDE $(LD_SCRIPT)" >> $(LD_TEMP)
|
2011-06-15 21:31:02 +00:00
|
|
|
|
|
|
|
$(OUTFILE).elf: $(OBJS) $(SYS_OBJS) $(LIBS) $(LPCFIX) $(LD_TEMP)
|
|
|
|
$(CC) $(LDFLAGS) -T $(LD_TEMP) -o $(OUTFILE).elf $(OBJS) $(LDLIBS)
|
2011-05-11 21:17:30 +00:00
|
|
|
-@echo ""
|
|
|
|
$(SIZE) $(OUTFILE).elf
|
|
|
|
-@echo ""
|
2011-05-13 13:20:08 +00:00
|
|
|
|
2011-06-15 21:31:02 +00:00
|
|
|
%.bin: %.elf
|
|
|
|
$(OBJCOPY) $(OCFLAGS) -O binary $< $@
|
|
|
|
-@echo ""
|
|
|
|
$(LPCFIX) -c $@
|
2011-05-13 13:20:08 +00:00
|
|
|
|
2011-06-17 10:31:42 +00:00
|
|
|
.PHONY: $(LD_TEMP) lcd/liblcd.a modules/libmodules.a filesystem/libfat.a usb/libusb.a
|
2011-05-13 13:20:08 +00:00
|
|
|
|