3 # Host and Epiphany application destination
6 # Host source and object folder
10 # Epiphany source, library and object folder
15 # Host application and host objects
17 HOSTAPP = $(DEST)/ep_application
18 HOBJS = $(HDEST)/main.o
20 # Epiphany applications and common objects
21 EPAPPS = $(DEST)/Gen.srec $(DEST)/Square.srec #$(DEST)/Beam_Former.srec
22 EWRAPPERS = $(patsubst $(DEST)%,$(EDEST)%,$(EPAPPS:.srec=_Wrapper.o))
23 ECOMMON = $(EDEST)/dol.o $(EDEST)/ports.o $(EDEST)/index.o
25 # Epiphany build flags
28 CFLAGS = -O2 -std=c99 -Ilib -falign-loops=8 -falign-functions=8 -Wall
29 LFLAGS = -T$(EPIPHANY_HOME)/bsps/current/fast.ldf -le-lib
30 OCFLAGS = -R .shared_dram -R .data_bank3
34 HCFLAGS = -O2 -std=c99 -I$(EPIPHANY_HOME)/tools/host/include -Wall
35 HLFLAGS = -L$(EPIPHANY_HOME)/tools/host/lib -le-hal
39 .PHONY: all run host cores clean
44 cores: $(ECOMMON) $(EWRAPPERS) $(EPAPPS)
48 @sudo LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \
49 EPIPHANY_HDF=$(EPIPHANY_HDF) \
54 @rm -v -f $(HOSTAPP) $(EPAPPS) $(EDEST)/* $(HDEST)/*
58 @$(ECHO) "\t(HOST) LINK\t$@"
59 @$(HOSTCC) -o $@ $^ $(HLFLAGS)
61 $(HDEST)/%.o: $(HSRC)/%.c
62 @$(ECHO) "\t(HOST) CC\t$@"
63 @$(HOSTCC) $(HCFLAGS) -c -o $@ $^
66 $(DEST)/%.srec: $(EDEST)/%.elf
67 @$(ECHO) "\t(EPIPHANY) OBJCOPY $@"
68 @$(OBJCOPY) $(OCFLAGS) --output-target srec --srec-forceS3 $^ $@
70 $(EDEST)/%.elf: $(EDEST)/%.o $(EDEST)/%_Wrapper.o $(ECOMMON)
71 @$(ECHO) "\t(EPIPHANY) LINK\t$@"
72 @$(CC) -o $@ $^ $(LFLAGS)
74 $(EDEST)/%.o: $(ESRC)/%.c
75 @$(ECHO) "\t(EPIPHANY) CC\t$@"
76 @$(CC) $(CFLAGS) -c -o $@ $^
78 $(EDEST)/%.o: $(ELIB)/%.c
79 @$(ECHO) "\t(EPIPHANY) CC\t$@"
80 @$(CC) $(CFLAGS) -c -o $@ $^