Skip to content

Commit

Permalink
igo_nr: enable building as an llext module
Browse files Browse the repository at this point in the history
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 <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh committed Sep 10, 2024
1 parent 7c84a82 commit 0719bf9
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/boards/intel_adsp_ace15_mtpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ CONFIG_COMP_RTNR=m
CONFIG_COMP_RTNR_STUB=y
CONFIG_DTS_CODEC=m
CONFIG_DTS_CODEC_STUB=y
CONFIG_COMP_IGO_NR=m
CONFIG_COMP_IGO_NR_STUB=y
CONFIG_COMP_GOOGLE_CTC_AUDIO_PROCESSING=m
CONFIG_GOOGLE_CTC_AUDIO_PROCESSING_MOCK=y

Expand Down
2 changes: 1 addition & 1 deletion src/audio/igo_nr/Kconfig
Original file line number Diff line number Diff line change
@@ -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
Expand Down
19 changes: 19 additions & 0 deletions src/audio/igo_nr/igo_nr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

#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
5 changes: 4 additions & 1 deletion src/audio/igo_nr/igo_nr.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

REM # IGO_NR module config
[[module.entry]]
Expand All @@ -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]
Expand Down
14 changes: 14 additions & 0 deletions src/audio/igo_nr/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
6 changes: 6 additions & 0 deletions src/audio/igo_nr/llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../igo_nr.toml"

[module]
count = __COUNTER__
18 changes: 12 additions & 6 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -895,13 +895,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
Expand Down

0 comments on commit 0719bf9

Please sign in to comment.