1- CCES := /c/analog/cces/3.0.0
2- CCES_VERSION := $(shell echo $(CCES ) | grep -oP '\d+\.\d+\.\d+')
3- ROOT_DIR := ./TFLM/src
1+ include ./tools/sharcfx/sharcfx.mk
42
5- TARGET := ADSP-SC835
6- CONFIG := RELEASE
73BUILD_DIR := ./build
8-
9- LIBNN :=
10- LIBTFLM := $(BUILD_DIR ) /libTFLM.a
11- OBJ_LIST := $(BUILD_DIR ) /objs.txt
12-
13- CCFX++ := $(CCES ) /ccfx++
14- CCFX := $(CCES ) /ccfx
15- XTAR := $(CCES ) /Xtensa/XtensaTools/bin/xt-ar
4+ LIB_SRCS := ./TFLM/src
5+ LIB := libTFLM.a
166
177INCLUDES += \
18- -I"$(ROOT_DIR)/ " \
19- -I"$(ROOT_DIR )/tensorflow/lite/schema" \
20- -I"$(ROOT_DIR )/tensorflow/lite/kernels/internal/optimized" \
21- -I"$(ROOT_DIR )/third_party" \
22- -I"$(ROOT_DIR )/third_party/kissfft" \
23- -I"$(ROOT_DIR )/third_party/kissfft/tools" \
24- -I"$(ROOT_DIR )/third_party/flatbuffers/include " \
25- -I"$(ROOT_DIR )/third_party/gemmlowp" \
26- -I"$(ROOT_DIR )/third_party/gemmlowp/internal " \
27- -I"$(ROOT_DIR )/third_party/ruy/ruy/profiler" \
28- -I"$(ROOT_DIR )/third_party/ruy" \
29- -I"$(ROOT_DIR )/third_party/gemmlowp/fixedpoint" \
8+ -I"$(LIB_SRCS) " \
9+ -I"$(LIB_SRCS )/tensorflow/lite/schema" \
10+ -I"$(LIB_SRCS )/tensorflow/lite/kernels/internal/optimized" \
11+ -I"$(LIB_SRCS )/third_party" \
12+ -I"$(LIB_SRCS )/third_party/kissfft" \
13+ -I"$(LIB_SRCS )/third_party/kissfft/tools" \
14+ -I"$(LIB_SRCS )/third_party/gemmlowp " \
15+ -I"$(LIB_SRCS )/third_party/gemmlowp/internal " \
16+ -I"$(LIB_SRCS )/third_party/flatbuffers/include " \
17+ -I"$(LIB_SRCS )/third_party/ruy/ruy/profiler" \
18+ -I"$(LIB_SRCS )/third_party/ruy" \
19+ -I"$(LIB_SRCS )/third_party/gemmlowp/fixedpoint" \
3020 -I"./examples/shared" \
3121 -I"./adi_sharcfx_nn/Include"
3222
3323C_SRCS += \
34- $(wildcard $(ROOT_DIR )/third_party/kissfft/tools/*.c) \
35- $(wildcard $(ROOT_DIR )/third_party/kissfft/*.c) \
36- $(wildcard $(ROOT_DIR )/tensorflow/lite/experimental/microfrontend/lib/*.c) \
37- $(wildcard $(ROOT_DIR )/tensorflow/lite/kernels/internal/optimized/*.c) \
24+ $(wildcard $(LIB_SRCS )/third_party/kissfft/tools/*.c) \
25+ $(wildcard $(LIB_SRCS )/third_party/kissfft/*.c) \
26+ $(wildcard $(LIB_SRCS )/tensorflow/lite/experimental/microfrontend/lib/*.c) \
27+ $(wildcard $(LIB_SRCS )/tensorflow/lite/kernels/internal/optimized/*.c) \
3828 $(wildcard ./examples/shared/*.c)
3929
4030CC_SRCS += \
41- $(wildcard $(ROOT_DIR)/tensorflow/lite/schema/*.cc) \
42- $(wildcard $(ROOT_DIR)/tensorflow/lite/micro/tflite_bridge/*.cc) \
43- $(wildcard $(ROOT_DIR)/tensorflow/lite/micro/models/*.cc) \
44- $(wildcard $(ROOT_DIR)/tensorflow/lite/micro/memory_planner/*.cc) \
45- $(wildcard $(ROOT_DIR)/tensorflow/lite/micro/kernels/*.cc) \
46- $(wildcard $(ROOT_DIR)/tensorflow/lite/micro/arena_allocator/*.cc) \
47- $(wildcard $(ROOT_DIR)/tensorflow/lite/micro/*.cc) \
48- $(wildcard $(ROOT_DIR)/tensorflow/lite/kernels/internal/reference/*.cc) \
49- $(wildcard $(ROOT_DIR)/tensorflow/lite/kernels/internal/*.cc) \
50- $(wildcard $(ROOT_DIR)/tensorflow/lite/kernels/*.cc) \
51- $(wildcard $(ROOT_DIR)/tensorflow/lite/experimental/microfrontend/lib/*.cc) \
52- $(wildcard $(ROOT_DIR)/tensorflow/lite/core/c/*.cc) \
53- $(wildcard $(ROOT_DIR)/tensorflow/lite/core/api/*.cc)
54-
55- CPP_SRCS+ = \
56- $(wildcard $(ROOT_DIR)/tensorflow/lite/kernels/internal/optimized/*.cpp)
57-
58- C_OBJS = $(patsubst % .c,$(BUILD_DIR ) /% .o,$(subst ./,,$(C_SRCS ) ) )
59- CC_OBJS = $(patsubst % .cc,$(BUILD_DIR ) /% .o,$(subst ./,,$(CC_SRCS ) ) )
60- CPP_OBJS = $(patsubst % .cpp,$(BUILD_DIR ) /% .o,$(subst ./,,$(CPP_SRCS ) ) )
61-
62- SRC_OBJS = $(C_OBJS ) $(CC_OBJS ) $(CPP_OBJS )
63-
64- C_DEPS := $(C_OBJS:.o=.d )
65- CC_DEPS := $(CC_OBJS:.o=.d )
66-
67- ifeq ($(CONFIG ) , RELEASE)
68- FLAGS = -proc $(TARGET) -si-revision 0.0 -c -O3 -LNO:simd -ffunction-sections -fdata-sections -fno-math-errno -mlongcalls -DCORE1 -DUART_REDIRECT -DNDEBUG $(INCLUDES) -MMD -MP
69- else
70- FLAGS = -proc $(TARGET) -si-revision 0.0 -c -ffunction-sections -fdata-sections -fno-math-errno -mlongcalls -g -DCORE1 -D_DEBUG $(INCLUDES) -MMD -MP
71- endif
72-
73- CC_FLAGS = $(FLAGS ) -std=c++11 -stdlib=libc++
74- C_FLAGS = $(FLAGS ) -std=c11
75-
76- all : prebuild $(LIBTFLM ) postbuild
77-
78- clean :
79- @echo ' [RM] $(BUILD_DIR)'
80- @rm -rf $(BUILD_DIR )
81-
82- prebuild :
83- @echo ' Building $(LIBTFLM) for $(TARGET) in $(CONFIG) configuration'
84- @echo ' Using CCES Version $(CCES_VERSION)'
85- @echo
86-
87- postbuild :
88-
89- $(LIBTFLM ) : $(SRC_OBJS )
90- @echo ' [AR] Archiving to $(LIBTFLM)'
91- @$(XTAR ) -r $(LIBTFLM ) @$(OBJ_LIST )
92- @echo
93- @echo ' [AR] Done. See $(LIBTFLM)'
94-
95- $(BUILD_DIR ) /% .o : % .c
96- @mkdir -p $(dir $@ )
97- @echo ' [CC] $<'
98- @$(CCFX ) $(C_FLAGS ) -MF" $( @:%.o=%.d) " -MT" $( @) " -o " $@ " " $<"
99- @echo " \" ./$@ \" " >> $(OBJ_LIST )
100-
101- $(BUILD_DIR ) /% .o : % .cc
102- @mkdir -p $(dir $@ )
103- @echo ' [CX] $<'
104- @$(CCFX++ ) $(CC_FLAGS ) -MF" $( @:%.o=%.d) " -MT" $( @) " -o " $@ " " $<"
105- @echo " \" ./$@ \" " >> $(OBJ_LIST )
106-
107- $(BUILD_DIR ) /% .o : % .cpp
108- @mkdir -p $(dir $@ )
109- @echo ' [CX] $<'
110- @$(CCFX++ ) $(CC_FLAGS ) -MF" $( @:%.o=%.d) " -MT" $( @) " -o " $@ " " $<"
111- @echo " \" ./$@ \" " >> $(OBJ_LIST )
112-
113- .PHONY : all clean prebuild postbuild
31+ $(wildcard $(LIB_SRCS)/tensorflow/lite/schema/*.cc) \
32+ $(wildcard $(LIB_SRCS)/tensorflow/lite/micro/tflite_bridge/*.cc) \
33+ $(wildcard $(LIB_SRCS)/tensorflow/lite/micro/models/*.cc) \
34+ $(wildcard $(LIB_SRCS)/tensorflow/lite/micro/memory_planner/*.cc) \
35+ $(wildcard $(LIB_SRCS)/tensorflow/lite/micro/kernels/*.cc) \
36+ $(wildcard $(LIB_SRCS)/tensorflow/lite/micro/arena_allocator/*.cc) \
37+ $(wildcard $(LIB_SRCS)/tensorflow/lite/micro/*.cc) \
38+ $(wildcard $(LIB_SRCS)/tensorflow/lite/kernels/internal/reference/*.cc) \
39+ $(wildcard $(LIB_SRCS)/tensorflow/lite/kernels/internal/*.cc) \
40+ $(wildcard $(LIB_SRCS)/tensorflow/lite/kernels/*.cc) \
41+ $(wildcard $(LIB_SRCS)/tensorflow/lite/experimental/microfrontend/lib/*.cc) \
42+ $(wildcard $(LIB_SRCS)/tensorflow/lite/core/c/*.cc) \
43+ $(wildcard $(LIB_SRCS)/tensorflow/lite/core/api/*.cc)
44+
45+ include ./tools/sharcfx/lib.mk
0 commit comments