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-17 15:49:40 +00:00
|
|
|
OBJS += basic/keyin.o basic/uuid.o
|
2011-07-05 09:11:08 +00:00
|
|
|
LIBS += core/libcore.a lcd/liblcd.a applications/libapp.a filesystem/libfat.a usb/libusb.a funk/libfunk.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
|
2011-06-20 21:33:42 +00:00
|
|
|
LDLIBS += -Lapplications -lapp
|
2011-07-05 09:11:08 +00:00
|
|
|
LDLIBS += -Lfunk -lfunk
|
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
|
|
|
|
|
2011-06-17 16:29:05 +00:00
|
|
|
loadables: $(OUTFILE).bin
|
2011-06-15 21:31:02 +00:00
|
|
|
@cd loadable && $(MAKE)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex
|
|
|
|
@cd core && $(MAKE) clean
|
2011-06-19 20:03:37 +00:00
|
|
|
@cd ../tools/bootloader && $(MAKE) clean
|
2011-06-15 21:31:02 +00:00
|
|
|
@cd lcd && $(MAKE) clean
|
2011-06-20 21:33:42 +00:00
|
|
|
@cd applications && $(MAKE) clean
|
2011-06-15 21:31:02 +00:00
|
|
|
@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-06-20 21:33:42 +00:00
|
|
|
applications/libapp.a:
|
|
|
|
cd applications && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
2011-05-21 10:05:48 +00:00
|
|
|
|
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-07-05 09:11:08 +00:00
|
|
|
funk/libfunk.a:
|
|
|
|
cd funk && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
|
|
|
|
2011-06-19 20:03:37 +00:00
|
|
|
../tools/bootloader/lpcfix:
|
|
|
|
cd ../tools/bootloader && $(MAKE)
|
2011-05-11 21:17:30 +00:00
|
|
|
|
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-20 21:33:42 +00:00
|
|
|
.PHONY: $(LD_TEMP) lcd/liblcd.a applications/libapp.a filesystem/libfat.a usb/libusb.a
|
2011-05-13 13:20:08 +00:00
|
|
|
|