crashtest-r0ket/firmware/Makefile

126 lines
2.8 KiB
Makefile
Raw Normal View History

VPATH =
OBJS =
LIBS =
##########################################################################
# Project-specific files
##########################################################################
VPATH +=
OBJS += main.o
ifeq "$(TABLE)" "NO"
2011-08-06 14:24:50 +00:00
OBJS +=
else
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
LIBS += flame/libflame.a
##########################################################################
# GNU GCC compiler flags
##########################################################################
ROOT_PATH = .
INCLUDE_PATHS = -I$(ROOT_PATH) -I$(ROOT_PATH)/core
include $(ROOT_PATH)/Makefile.inc
ifdef APP
OUTFILE=$(APP)
endif
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
LDLIBS += -Lflame -lflame
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
$(LPCFIX) -p 2 $(OUTFILE).bin
l0dables: table.c
@cd l0dable && $(MAKE)
clean:
rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex table.c table.h
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/simpleflash $(OUTFILE).bin
### Internal targets
%.o : %.c
$(CC) $(CFLAGS) -o $@ $<
table.c: l0dable/EXPORTS
./l0dable/mktable.pl
### 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)