Skip to content

Commit

Permalink
modules/asmp: Add config options for library selection
Browse files Browse the repository at this point in the history
Add config options to select use of some libraries.
  • Loading branch information
SPRESENSE committed Dec 2, 2024
1 parent 2e66d0a commit 75d37ef
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
-SCHED_LPWORK=y
+ASMP=y
+ASMP_WORKER_LIBC=y
+ASMP_WORKER_CMSIS=y
+AUDIO=y
+AUDIO_CXD56=y
+AUDIO_FORMAT_MP3=n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
-SCHED_LPWORK=y
+ASMP=y
+ASMP_WORKER_LIBC=y
+ASMP_WORKER_CMSIS=y
+AUDIO=y
+AUDIO_CXD56=y
+AUDIO_FORMAT_MP3=n
Expand Down
2 changes: 2 additions & 0 deletions sdk/configs/feature/audiolite/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
-MMCSD_SDIO=y
-SCHED_LPWORK=y
+ASMP=y
+ASMP_WORKER_CMSIS=y
+ASMP_WORKER_FMSYNTH=y
+ASMP_WORKER_LIBC=y
+AUDIO=y
+AUDIO_CXD56=y
Expand Down
11 changes: 11 additions & 0 deletions sdk/modules/asmp/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,29 @@ config ASMP_SMALL_BLOCK
Use small block size (64 KiB) to memory management.
This option is for improve memory usage, but it tends to fragmentation.

menu "ASMP Worker libraries"

config ASMP_WORKER_LIBC
bool "Support some libc functions in worker"
default n
---help---
Support some libraries such as ctype, string, queue, fixedmath and etc. in worker.

config ASMP_WORKER_CMSIS
bool "Support ARM CMSIS math library in worker"
default n
---help---
Support ARM CMSIS math library in worker. For enabling this, you must set
CONFIG_EXTERNALS_CMSIS to build the library itself.

config ASMP_WORKER_FMSYNTH
bool "Support fmsynth library in worker"
default n
---help---
Support fmsynth library. The code is in sdk/apps/audioutils/fmsynth

endmenu

config ASMP_DEBUG_FEATURE
bool "ASMP Framework debug feature"

Expand Down
3 changes: 2 additions & 1 deletion sdk/modules/asmp/worker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ include $(APPDIR)/Make.defs

include mkfiles/libc.mk
include mkfiles/fmsynth.mk
include mkfiles/cmsis.mk

VPATH = arch $(EXT_VPATH)
SUBDIRS =
Expand Down Expand Up @@ -72,7 +73,7 @@ CFLAGS += -fno-tree-loop-distribute-patterns -DCXD5602_WORKER

AFLAGS += -isystem $(SDKDIR)/modules/include

all: $(BIN)
all: $(BIN) | $(EXT_LIBS)
.PHONY: context depend clean distclean

$(AOBJS): %$(OBJEXT): %.S
Expand Down
25 changes: 25 additions & 0 deletions sdk/modules/asmp/worker/mkfiles/cmsis.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ifneq ($(CONFIG_ASMP_WORKER_CMSIS),)

ifneq ($(CONFIG_EXTERNALS_CMSIS),y)
$(error You must set CONFIG_EXTERNALS_CMSIS to use it in worker)
endif

EXT_LIBS ?=

CMSISDIR = $(SDKDIR)$(DELIM)..$(DELIM)externals$(DELIM)cmsis
CMSIS_DSP_DIR = $(CMSISDIR)$(DELIM)dsp

# Setup to build and linking CMSIS DSP library

include $(CMSISDIR)/LibIncludes.mk

CMSIS_DSP_LIB = $(CMSIS_DSP_DIR)$(DELIM)libarm_cortexM4lf_math$(LIBEXT)
LDLIBPATH += -L $(CMSIS_DSP_DIR)
LDLIBS += -larm_cortexM4lf_math

$(CMSIS_DSP_LIB):
$(Q) $(MAKE) -C $(CMSIS_DSP_DIR) TOPDIR="$(TOPDIR)" SDKDIR="$(SDKDIR)" APPDIR="$(APPDIR)"

EXT_LIBS += $(CMSIS_DSP_LIB)

endif
6 changes: 3 additions & 3 deletions sdk/modules/asmp/worker/mkfiles/fmsynth.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ EXT_DEPPATH ?=
EXT_CSRCS ?=
EXT_INCPATH ?=

NXAPPS_PATH = $(SDKDIR)/apps/include
FMSYNTH_PATH = $(SDKDIR)/apps/audioutils
NXAPPS_INCPATH = $(SDKDIR)/apps/include
FMSYNTH_PATH = $(SDKDIR)/apps/audioutils/fmsynth

