crashtest-r0ket/firmware/Makefile

118 lines
2.7 KiB
Makefile
Raw Normal View History

VPATH =
OBJS =
LIBS =
##########################################################################
# Project-specific files
##########################################################################
VPATH +=
OBJS += main.o
ifeq "$(wildcard table.c)" "table.c"
OBJS += table.o
endif
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
##########################################################################
# GNU GCC compiler flags
##########################################################################
ROOT_PATH = .
INCLUDE_PATHS = -I$(ROOT_PATH) -I$(ROOT_PATH)/core
include $(ROOT_PATH)/Makefile.inc
LDFLAGS+= -Wl,--gc-sections
OBJS += lpc1xxx/$(TARGET)_handlers.o lpc1xxx/LPC1xxx_startup.o
##########################################################################
# Startup files
##########################################################################
LDLIBS = -lm
LDLIBS += -Lapplications -lapp
LDLIBS += -Lfunk -lfunk
2011-07-10 16:02:07 +00:00
LDLIBS += -Lusbcdc -lusbcdc
LDLIBS += -Lfilesystem -lfat
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-07-27 23:32:13 +00:00
LDLIBS += -lbasic
LDLIBS += -lfunk
OCFLAGS = --strip-unneeded
SUBDIRS?= $(foreach lib,$(LIBS),$(dir $(lib)))
LD_PATH = lpc1xxx
LD_SCRIPT = $(LD_PATH)/linkscript.ld
LD_TEMP = $(LD_PATH)/memory.ld
### User targets:
all: $(OUTFILE).bin
protect: $(OUTFILE).bin
2011-08-05 13:31:32 +00:00
$(LPCFIX) -p 1 $(OUTFILE).bin
loadables: $(OUTFILE).bin
@cd loadable && $(MAKE)
l0dables:
@cd l0dable && $(MAKE)
clean:
rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex
for dir in $(SUBDIRS); do \
$(MAKE) $(CONFIG_MAKE_PRINTDIRECTORY) -C $$dir clean; \
done
2011-08-03 19:58:39 +00:00
$(MAKE) $(CONFIG_MAKE_PRINTDIRECTORY) -C l0dable clean
2011-07-10 12:24:05 +00:00
flash: all
../tools/bootloader/autoflash
### Internal targets
%.o : %.c
$(CC) $(CFLAGS) -o $@ $<
### Make all libraries...
.PHONY: subdirs $(SUBDIRS)
subdirs: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) ROOT_PATH=../$(ROOT_PATH) $(CONFIG_MAKE_PRINTDIRECTORY) -C $@
2011-06-19 20:03:37 +00:00
../tools/bootloader/lpcfix:
cd ../tools/bootloader && $(MAKE)
$(LD_TEMP):
-@echo "MEMORY" > $(LD_TEMP)
-@echo "{" >> $(LD_TEMP)
-@echo " flash(rx): ORIGIN = 0x00000000, LENGTH = $(FLASH)" >> $(LD_TEMP)
-@echo " sram(rwx): ORIGIN = 0x10000000+$(SRAM_USB), LENGTH = $(SRAM)-$(SRAM_USB)-$(RAMCODE)" >> $(LD_TEMP)
-@echo "}" >> $(LD_TEMP)
-@echo "INCLUDE $(LD_SCRIPT)" >> $(LD_TEMP)
$(OUTFILE).elf: $(OBJS) $(SYS_OBJS) $(SUBDIRS) $(LPCFIX) $(LD_TEMP)
$(CC) $(LDFLAGS) -T $(LD_TEMP) -o $(OUTFILE).elf $(OBJS) $(LDLIBS)
-@echo ""
$(SIZE) $(OUTFILE).elf
-@echo ""
2011-05-13 13:20:08 +00:00
%.bin: %.elf
$(OBJCOPY) $(OCFLAGS) -O binary $< $@
-@echo ""
$(LPCFIX) -c $@
2011-05-13 13:20:08 +00:00
.PHONY: $(LD_TEMP)