From 10b94164d130a51e8bc45fcdddd6f12eab1f273c Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Mon, 9 Sep 2024 11:05:55 +0200 Subject: [PATCH] igo_nr: enable building as an llext module Add support for LLEXT building to igo_nr. Only building in a stub configuration is supported, linking with a prebuilt library should be implemented separately. Signed-off-by: Guennadi Liakhovetski --- app/boards/intel_adsp_ace15_mtpm.conf | 1 + src/audio/igo_nr/Kconfig | 2 +- src/audio/igo_nr/igo_nr.c | 19 +++++++++++++++++++ src/audio/igo_nr/igo_nr.toml | 5 ++++- src/audio/igo_nr/llext/CMakeLists.txt | 14 ++++++++++++++ src/audio/igo_nr/llext/llext.toml.h | 6 ++++++ zephyr/CMakeLists.txt | 18 ++++++++++++------ 7 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 src/audio/igo_nr/llext/CMakeLists.txt create mode 100644 src/audio/igo_nr/llext/llext.toml.h diff --git a/app/boards/intel_adsp_ace15_mtpm.conf b/app/boards/intel_adsp_ace15_mtpm.conf index 0410badf1dc0..b8ac188bd250 100644 --- a/app/boards/intel_adsp_ace15_mtpm.conf +++ b/app/boards/intel_adsp_ace15_mtpm.conf @@ -95,6 +95,7 @@ CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000 # Modular by default components. Compile-tested but usually not needed at run-time CONFIG_COMP_RTNR=m CONFIG_DTS_CODEC=m +CONFIG_COMP_IGO_NR=m CONFIG_COMP_GOOGLE_CTC_AUDIO_PROCESSING=m # This mock is part of official sof-bin releases because the CI that # tests it can't use extra CONFIGs. See #9410, #8722 and #9386 diff --git a/src/audio/igo_nr/Kconfig b/src/audio/igo_nr/Kconfig index 9dd2dacf48a3..be987594f4ee 100644 --- a/src/audio/igo_nr/Kconfig +++ b/src/audio/igo_nr/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause config COMP_IGO_NR - bool "IGO NR component" + tristate "IGO NR component" select COMP_BLOB select COMP_IGO_NR_STUB if COMP_STUBS default n diff --git a/src/audio/igo_nr/igo_nr.c b/src/audio/igo_nr/igo_nr.c index 00b7591bdb57..469cc5405b02 100644 --- a/src/audio/igo_nr/igo_nr.c +++ b/src/audio/igo_nr/igo_nr.c @@ -886,3 +886,22 @@ static const struct module_interface igo_nr_interface = { DECLARE_MODULE_ADAPTER(igo_nr_interface, igo_nr_uuid, igo_nr_tr); SOF_MODULE_INIT(igo_nr, sys_comp_module_igo_nr_interface_init); + +#if CONFIG_COMP_IGO_NR_MODULE +/* modular: llext dynamic link */ + +#include +#include +#include + +#define UUID_IGO_NR 0xBC, 0xE2, 0x6A, 0x69, 0x77, 0x28, 0xEB, 0x11, 0xC1, 0xAD, \ + 0x02, 0x42, 0xAC, 0x12, 0x00, 0x02 + +SOF_LLEXT_MOD_ENTRY(igo_nr, &igo_nr_interface); + +static const struct sof_man_module_manifest mod_manifest __section(".module") __used = + SOF_LLEXT_MODULE_MANIFEST("IGO_NR", igo_nr_llext_entry, 1, UUID_IGO_NR, 40); + +SOF_LLEXT_BUILDINFO; + +#endif diff --git a/src/audio/igo_nr/igo_nr.toml b/src/audio/igo_nr/igo_nr.toml index b0be41b21878..ad14ad2a7691 100644 --- a/src/audio/igo_nr/igo_nr.toml +++ b/src/audio/igo_nr/igo_nr.toml @@ -1,3 +1,6 @@ +#ifndef LOAD_TYPE +#define LOAD_TYPE "0" +#endif REM # IGO_NR module config [[module.entry]] @@ -6,7 +9,7 @@ affinity_mask = "0x1" instance_count = "40" domain_types = "0" - load_type = "0" + load_type = LOAD_TYPE module_type = "9" auto_start = "0" sched_caps = [1, 0x00008000] diff --git a/src/audio/igo_nr/llext/CMakeLists.txt b/src/audio/igo_nr/llext/CMakeLists.txt new file mode 100644 index 000000000000..2e974cae7945 --- /dev/null +++ b/src/audio/igo_nr/llext/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Intel Corporation. +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_DTS_CODEC_STUB) +sof_llext_build("igo_nr" + SOURCES ../igo_nr.c + ../igo_nr_stub.c +) +target_include_directories(igo_nr_llext_lib PRIVATE + "../../../../third_party/include" +) +else() +message(FATAL_ERROR "Add library linking support in src/audio/codec/igo_nr/llext/CMakeLists.txt") +endif() diff --git a/src/audio/igo_nr/llext/llext.toml.h b/src/audio/igo_nr/llext/llext.toml.h new file mode 100644 index 000000000000..b7a3322dc906 --- /dev/null +++ b/src/audio/igo_nr/llext/llext.toml.h @@ -0,0 +1,6 @@ +#include +#define LOAD_TYPE "2" +#include "../igo_nr.toml" + +[module] +count = __COUNTER__ diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 3c33e8f1a3b7..94b0dc194a3e 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -901,13 +901,19 @@ elseif(CONFIG_COMP_GOOGLE_CTC_AUDIO_PROCESSING) endif() endif() -zephyr_library_sources_ifdef(CONFIG_COMP_IGO_NR - ${SOF_AUDIO_PATH}/igo_nr/igo_nr.c -) +if(CONFIG_COMP_IGO_NR STREQUAL "m") + add_subdirectory(${SOF_AUDIO_PATH}/igo_nr/llext + ${PROJECT_BINARY_DIR}/igo_nr_llext) + add_dependencies(app igo_nr) +elseif(CONFIG_COMP_IGO_NR) + zephyr_library_sources( + ${SOF_AUDIO_PATH}/igo_nr/igo_nr.c + ) -zephyr_library_sources_ifdef(CONFIG_COMP_IGO_NR_STUB - ${SOF_AUDIO_PATH}/igo_nr/igo_nr_stub.c -) + zephyr_library_sources_ifdef(CONFIG_COMP_IGO_NR_STUB + ${SOF_AUDIO_PATH}/igo_nr/igo_nr_stub.c + ) +endif() if(CONFIG_COMP_RTNR STREQUAL "m") add_subdirectory(${SOF_AUDIO_PATH}/rtnr/llext