EXT_VPATH += $(FMSYNTH_PATH)
EXT_DEPPATH += --dep-path $(FMSYNTH_PATH)
EXT_CSRCS += $(notdir $(wildcard $(FMSYNTH_PATH)/*.c))
EXT_INCPATH += -I $(NXAPPS_PATH)
EXT_INCPATH += -I $(NXAPPS_INCPATH)

endif
9 changes: 5 additions & 4 deletions sdk/modules/asmp/worker/mkfiles/libc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ LIBC_LIBS += fixedmath
LIBC_LIBS += string
LIBC_LIBS += queue

LIBC_EXTRA_SRC = lib_modff.c lib_floorf.c lib_fabsf.c
LIBC_EXTRA_SRC = lib_modff.c lib_floorf.c lib_fabsf.c lib_libexpif.c lib_expf.c lib_logf.c

LIBC_LIBSPATH = $(patsubst %,$(LIBC_PATH)/%,$(LIBC_LIBS))
LIBC_LIBSPATH = $(patsubst %,$(LIBC_PATH)/%,$(LIBC_LIBS)) $(LIBM_PATH)/libm
LIBC_TGTPATH = $(LIBC_LIBSPATH) $(LIBM_PATH)/libm
LIBC_CSRCS = $(notdir $(foreach p,$(LIBC_LIBSPATH),$(wildcard $(p)/*.c))) $(LIBC_EXTRA_SRC)
# LIBC_CSRCS = $(notdir $(foreach p,$(LIBC_LIBSPATH),$(wildcard $(p)/*.c))) $(LIBC_EXTRA_SRC)
LIBC_CSRCS = $(notdir $(foreach p,$(LIBC_LIBSPATH),$(wildcard $(p)/*.c)))
LIBC_DEPPATH = --dep-path $(NXINC_PATH) --dep-path $(NXINC_PATH)/nuttx/lib $(patsubst %,--dep-path %,$(LIBC_TGTPATH))
LIBC_INCPATH = -I$(NXINC_PATH) -I$(NXINC_PATH)/nuttx/lib -I$(LIBC_PATH) -DCONFIG_ARCH_STDARG_H
LIBC_INCPATH = -I$(NXINC_PATH) -I$(NXINC_PATH)/nuttx/lib -I$(LIBC_PATH) -DCONFIG_ARCH_STDARG_H -DCONFIG_LIBM

EXT_VPATH += $(LIBC_TGTPATH)
EXT_DEPPATH += $(LIBC_DEPPATH)
Expand Down
5 changes: 1 addition & 4 deletions sdk/modules/audiolite/worker/common/mkfiles/alworker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ WORKER_LIB = $(WORKER_DIR)$(DELIM)libasmpw$(LIBEXT)
LDLIBPATH += -L $(WORKER_DIR)
LDLIBS += -lasmpw

ifeq ($(ALWORKER_USE_CMSIS),1)
ifneq ($(CONFIG_ASMP_WORKER_CMSIS),)
include $(ALWORKER_COMMONMKS)/cmsis.mk
endif

ifeq ($(ALWORKER_USE_RESAMPLER),1)
ifneq ($(ALWORKER_USE_CMSIS),1)
include $(ALWORKER_COMMONMKS)/cmsis.mk
endif
include $(ALWORKER_COMMONMKS)/resampler.mk
endif

Expand Down
8 changes: 0 additions & 8 deletions sdk/modules/audiolite/worker/common/mkfiles/cmsis.mk
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
CMSISDIR = $(SDKDIR)$(DELIM)..$(DELIM)externals$(DELIM)cmsis
CMSIS_DSP_DIR = $(CMSISDIR)$(DELIM)dsp

# CONFIG_EXTERNALS_CMSIS = y
# CONFIG_EXTERNALS_CMSIS_DSP = y
# CONFIG_EXTERNALS_CMSIS_NN = y

# Setup to build and linking CMSIS DSP library

include $(CMSISDIR)/LibIncludes.mk

CMSIS_DSP_LIB = $(CMSIS_DSP_DIR)$(DELIM)libarm_cortexM4lf_math$(LIBEXT)
LDLIBPATH += -L $(CMSIS_DSP_DIR)
LDLIBS += -larm_cortexM4lf_math

$(CMSIS_DSP_LIB):
$(Q) $(MAKE) -C $(CMSIS_DSP_DIR) TOPDIR="$(TOPDIR)" SDKDIR="$(SDKDIR)" APPDIR="$(APPDIR)"

5 changes: 5 additions & 0 deletions sdk/modules/audiolite/worker/common/mkfiles/resampler.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
ifneq ($(CONFIG_ASMP_WORKER_CMSIS),y)
$(error resampler uses CMSIS,
you must set CONFIG_ASMP_WORKER_CMSIS and CONFIG_EXTERNAL_CMSIS.)
endif

SPEEXDSP_DIR = $(ALWORKER_COMMON)/../ext_libs/speexdsp_resample

CSRCS += resample.c
Expand Down

0 comments on commit 75d37ef

Please sign in to comment.