2014-07-04 23:49:08 +08:00
|
|
|
include $(MSCDIR)/software/common.mak
|
|
|
|
|
2015-04-27 17:48:31 +08:00
|
|
|
OBJECTS := isr.o flash_storage.o elf_loader.o services.o session.o log.o test_mode.o kloader.o main.o
|
2015-04-05 22:04:50 +08:00
|
|
|
OBJECTS_KSUPPORT := exception_jmp.o exceptions.o rtio.o dds.o
|
2015-04-04 22:08:32 +08:00
|
|
|
|
2015-04-05 17:55:05 +08:00
|
|
|
# NOTE: this does not handle dependencies well. Run "make clean"
|
|
|
|
# when switching between UP and AMP.
|
2015-04-16 11:13:20 +08:00
|
|
|
UNIPROCESSOR := $(shell printf "\#include <generated/csr.h>\nCSR_KERNEL_CPU_BASE" | $(CC_normal) $(CFLAGS) -E - | tail -n 1 | grep -c CSR_KERNEL_CPU_BASE)
|
2015-04-04 22:08:32 +08:00
|
|
|
|
|
|
|
ifeq ($(UNIPROCESSOR),0)
|
2015-04-22 01:31:31 +08:00
|
|
|
OBJECTS += mailbox.o ksupport_data.o
|
2015-04-16 21:47:05 +08:00
|
|
|
OBJECTS_KSUPPORT += mailbox.o bridge.o ksupport.o
|
2015-04-05 17:55:05 +08:00
|
|
|
CFLAGS += -DARTIQ_AMP
|
2015-04-04 22:08:32 +08:00
|
|
|
SERVICE_TABLE_INPUT = ksupport.elf
|
|
|
|
else
|
|
|
|
ifeq ($(UNIPROCESSOR),1)
|
2015-04-05 22:04:50 +08:00
|
|
|
OBJECTS += $(OBJECTS_KSUPPORT)
|
2015-04-04 22:08:32 +08:00
|
|
|
else
|
2015-04-05 17:55:05 +08:00
|
|
|
$(error failed to determine UP/AMP build)
|
2015-04-04 22:08:32 +08:00
|
|
|
endif
|
|
|
|
endif
|
2014-07-04 23:49:08 +08:00
|
|
|
|
2015-04-22 15:01:32 +08:00
|
|
|
CFLAGS += -Ilwip/src/include -Iliblwip
|
|
|
|
|
2015-04-15 14:05:34 +08:00
|
|
|
all: runtime.bin runtime.fbi
|
2014-07-04 23:49:08 +08:00
|
|
|
|
|
|
|
# pull in dependency info for *existing* .o files
|
|
|
|
-include $(OBJECTS:.o=.d)
|
|
|
|
|
|
|
|
%.bin: %.elf
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
2015-04-03 17:44:56 +08:00
|
|
|
@chmod -x $@
|
2014-07-04 23:49:08 +08:00
|
|
|
|
|
|
|
%.fbi: %.bin
|
2015-04-15 14:05:34 +08:00
|
|
|
@echo " MSCIMG " $@ && $(MSCDIR)/mkmscimg.py -f -o $@ $<
|
2014-07-04 23:49:08 +08:00
|
|
|
|
|
|
|
runtime.elf: $(OBJECTS) libs
|
|
|
|
$(LD) $(LDFLAGS) \
|
2015-04-03 16:03:38 +08:00
|
|
|
-T linker.ld \
|
2014-07-04 23:49:08 +08:00
|
|
|
-N -o $@ \
|
|
|
|
$(MSCDIR)/software/libbase/crt0-$(CPU).o \
|
|
|
|
$(OBJECTS) \
|
|
|
|
-L$(MSCDIR)/software/libbase \
|
|
|
|
-L$(MSCDIR)/software/libcompiler-rt \
|
2015-04-17 16:38:46 +08:00
|
|
|
-Lliblwip \
|
|
|
|
-lbase -lcompiler-rt -llwip
|
2015-04-03 17:44:56 +08:00
|
|
|
@chmod -x $@
|
|
|
|
|
2015-04-05 22:04:50 +08:00
|
|
|
ksupport.elf: $(OBJECTS_KSUPPORT)
|
2015-04-03 17:44:56 +08:00
|
|
|
$(LD) $(LDFLAGS) \
|
|
|
|
-T ksupport.ld \
|
|
|
|
-N -o $@ \
|
|
|
|
$(MSCDIR)/software/libbase/crt0-$(CPU).o \
|
2015-04-04 22:08:32 +08:00
|
|
|
$^
|
2015-04-03 17:44:56 +08:00
|
|
|
@chmod -x $@
|
|
|
|
|
|
|
|
ksupport_data.o: ksupport.bin
|
|
|
|
$(LD) -r -b binary -o $@ $<
|
2014-07-04 23:49:08 +08:00
|
|
|
|
2015-04-14 19:44:45 +08:00
|
|
|
service_table.h: $(SERVICE_TABLE_INPUT) gen_service_table.py
|
2015-04-04 22:08:32 +08:00
|
|
|
@echo " GEN " $@ && ./gen_service_table.py $(SERVICE_TABLE_INPUT) > $@
|
|
|
|
|
|
|
|
services.c: service_table.h
|
|
|
|
|
2014-07-04 23:49:08 +08:00
|
|
|
main.o: main.c
|
|
|
|
$(compile-dep)
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(compile-dep)
|
|
|
|
|
|
|
|
%.o: %.S
|
|
|
|
$(assemble)
|
|
|
|
|
|
|
|
libs:
|
|
|
|
$(MAKE) -C $(MSCDIR)/software/libcompiler-rt
|
|
|
|
$(MAKE) -C $(MSCDIR)/software/libbase
|
2015-04-17 16:38:46 +08:00
|
|
|
$(MAKE) -C liblwip
|
2014-07-04 23:49:08 +08:00
|
|
|
|
|
|
|
clean:
|
2015-04-17 16:38:46 +08:00
|
|
|
$(MAKE) -C liblwip clean
|
2015-04-05 22:04:50 +08:00
|
|
|
$(RM) $(OBJECTS) $(OBJECTS:.o=.d) $(OBJECTS_KSUPPORT) $(OBJECTS_KSUPPORT:.o=.d)
|
2015-04-04 22:08:32 +08:00
|
|
|
$(RM) runtime.elf runtime.bin runtime.fbi .*~ *~
|
2015-04-05 22:04:50 +08:00
|
|
|
$(RM) service_table.h ksupport.elf ksupport.bin
|
2014-07-04 23:49:08 +08:00
|
|
|
|
|
|
|
.PHONY: all main.o clean libs load
|