[processor-sdk/open-amp.git] / apps / samples / master / nucleus / matrix_multiply / nucleus_nucleusbm / make
2 include ../Makefile.commons
4 SAMPLE_OUT := samples/master/nucleus/matrix_multiply/nucleus_nucleusbm/matrix_multiply.out
5 SAMPLE_C_SRC := samples/master/nucleus/matrix_multiply/nucleus_nucleusbm/matrix_multiply.c
7 REMOTE_OUT := matrix_multiply.out
8 DST_DIR := samples/master/nucleus/matrix_multiply/nucleus_nucleusbm
9 NU_SRC_DIR := firmware/$(PLAT)/nucleus/matrix_multiply
10 BM_SRC_DIR := firmware/$(PLAT)/baremetal/matrix_multiply
13 SAMPLEOBJFILES := $(patsubst %.c, %.o, $(SAMPLE_C_SRC))
16 SAMPLE_DEPS := $(patsubst %.c, %.d, $(SAMPLE_C_SRC))
18 SAMPLE_MAP := $(patsubst %.out, %.map, $(SAMPLE_OUT))
19 SAMPLE_BIN := $(patsubst %.out, %.bin, $(SAMPLE_OUT))
22 $(SAMPLE_OUT): $(REMOTE_OUT) $(SAMPLEOBJFILES)
24 @echo 'Building master core matrix multiply sample for nucleus : $@'
26 $(LD) -Wl,-Map=samples/master/nucleus/matrix_multiply/nucleus_nucleusbm/matrix_multiply.map -nostartfiles -Wl,--gc-sections -Wl,--wrap=malloc -Wl,--wrap=calloc -Wl,--wrap=realloc -Wl,--wrap=free -T"$(OHOME)/libs/system/$(PLAT)/nucleus/linker_master.ld" -L"$(OHOME)/libs/system/$(PLAT)/nucleus/lib/$(CROSS)/master" -L"$(OHOME)/libs/open_amp" -o "$(SAMPLE_OUT)" -Wl,--start-group $(SAMPLEOBJFILES) $(DST_DIR)/firmware1.o $(DST_DIR)/firmware2.o -lnucleus_master -lopen_amp -lc -lm -lstdc++ -Wl,--end-group
28 $(OBJCPY) -O binary $(SAMPLE_OUT) $(SAMPLE_BIN)
30 @echo 'Finished building target: $@'
32 %.o:%.c
33 @echo CC $(<:.c=.o)
34 @$(CC) $(CFLAGS) $(ARCH_CFLAGS) $(INCLUDE) -c $< -o $@
36 %.o:%.S
37 @$(AS) -c -mcpu=cortex-a9 $(ARCH_ASFLAGS) $(INCLUDE) $< -o $@
39 $(REMOTE_OUT):
40 cd $(NU_SRC_DIR)/; cp firmware firmware1; \
41 $(OBJCPY) -I binary -O elf32-littlearm -B arm firmware1 firmware1.o
42 mv $(NU_SRC_DIR)/firmware1.o $(DST_DIR)/
43 cd $(BM_SRC_DIR)/; cp firmware firmware2; \
44 $(OBJCPY) -I binary -O elf32-littlearm -B arm firmware2 firmware2.o
45 mv $(BM_SRC_DIR)/firmware2.o $(DST_DIR)/
46 cd $(NU_SRC_DIR)/; rm firmware1
47 cd $(BM_SRC_DIR)/; rm firmware2
48 clean:
49 -$(RM) $(SAMPLEOBJFILES) $(SAMPLE_DEPS) $(SAMPLE_OUT) $(SAMPLE_MAP) $(SAMPLE_BIN) $(DST_DIR)/firmware1.o $(DST_DIR)/firmware2.o
51 post-build:
52 -@echo ' '
54 secondary-outputs:
56 PHONY: all clean dependents
57 .SECONDARY: post-build