Skip to content

Commit c0ba320

Browse files
committed
build: add NMSIS_LIB_COMPAT variable to specify toolchain builtin dsp/nn library
Signed-off-by: Huaqi Fang <578567190@qq.com>
1 parent 054969e commit c0ba320

5 files changed

Lines changed: 22 additions & 17 deletions

File tree

NMSIS/DSP/Examples/RISCV/Makefile.common

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ RISCV_ALIGN ?= OFF
1313
COMMON_FLAGS ?= -O2
1414
STDCLIB ?= newlib_full
1515

16-
ifeq (${TOOLCHAIN}, terapines)
17-
NMSIS_LIB := tpt_dsp
18-
else
1916
NMSIS_LIB := nmsis_dsp
20-
endif
2117

2218
ifeq ($(BENCH_UNIT),instret)
2319
$(warning "Benchmark by reading cpu instret")

NMSIS/NN/Benchmark/Makefile.common

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ RISCV_ALIGN ?= OFF
99
COMMON_FLAGS ?= -O2
1010
STDCLIB ?= newlib_full
1111

12-
ifeq (${TOOLCHAIN}, terapines)
13-
NMSIS_LIB := tpt_nn
14-
else
1512
NMSIS_LIB := nmsis_nn
16-
endif
1713

1814
SUBDIR:=$(wildcard *)
1915
SRCDIRS += . $(SUBDIR)

NMSIS/NN/Tests/Cases/Makefile.common

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ RISCV_ALIGN ?= OFF
1515
COMMON_FLAGS ?= -O2
1616
STDCLIB ?= newlib_full
1717

18-
ifeq (${TOOLCHAIN}, terapines)
19-
NMSIS_LIB := tpt_nn
20-
else
2118
NMSIS_LIB := nmsis_nn
22-
endif
2319

2420
ifeq ($(BENCH_UNIT),instret)
2521
$(warning "Benchmark by reading cpu instret")

NMSIS/Scripts/Build/Makefile.nmsis

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ EXTRA_NLOPTS +=
5252
endif
5353

5454
ifneq ($(EXTRAOPTS),)
55-
EXTRA_NLOPTS += --extraopts ${EXTRAOPTS}
55+
EXTRA_NLOPTS += --extraopts $(EXTRAOPTS)
5656
endif
5757

5858
ifneq ($(TOOLCHAIN),)

NMSIS/build.mk

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,36 @@ NMSIS_LIB_ARCH ?= $(RISCV_ARCH)
33

44
INCDIRS += $(NUCLEI_SDK_NMSIS)/Core/Include
55

6+
# When set to 1, will use compatiable library
7+
# provided in toolchain such as terapines zcc toolchain
8+
# present NMSIS DSP/NN compatiable library
9+
NMSIS_LIB_COMPAT ?=
10+
611
ifeq ($(filter nmsis_nn,$(NMSIS_LIB_SORTED)),nmsis_nn)
712
INCDIRS += $(NUCLEI_SDK_NMSIS)/NN/Include
813
LIBDIRS += $(NUCLEI_SDK_NMSIS)/Library/NN/GCC
9-
LDLIBS += -lnmsis_nn_$(NMSIS_LIB_ARCH)
10-
else ifeq ($(filter tpt_nn,$(NMSIS_LIB_SORTED)),tpt_nn)
14+
ifeq ($(TOOLCHAIN),terapines)
15+
ifeq ($(NMSIS_LIB_COMPAT),1)
1116
LDLIBS += -lnn
17+
else
18+
LDLIBS += -lnmsis_nn_$(NMSIS_LIB_ARCH)
19+
endif
20+
else
21+
LDLIBS += -lnmsis_nn_$(NMSIS_LIB_ARCH)
22+
endif
1223
endif
1324

1425
ifeq ($(filter nmsis_dsp,$(NMSIS_LIB_SORTED)),nmsis_dsp)
1526
INCDIRS += $(NUCLEI_SDK_NMSIS)/DSP/Include \
1627
$(NUCLEI_SDK_NMSIS)/DSP/PrivateInclude
1728
LIBDIRS += $(NUCLEI_SDK_NMSIS)/Library/DSP/GCC
18-
LDLIBS += -lnmsis_dsp_$(NMSIS_LIB_ARCH)
19-
else ifeq ($(filter tpt_dsp,$(NMSIS_LIB_SORTED)),tpt_dsp)
29+
ifeq ($(TOOLCHAIN),terapines)
30+
ifeq ($(NMSIS_LIB_COMPAT),1)
2031
LDLIBS += -ldsp
32+
else
33+
LDLIBS += -lnmsis_dsp_$(NMSIS_LIB_ARCH)
34+
endif
35+
else
36+
LDLIBS += -lnmsis_dsp_$(NMSIS_LIB_ARCH)
37+
endif
2138
endif

0 commit comments

Comments
 (0)