2011-05-11 21:17:30 +00:00
|
|
|
VPATH =
|
2011-07-09 18:17:00 +00:00
|
|
|
OBJS =
|
|
|
|
LIBS =
|
2011-05-11 21:17:30 +00:00
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Project-specific files
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
VPATH +=
|
2011-07-09 18:17:00 +00:00
|
|
|
OBJS += main.o
|
|
|
|
|
|
|
|
LIBS += lcd/liblcd.a
|
|
|
|
LIBS += basic/libbasic.a
|
|
|
|
LIBS += core/libcore.a
|
|
|
|
LIBS += applications/libapp.a
|
|
|
|
LIBS += filesystem/libfat.a
|
|
|
|
LIBS += usb/libusb.a
|
|
|
|
LIBS += funk/libfunk.a
|
2011-07-10 16:02:07 +00:00
|
|
|
LIBS += usbcdc/libusbcdc.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-07-18 16:53:17 +00:00
|
|
|
OBJS += lpc1xxx/$(TARGET)_handlers.o lpc1xxx/LPC1xxx_startup.o
|
2011-05-11 21:17:30 +00:00
|
|
|
|
|
|
|
##########################################################################
|
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-07-10 16:02:07 +00:00
|
|
|
LDLIBS += -Lusbcdc -lusbcdc
|
2011-06-17 10:31:42 +00:00
|
|
|
LDLIBS += -Lfilesystem -lfat
|
2011-07-09 18:17:00 +00:00
|
|
|
LDLIBS += -Lbasic -lbasic
|
2011-07-13 22:56:34 +00:00
|
|
|
LDLIBS += -Llcd -llcd
|
2011-07-14 00:24:14 +00:00
|
|
|
LDLIBS += -Lcore -lcore
|
2011-07-13 22:56:34 +00:00
|
|
|
LDLIBS += -Lusb -lusb
|
2011-05-21 10:05:48 +00:00
|
|
|
OCFLAGS = --strip-unneeded
|
2011-05-11 21:17:30 +00:00
|
|
|
|
2011-07-09 18:17:00 +00:00
|
|
|
SUBDIRS?= $(foreach lib,$(LIBS),$(dir $(lib)))
|
|
|
|
|
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
|
2011-07-09 18:17:00 +00:00
|
|
|
for dir in $(SUBDIRS); do \
|
2011-07-29 02:33:29 +00:00
|
|
|
$(MAKE) $(CONFIG_MAKE_PRINTDIRECTORY) -C $$dir clean; \
|
2011-07-09 18:17:00 +00:00
|
|
|
done
|
2011-07-10 12:24:05 +00:00
|
|
|
flash: all
|
|
|
|
../tools/bootloader/autoflash
|
2011-06-15 21:31:02 +00:00
|
|
|
|
|
|
|
### Internal targets
|
|
|
|
|
2011-05-11 21:17:30 +00:00
|
|
|
%.o : %.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ $<
|
|
|
|
|
2011-07-09 18:17:00 +00:00
|
|
|
### Make all libraries...
|
|
|
|
.PHONY: subdirs $(SUBDIRS)
|
2011-06-15 08:51:22 +00:00
|
|
|
|
2011-07-09 18:17:00 +00:00
|
|
|
subdirs: $(SUBDIRS)
|
2011-06-17 10:31:42 +00:00
|
|
|
|
2011-07-09 18:17:00 +00:00
|
|
|
$(SUBDIRS):
|
2011-07-29 02:33:29 +00:00
|
|
|
$(MAKE) ROOT_PATH=../$(ROOT_PATH) $(CONFIG_MAKE_PRINTDIRECTORY) -C $@
|
2011-07-05 09:11:08 +00:00
|
|
|
|
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
|
|
|
|
2011-07-09 18:17:00 +00:00
|
|
|
$(OUTFILE).elf: $(OBJS) $(SYS_OBJS) $(SUBDIRS) $(LPCFIX) $(LD_TEMP)
|
2011-06-15 21:31:02 +00:00
|
|
|
$(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-07-09 18:17:00 +00:00
|
|
|
.PHONY: $(LD_TEMP)
|
2011-07-07 22:10:53 +00:00
|
|
|
|