2 include ../Makefile.commons
4 SAMPLE_OUT := tests/master/nucleus/echo_test/nucleus_linux/echo_test.out
5 SAMPLE_C_SRC := tests/master/nucleus/echo_test/nucleus_linux/echo_test.c
6 REMOTE_OUT := echo_test.out
7 DST_DIR := tests/master/nucleus/echo_test/nucleus_linux
8 LINUX_SRC_DIR := firmware/$(PLAT)/linux
10 SAMPLEOBJFILES := $(patsubst %.c, %.o, $(SAMPLE_C_SRC))
11 SAMPLE_DEPS := $(patsubst %.c, %.d, $(SAMPLE_C_SRC))
12 SAMPLE_MAP := $(patsubst %.out, %.map, $(SAMPLE_OUT))
13 SAMPLE_BIN := $(patsubst %.out, %.bin, $(SAMPLE_OUT))
15 $(SAMPLE_OUT): $(REMOTE_OUT)$(SAMPLEOBJFILES)
17 @echo 'Building echo_test test for nucleus : $@'
19 $(LD) -Wl,-Map=tests/master/nucleus/echo_test/nucleus_linux/echo_test.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
21 $(OBJCPY) -O binary $(SAMPLE_OUT) $(SAMPLE_BIN)
23 @echo 'Finished building target: $@'
25 %.o:%.c
26 @echo CC $(<:.c=.o)
27 @$(CC) $(CFLAGS) $(ARCH_CFLAGS) $(INCLUDE) -c $< -o $@
29 %.o:%.S
30 @$(AS) -c $(ARCH_ASFLAGS) $(INCLUDE) $< -o $@
32 $(REMOTE_OUT):
33 cd $(LINUX_SRC_DIR)/; cp firmware firmware1; \
34 $(OBJCPY) -I binary -O elf32-littlearm -B arm firmware1 firmware1.o
35 mv $(LINUX_SRC_DIR)/firmware1.o $(DST_DIR)/firmware1.o
36 cd $(LINUX_SRC_DIR)/; cp firmware firmware2; \
37 $(OBJCPY) -I binary -O elf32-littlearm -B arm firmware2 firmware2.o
38 mv $(LINUX_SRC_DIR)/firmware2.o $(DST_DIR)/
39 cd $(LINUX_SRC_DIR)/; rm firmware1; rm firmware2;
40 clean:
41 -$(RM) $(SAMPLEOBJFILES) $(SAMPLE_DEPS) $(SAMPLE_OUT) $(SAMPLE_BIN) $(DST_DIR)/firmware1.o $(DST_DIR)/firmware2.o $(SAMPLE_MAP)
43 post-build:
44 -@echo ' '
46 secondary-outputs:
48 PHONY: all clean dependents
49 .SECONDARY: post-build