From c8dd6a68cb2a14f0837a66b3997355464f3904f6 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Fri, 14 Mar 2025 19:21:04 +0200 Subject: [PATCH 01/14] cmake/zephyr: start unifying cmake rules for src/audio/ Adding all source files in a single, giant zephyr/CMakeLists.txt is inconvenient and does not scale. The audio directory is one of the more complex cmake files in the tree, so make the changes incrementally. This commit starts by adding including top/src/audio to Zephyr cmake, and moving over the first set of files. Link: https://github.com/thesofproject/sof/issues/8260 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 35 +++++++++++++++++++++++------------ zephyr/CMakeLists.txt | 7 +------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 0ef1083e3ae8..7750602d1895 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -1,14 +1,30 @@ # SPDX-License-Identifier: BSD-3-Clause +set(base_files + channel_map.c + component.c + source_api_helper.c + sink_api_helper.c + sink_source_utils.c + audio_stream.c + channel_map.c +) + + +is_zephyr(it_is) +if(it_is) ### Zephyr ### + + zephyr_library_sources( + ${base_files} + ) + + return() +endif() + if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) add_local_sources(sof host-legacy.c - component.c - source_api_helper.c - sink_api_helper.c - sink_source_utils.c - audio_stream.c - channel_map.c + ${base_files} ) add_subdirectory(buffers) @@ -125,15 +141,10 @@ if(CONFIG_COMP_MODULE_ADAPTER) endif() add_local_sources(sof - component.c data_blob.c buffers/comp_buffer.c buffers/audio_buffer.c - source_api_helper.c - sink_api_helper.c - sink_source_utils.c - audio_stream.c - channel_map.c + ${base_files} ) # Audio Modules with various optimizaitons diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index aa6a67e754a1..70ed422f3bd2 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -198,6 +198,7 @@ macro(add_local_sources_ifdef condition target) zephyr_library_sources_ifdef(${condition} ${ARGN}) endmacro() +add_subdirectory(../src/audio/ audio_unused_install/) add_subdirectory(../src/debug/debug_stream/ debug_stream_unused_install/) add_subdirectory(../src/debug/telemetry/ telemetry_unused_install/) add_subdirectory(../src/debug/tester/ debug_tester_unused_install/) @@ -456,14 +457,8 @@ zephyr_library_sources( ${SOF_LIB_PATH}/dai.c # SOF mandatory audio processing - ${SOF_AUDIO_PATH}/channel_map.c ${SOF_AUDIO_PATH}/buffers/comp_buffer.c ${SOF_AUDIO_PATH}/buffers/audio_buffer.c - ${SOF_AUDIO_PATH}/source_api_helper.c - ${SOF_AUDIO_PATH}/sink_api_helper.c - ${SOF_AUDIO_PATH}/sink_source_utils.c - ${SOF_AUDIO_PATH}/audio_stream.c - ${SOF_AUDIO_PATH}/component.c ${SOF_AUDIO_PATH}/pipeline/pipeline-graph.c ${SOF_AUDIO_PATH}/pipeline/pipeline-params.c ${SOF_AUDIO_PATH}/pipeline/pipeline-schedule.c From e381bcf865bd1ab3da95b1ac2e21b8623d99761c Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 18 Mar 2025 15:27:53 +0200 Subject: [PATCH 02/14] cmake: add sof_list_append_ifdef() macro Add sof_list_append_ifdef() macro and make it available for both Zephyr and XTOS builds. This is helpful when writing cmake rules for SOF modules. Signed-off-by: Kai Vehmanen --- scripts/cmake/misc.cmake | 8 ++++++++ zephyr/CMakeLists.txt | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/scripts/cmake/misc.cmake b/scripts/cmake/misc.cmake index 77ae05ee2754..647b69c8c478 100644 --- a/scripts/cmake/misc.cmake +++ b/scripts/cmake/misc.cmake @@ -58,6 +58,14 @@ macro(add_local_sources_ifdef condition target) endif() endmacro() +# helper macro used similarly as add_local_sources_ifdef +# Zephyr duplicate in sof/zephyr/CMakeLists.txt; keep in sync +macro(sof_list_append_ifdef feature_toggle list) + if(${${feature_toggle}}) + list(APPEND ${list} ${ARGN}) + endif() +endmacro() + # Adds sources to target like target_sources, but assumes that # paths are relative to subdirectory. # Works like: diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 70ed422f3bd2..e51bf8139f15 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -197,6 +197,11 @@ macro(add_local_sources_ifdef condition target) endif() zephyr_library_sources_ifdef(${condition} ${ARGN}) endmacro() +macro(sof_list_append_ifdef feature_toggle list) + if(${${feature_toggle}}) + list(APPEND ${list} ${ARGN}) + endif() +endmacro() add_subdirectory(../src/audio/ audio_unused_install/) add_subdirectory(../src/debug/debug_stream/ debug_stream_unused_install/) From 0f6020684df32ade54805e69319fe6010cbc8d9e Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 18 Mar 2025 16:05:02 +0200 Subject: [PATCH 03/14] cmake/zephyr: unify cmake rules for src/audio/buffers/ Adding all source files in a single, giant zephyr/CMakeLists.txt is inconvenient and does not scale. Modify Zephyr rules to use definitions in src/audio/buffers/ instead. Link: https://github.com/thesofproject/sof/issues/8260 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 5 ++++- src/audio/buffers/CMakeLists.txt | 7 ++----- zephyr/CMakeLists.txt | 6 ------ 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 7750602d1895..6c007c7e2f00 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -10,6 +10,10 @@ set(base_files channel_map.c ) +### Common actions for Zephyr/XTOS ### +if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) + add_subdirectory(buffers) +endif() is_zephyr(it_is) if(it_is) ### Zephyr ### @@ -27,7 +31,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) ${base_files} ) - add_subdirectory(buffers) if(CONFIG_COMP_BLOB) add_local_sources(sof data_blob.c) diff --git a/src/audio/buffers/CMakeLists.txt b/src/audio/buffers/CMakeLists.txt index 944a84dedb7e..b035b055b449 100644 --- a/src/audio/buffers/CMakeLists.txt +++ b/src/audio/buffers/CMakeLists.txt @@ -1,8 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -add_local_sources(sof audio_buffer.c) -add_local_sources(sof comp_buffer.c) +add_local_sources(sof audio_buffer.c comp_buffer.c) -if(CONFIG_PIPELINE_2_0) - add_local_sources(sof ring_buffer.c) -endif() +add_local_sources_ifdef(CONFIG_PIPELINE_2_0 sof ring_buffer.c) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index e51bf8139f15..36650625481a 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -462,8 +462,6 @@ zephyr_library_sources( ${SOF_LIB_PATH}/dai.c # SOF mandatory audio processing - ${SOF_AUDIO_PATH}/buffers/comp_buffer.c - ${SOF_AUDIO_PATH}/buffers/audio_buffer.c ${SOF_AUDIO_PATH}/pipeline/pipeline-graph.c ${SOF_AUDIO_PATH}/pipeline/pipeline-params.c ${SOF_AUDIO_PATH}/pipeline/pipeline-schedule.c @@ -498,10 +496,6 @@ zephyr_library_sources_ifdef(CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL # SOF module interface functions add_subdirectory(../src/module module_unused_install/) -if(CONFIG_PIPELINE_2_0) - zephyr_library_sources(${SOF_AUDIO_PATH}/buffers/ring_buffer.c) -endif() - if(CONFIG_COMP_BLOB) zephyr_library_sources( ${SOF_AUDIO_PATH}/data_blob.c From c639252d332d51e61df71ac2c0d7c1bbad6c98d0 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 18 Mar 2025 16:19:24 +0200 Subject: [PATCH 04/14] cmake/zephyr: unify cmake rules for src/audio/pipeline/ Adding all source files in a single, giant zephyr/CMakeLists.txt is inconvenient and does not scale. Modify Zephyr rules to use definitions in src/audio/pipeline/ instead. Link: https://github.com/thesofproject/sof/issues/8260 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 2 +- src/audio/pipeline/CMakeLists.txt | 10 +++++----- zephyr/CMakeLists.txt | 7 ------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 6c007c7e2f00..1b3cca171ba3 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -13,6 +13,7 @@ set(base_files ### Common actions for Zephyr/XTOS ### if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) add_subdirectory(buffers) + add_subdirectory(pipeline) endif() is_zephyr(it_is) @@ -125,7 +126,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_INTEL_ADSP_MIC_PRIVACY) add_subdirectory(mic_privacy_manager) endif() - subdirs(pipeline) add_subdirectory(google) if(CONFIG_COMP_CHAIN_DMA) add_local_sources(sof chain_dma.c) diff --git a/src/audio/pipeline/CMakeLists.txt b/src/audio/pipeline/CMakeLists.txt index 242ace4b2a69..cb26dc3214bd 100644 --- a/src/audio/pipeline/CMakeLists.txt +++ b/src/audio/pipeline/CMakeLists.txt @@ -1,9 +1,9 @@ # SPDX-License-Identifier: BSD-3-Clause add_local_sources(sof - pipeline-graph.c - pipeline-stream.c - pipeline-params.c - pipeline-xrun.c - pipeline-schedule.c + pipeline-graph.c + pipeline-stream.c + pipeline-params.c + pipeline-xrun.c + pipeline-schedule.c ) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 36650625481a..da02c35d13d9 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -461,13 +461,6 @@ zephyr_library_sources( ${SOF_LIB_PATH}/dma.c ${SOF_LIB_PATH}/dai.c - # SOF mandatory audio processing - ${SOF_AUDIO_PATH}/pipeline/pipeline-graph.c - ${SOF_AUDIO_PATH}/pipeline/pipeline-params.c - ${SOF_AUDIO_PATH}/pipeline/pipeline-schedule.c - ${SOF_AUDIO_PATH}/pipeline/pipeline-stream.c - ${SOF_AUDIO_PATH}/pipeline/pipeline-xrun.c - # SOF core infrastructure - runs on top of Zephyr ${SOF_SRC_PATH}/arch/xtensa/drivers/cache_attr.c From 2a711578f89fff01920fd07f4906afa614bf86fa Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 18 Mar 2025 16:25:07 +0200 Subject: [PATCH 05/14] cmake/zephyr: unify cmake rules for src/audio/data_blob.c Adding all source files in a single, giant zephyr/CMakeLists.txt is inconvenient and does not scale. Modify Zephyr rules to use definitions in src/audio/ instead. Link: https://github.com/thesofproject/sof/issues/8260 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 6 ++---- zephyr/CMakeLists.txt | 6 ------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 1b3cca171ba3..d9b227ae2165 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -16,6 +16,8 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) add_subdirectory(pipeline) endif() +sof_list_append_ifdef(CONFIG_COMP_BLOB base_files data_blob.c) + is_zephyr(it_is) if(it_is) ### Zephyr ### @@ -32,10 +34,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) ${base_files} ) - - if(CONFIG_COMP_BLOB) - add_local_sources(sof data_blob.c) - endif() if(CONFIG_COMP_SRC) add_subdirectory(src) endif() diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index da02c35d13d9..1e897a4d255a 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -489,12 +489,6 @@ zephyr_library_sources_ifdef(CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL # SOF module interface functions add_subdirectory(../src/module module_unused_install/) -if(CONFIG_COMP_BLOB) - zephyr_library_sources( - ${SOF_AUDIO_PATH}/data_blob.c - ) -endif() - if(CONFIG_ZEPHYR_NATIVE_DRIVERS) zephyr_library_sources( ${SOF_AUDIO_PATH}/host-zephyr.c From 0d08ae21152b7d86af68bfb7a9723a6ff9037420 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 19 Mar 2025 17:14:01 +0200 Subject: [PATCH 06/14] tools: testbench: fix load of component src_lite The register to testbench needs the init function prototype into sof/audio/component.h. Add src_lite to the prototype list, so it can be enabled in testbench builds. Signed-off-by: Kai Vehmanen --- src/include/sof/audio/component.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/include/sof/audio/component.h b/src/include/sof/audio/component.h index 9c9a411fd6eb..ff06f8bec419 100644 --- a/src/include/sof/audio/component.h +++ b/src/include/sof/audio/component.h @@ -869,6 +869,7 @@ void sys_comp_module_asrc_interface_init(void); void sys_comp_module_rtnr_interface_init(void); void sys_comp_module_selector_interface_init(void); void sys_comp_module_src_interface_init(void); +void sys_comp_module_src_lite_interface_init(void); void sys_comp_module_tdfb_interface_init(void); void sys_comp_module_volume_interface_init(void); void sys_comp_module_tester_interface_init(void); From 1b2e4ad1728217bf823dc54e0dabbc41dc2eb493 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 18 Mar 2025 16:34:42 +0200 Subject: [PATCH 07/14] cmake/zephyr: unify cmake rules for src/audio/src/ Adding all source files in a single, giant zephyr/CMakeLists.txt is inconvenient and does not scale. Modify Zephyr rules to use definitions in src/audio/src/ instead. Link: https://github.com/thesofproject/sof/issues/8260 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 6 +++--- src/audio/src/CMakeLists.txt | 28 +++++++++++++++++++++++++--- zephyr/CMakeLists.txt | 21 --------------------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index d9b227ae2165..f5fc9d91b8a5 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -14,6 +14,9 @@ set(base_files if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) add_subdirectory(buffers) add_subdirectory(pipeline) + if(CONFIG_COMP_SRC) + add_subdirectory(src) + endif() endif() sof_list_append_ifdef(CONFIG_COMP_BLOB base_files data_blob.c) @@ -34,9 +37,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) ${base_files} ) - if(CONFIG_COMP_SRC) - add_subdirectory(src) - endif() if(CONFIG_COMP_FIR) add_subdirectory(eq_fir) endif() diff --git a/src/audio/src/CMakeLists.txt b/src/audio/src/CMakeLists.txt index 111b2484b4da..aab97633a2c1 100644 --- a/src/audio/src/CMakeLists.txt +++ b/src/audio/src/CMakeLists.txt @@ -1,9 +1,31 @@ # SPDX-License-Identifier: BSD-3-Clause -add_local_sources(sof src_generic.c src_hifi2ep.c src_hifi3.c src_hifi4.c src_hifi5.c src_common.c src.c) +set(base_files src_generic.c src_hifi2ep.c src_hifi3.c src_hifi4.c src_hifi5.c src_common.c src.c) if(CONFIG_IPC_MAJOR_3) - add_local_sources(sof src_ipc3.c) + list(APPEND base_files src_ipc3.c) elseif(CONFIG_IPC_MAJOR_4) - add_local_sources(sof src_ipc4.c) + list(APPEND base_files src_ipc4.c) +endif() + +sof_list_append_ifdef(CONFIG_COMP_SRC_LITE base_files src_lite.c) + +is_zephyr(it_is) +if(it_is) ### Zephyr ### + + if(CONFIG_COMP_SRC STREQUAL "m") + + add_subdirectory(llext ${PROJECT_BINARY_DIR}/src_llext) + add_dependencies(app src) + + else() + + zephyr_library_sources(${base_files}) + + endif() + +else() ### XTOS ### + + add_local_sources(sof ${base_files}) + endif() diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 1e897a4d255a..290cbcaa603b 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -708,27 +708,6 @@ zephyr_library_sources_ifdef(CONFIG_COMP_CHAIN_DMA ${SOF_AUDIO_PATH}/chain_dma.c ) -if(CONFIG_COMP_SRC STREQUAL "m") - add_subdirectory(${SOF_AUDIO_PATH}/src/llext - ${PROJECT_BINARY_DIR}/src_llext) - add_dependencies(app src) -elseif(CONFIG_COMP_SRC) - zephyr_library_sources_ifdef(CONFIG_COMP_SRC - ${SOF_AUDIO_PATH}/src/src_hifi2ep.c - ${SOF_AUDIO_PATH}/src/src_generic.c - ${SOF_AUDIO_PATH}/src/src_hifi3.c - ${SOF_AUDIO_PATH}/src/src_hifi4.c - ${SOF_AUDIO_PATH}/src/src_hifi5.c - ${SOF_AUDIO_PATH}/src/src_common.c - ${SOF_AUDIO_PATH}/src/src.c - ${SOF_AUDIO_PATH}/src/src_${ipc_suffix}.c - ) - - zephyr_library_sources_ifdef(CONFIG_COMP_SRC_LITE - ${SOF_AUDIO_PATH}/src/src_lite.c - ) -endif() - zephyr_library_sources_ifdef(CONFIG_COMP_BASEFW_IPC4 ${SOF_AUDIO_PATH}/base_fw.c ) From d7d8a12d96133c098b7ca4b437f0b8474cc63d26 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 18 Mar 2025 16:52:01 +0200 Subject: [PATCH 08/14] cmake/zephyr: unify cmake rules for src/audio for dai/host Adding all source files in a single, giant zephyr/CMakeLists.txt is inconvenient and does not scale. Modify Zephyr rules to use definitions in src/audio for dai and host component source files. Link: https://github.com/thesofproject/sof/issues/8260 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 8 ++++++++ zephyr/CMakeLists.txt | 21 --------------------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index f5fc9d91b8a5..d3f2d3273cc8 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -17,6 +17,14 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_SRC) add_subdirectory(src) endif() + + if(CONFIG_ZEPHYR_NATIVE_DRIVERS) + list(APPEND base_files host-zephyr.c) + sof_list_append_ifdef(CONFIG_COMP_DAI base_files dai-zephyr.c) + else() + list(APPEND base_files host-legacy.c) + sof_list_append_ifdef(CONFIG_COMP_DAI base_files dai-legacy.c) + endif() endif() sof_list_append_ifdef(CONFIG_COMP_BLOB base_files data_blob.c) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 290cbcaa603b..cd563ad96b0e 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -489,17 +489,6 @@ zephyr_library_sources_ifdef(CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL # SOF module interface functions add_subdirectory(../src/module module_unused_install/) -if(CONFIG_ZEPHYR_NATIVE_DRIVERS) - zephyr_library_sources( - ${SOF_AUDIO_PATH}/host-zephyr.c - ) -else() - zephyr_library_sources( - ${SOF_AUDIO_PATH}/host-legacy.c - ) -endif() - - zephyr_library_sources_ifdef(CONFIG_TRACE ${SOF_SRC_PATH}/trace/dma-trace.c ${SOF_SRC_PATH}/trace/trace.c) @@ -610,16 +599,6 @@ zephyr_library_sources_ifdef(CONFIG_COMP_TONE ${SOF_AUDIO_PATH}/tone.c ) -if(CONFIG_ZEPHYR_NATIVE_DRIVERS) - zephyr_library_sources_ifdef(CONFIG_COMP_DAI - ${SOF_AUDIO_PATH}/dai-zephyr.c -) -else() - zephyr_library_sources_ifdef(CONFIG_COMP_DAI - ${SOF_AUDIO_PATH}/dai-legacy.c -) -endif() - zephyr_library_sources_ifdef(CONFIG_IPC4_GATEWAY ${SOF_AUDIO_PATH}/copier/copier_ipcgtw.c ) From 7a85ec72fdcecdc2b69011904338ac92e24bb749 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 18 Mar 2025 16:11:48 +0200 Subject: [PATCH 09/14] audio/cmake: add more inline documentation The audio top-level CMakeLists.txt is a bit complex to follow as it has two separate set of build rules. One to build normal SOF firmware target, with rules in subfolders and another for the host-library build (not using subfolder CMakeLists.txt). The two sets are broken with a return() in the middle. Add inline commentary to the different sections making this easier to follow. Link: https://github.com/thesofproject/sof/issues/8606 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index d3f2d3273cc8..de5cc05e3181 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -39,6 +39,8 @@ if(it_is) ### Zephyr ### return() endif() +### XTOS normal build (not shared library) ### + if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) add_local_sources(sof host-legacy.c @@ -143,6 +145,8 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) return() endif() +### Shared library build (CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) ### + subdirs(pipeline) if(CONFIG_COMP_MODULE_ADAPTER) From 5d44f494b1205f3cf28281d7715a2a1702b54dcd Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 19 Mar 2025 10:31:37 +0200 Subject: [PATCH 10/14] cmake/zephyr: unify cmake rules for src/audio/eq-iir and eq-fir Adding all source files in a single, giant zephyr/CMakeLists.txt is inconvenient and does not scale. Modify Zephyr rules to use definitions in src/audio/eq-iir and src/audio/eq-fir instead. Link: https://github.com/thesofproject/sof/issues/8260 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 12 ++++++------ src/audio/eq_fir/CMakeLists.txt | 21 +++++++++++++++------ src/audio/eq_iir/CMakeLists.txt | 20 +++++++++++++++----- zephyr/CMakeLists.txt | 26 -------------------------- 4 files changed, 36 insertions(+), 43 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index de5cc05e3181..dbb13608c82e 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -14,6 +14,12 @@ set(base_files if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) add_subdirectory(buffers) add_subdirectory(pipeline) + if(CONFIG_COMP_FIR) + add_subdirectory(eq_fir) + endif() + if(CONFIG_COMP_IIR) + add_subdirectory(eq_iir) + endif() if(CONFIG_COMP_SRC) add_subdirectory(src) endif() @@ -47,12 +53,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) ${base_files} ) - if(CONFIG_COMP_FIR) - add_subdirectory(eq_fir) - endif() - if(CONFIG_COMP_IIR) - add_subdirectory(eq_iir) - endif() if(CONFIG_COMP_DCBLOCK) add_subdirectory(dcblock) endif() diff --git a/src/audio/eq_fir/CMakeLists.txt b/src/audio/eq_fir/CMakeLists.txt index 250ca910658c..aaaabe9812bb 100644 --- a/src/audio/eq_fir/CMakeLists.txt +++ b/src/audio/eq_fir/CMakeLists.txt @@ -1,9 +1,18 @@ # SPDX-License-Identifier: BSD-3-Clause -add_local_sources(sof eq_fir.c eq_fir_generic.c eq_fir_hifi2ep.c eq_fir_hifi3.c) -if(CONFIG_IPC_MAJOR_3) - add_local_sources(sof eq_fir_ipc3.c) -elseif(CONFIG_IPC_MAJOR_4) - add_local_sources(sof eq_fir_ipc4.c) -endif() +if(CONFIG_COMP_FIR STREQUAL "m") + + add_subdirectory(llext ${PROJECT_BINARY_DIR}/eq_fir_llext) + add_dependencies(app eq_fir) + +else() + add_local_sources(sof eq_fir.c eq_fir_generic.c eq_fir_hifi2ep.c eq_fir_hifi3.c) + + if(CONFIG_IPC_MAJOR_3) + add_local_sources(sof eq_fir_ipc3.c) + elseif(CONFIG_IPC_MAJOR_4) + add_local_sources(sof eq_fir_ipc4.c) + endif() + +endif() diff --git a/src/audio/eq_iir/CMakeLists.txt b/src/audio/eq_iir/CMakeLists.txt index 0c9853540ad5..7519ec77b0c8 100644 --- a/src/audio/eq_iir/CMakeLists.txt +++ b/src/audio/eq_iir/CMakeLists.txt @@ -1,8 +1,18 @@ # SPDX-License-Identifier: BSD-3-Clause -add_local_sources(sof eq_iir.c eq_iir_generic.c) -if(CONFIG_IPC_MAJOR_3) - add_local_sources(sof eq_iir_ipc3.c) -elseif(CONFIG_IPC_MAJOR_4) - add_local_sources(sof eq_iir_ipc4.c) +if(CONFIG_COMP_IIR STREQUAL "m") + + add_subdirectory(llext ${PROJECT_BINARY_DIR}/eq_iir_llext) + add_dependencies(app eq_iir) + +else() + + add_local_sources(sof eq_iir.c eq_iir_generic.c) + + if(CONFIG_IPC_MAJOR_3) + add_local_sources(sof eq_iir_ipc3.c) + elseif(CONFIG_IPC_MAJOR_4) + add_local_sources(sof eq_iir_ipc4.c) + endif() + endif() diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index cd563ad96b0e..f5490563d92c 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -506,32 +506,6 @@ elseif(CONFIG_IPC_MAJOR_4) set(ipc_suffix ipc4) endif() -if(CONFIG_COMP_FIR STREQUAL "m") - add_subdirectory(${SOF_AUDIO_PATH}/eq_fir/llext - ${PROJECT_BINARY_DIR}/eq_fir_llext) - add_dependencies(app eq_fir) -elseif(CONFIG_COMP_FIR) - zephyr_library_sources( - ${SOF_AUDIO_PATH}/eq_fir/eq_fir_hifi3.c - ${SOF_AUDIO_PATH}/eq_fir/eq_fir_hifi2ep.c - ${SOF_AUDIO_PATH}/eq_fir/eq_fir_generic.c - ${SOF_AUDIO_PATH}/eq_fir/eq_fir.c - ${SOF_AUDIO_PATH}/eq_fir/eq_fir_${ipc_suffix}.c - ) -endif() - -if(CONFIG_COMP_IIR STREQUAL "m") - add_subdirectory(${SOF_AUDIO_PATH}/eq_iir/llext - ${PROJECT_BINARY_DIR}/eq_iir_llext) - add_dependencies(app eq_iir) -elseif(CONFIG_COMP_IIR) - zephyr_library_sources( - ${SOF_AUDIO_PATH}/eq_iir/eq_iir.c - ${SOF_AUDIO_PATH}/eq_iir/eq_iir_${ipc_suffix}.c - ${SOF_AUDIO_PATH}/eq_iir/eq_iir_generic.c - ) -endif() - if(CONFIG_COMP_ASRC STREQUAL "m") add_subdirectory(${SOF_AUDIO_PATH}/asrc/llext ${PROJECT_BINARY_DIR}/asrc_llext) From ad82eaa31ad380a08e23c8f021b76ba27100e976 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 19 Mar 2025 15:53:29 +0200 Subject: [PATCH 11/14] cmake/zephyr: unify cmake rules for src/audio/asrc Adding all source files in a single, giant zephyr/CMakeLists.txt is inconvenient and does not scale. Modify Zephyr rules to use definitions in src/audio/asrc instead Link: https://github.com/thesofproject/sof/issues/8260 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 6 +++--- src/audio/asrc/CMakeLists.txt | 12 +++++++++--- zephyr/CMakeLists.txt | 15 --------------- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index dbb13608c82e..1b0c7911d161 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -14,6 +14,9 @@ set(base_files if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) add_subdirectory(buffers) add_subdirectory(pipeline) + if(CONFIG_COMP_ASRC) + add_subdirectory(asrc) + endif() if(CONFIG_COMP_FIR) add_subdirectory(eq_fir) endif() @@ -99,9 +102,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) add_subdirectory(smart_amp) endif() add_subdirectory(pcm_converter) - if(CONFIG_COMP_ASRC) - add_subdirectory(asrc) - endif() if(CONFIG_COMP_MODULE_ADAPTER) add_subdirectory(module_adapter) endif() diff --git a/src/audio/asrc/CMakeLists.txt b/src/audio/asrc/CMakeLists.txt index 44f68d3c902c..51fa3565c65d 100644 --- a/src/audio/asrc/CMakeLists.txt +++ b/src/audio/asrc/CMakeLists.txt @@ -1,10 +1,16 @@ # SPDX-License-Identifier: BSD-3-Clause +if(CONFIG_COMP_ASRC STREQUAL "m") + add_subdirectory(llext ${PROJECT_BINARY_DIR}/asrc_llext) + add_dependencies(app asrc) + return() +endif() + add_local_sources(sof asrc.c asrc_farrow.c asrc_farrow_generic.c - asrc_farrow_hifi3.c asrc_farrow_hifi5.c) + asrc_farrow_hifi3.c asrc_farrow_hifi5.c) if(CONFIG_IPC_MAJOR_3) - add_local_sources(sof asrc_ipc3.c) + add_local_sources(sof asrc_ipc3.c) elseif(CONFIG_IPC_MAJOR_4) - add_local_sources(sof asrc_ipc4.c) + add_local_sources(sof asrc_ipc4.c) endif() diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index f5490563d92c..d0d60eca8221 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -506,21 +506,6 @@ elseif(CONFIG_IPC_MAJOR_4) set(ipc_suffix ipc4) endif() -if(CONFIG_COMP_ASRC STREQUAL "m") - add_subdirectory(${SOF_AUDIO_PATH}/asrc/llext - ${PROJECT_BINARY_DIR}/asrc_llext) - add_dependencies(app asrc) -elseif(CONFIG_COMP_ASRC) - zephyr_library_sources( - ${SOF_AUDIO_PATH}/asrc/asrc.c - ${SOF_AUDIO_PATH}/asrc/asrc_farrow_hifi5.c - ${SOF_AUDIO_PATH}/asrc/asrc_farrow_hifi3.c - ${SOF_AUDIO_PATH}/asrc/asrc_farrow.c - ${SOF_AUDIO_PATH}/asrc/asrc_farrow_generic.c - ${SOF_AUDIO_PATH}/asrc/asrc_${ipc_suffix}.c - ) -endif() - if(CONFIG_COMP_DCBLOCK STREQUAL "m") add_subdirectory(${SOF_AUDIO_PATH}/dcblock/llext ${PROJECT_BINARY_DIR}/dcblock_llext) From a167dc9efacfc649850914b15ec94a9b86dbbec0 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 19 Mar 2025 15:55:53 +0200 Subject: [PATCH 12/14] cmake/zephyr: unify cmake rules for src/audio/dcblock Adding all source files in a single, giant zephyr/CMakeLists.txt is inconvenient and does not scale. Modify Zephyr rules to use definitions in src/audio/dcblock instead Link: https://github.com/thesofproject/sof/issues/8260 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 6 +++--- src/audio/dcblock/CMakeLists.txt | 10 ++++++++-- zephyr/CMakeLists.txt | 14 -------------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 1b0c7911d161..3be370d2bd00 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -17,6 +17,9 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_ASRC) add_subdirectory(asrc) endif() + if(CONFIG_COMP_DCBLOCK) + add_subdirectory(dcblock) + endif() if(CONFIG_COMP_FIR) add_subdirectory(eq_fir) endif() @@ -56,9 +59,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) ${base_files} ) - if(CONFIG_COMP_DCBLOCK) - add_subdirectory(dcblock) - endif() if(CONFIG_COMP_CROSSOVER) add_subdirectory(crossover) endif() diff --git a/src/audio/dcblock/CMakeLists.txt b/src/audio/dcblock/CMakeLists.txt index a433b0629eeb..c97b957552ab 100644 --- a/src/audio/dcblock/CMakeLists.txt +++ b/src/audio/dcblock/CMakeLists.txt @@ -1,10 +1,16 @@ +if(CONFIG_COMP_DCBLOCK STREQUAL "m") + add_subdirectory(llext ${PROJECT_BINARY_DIR}/dcblock_llext) + add_dependencies(app dcblock) + return() +endif() + add_local_sources(sof dcblock.c) add_local_sources(sof dcblock_generic.c) add_local_sources(sof dcblock_hifi3.c) add_local_sources(sof dcblock_hifi4.c) if(CONFIG_IPC_MAJOR_3) - add_local_sources(sof dcblock_ipc3.c) + add_local_sources(sof dcblock_ipc3.c) elseif(CONFIG_IPC_MAJOR_4) - add_local_sources(sof dcblock_ipc4.c) + add_local_sources(sof dcblock_ipc4.c) endif() diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index d0d60eca8221..760f0c7ee374 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -506,20 +506,6 @@ elseif(CONFIG_IPC_MAJOR_4) set(ipc_suffix ipc4) endif() -if(CONFIG_COMP_DCBLOCK STREQUAL "m") - add_subdirectory(${SOF_AUDIO_PATH}/dcblock/llext - ${PROJECT_BINARY_DIR}/dcblock_llext) - add_dependencies(app dcblock) -elseif(CONFIG_COMP_DCBLOCK) - zephyr_library_sources( - ${SOF_AUDIO_PATH}/dcblock/dcblock_generic.c - ${SOF_AUDIO_PATH}/dcblock/dcblock.c - ${SOF_AUDIO_PATH}/dcblock/dcblock_hifi3.c - ${SOF_AUDIO_PATH}/dcblock/dcblock_hifi4.c - ${SOF_AUDIO_PATH}/dcblock/dcblock_${ipc_suffix}.c - ) -endif() - if(CONFIG_COMP_SEL STREQUAL "m") add_subdirectory(${SOF_AUDIO_PATH}/selector/llext ${PROJECT_BINARY_DIR}/selector_llext) From ff97a1781893bce72b4336a928c8d0cf91011e4e Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 19 Mar 2025 16:02:53 +0200 Subject: [PATCH 13/14] cmake/zephyr: unify cmake rules for src/audio/selector Adding all source files in a single, giant zephyr/CMakeLists.txt is inconvenient and does not scale. Modify Zephyr rules to use definitions in src/audio/selector instead Link: https://github.com/thesofproject/sof/issues/8260 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 6 +++--- src/audio/selector/CMakeLists.txt | 6 ++++++ zephyr/CMakeLists.txt | 11 ----------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 3be370d2bd00..2be1e1f79c17 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -26,6 +26,9 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_IIR) add_subdirectory(eq_iir) endif() + if(CONFIG_COMP_SEL) + add_subdirectory(selector) + endif() if(CONFIG_COMP_SRC) add_subdirectory(src) endif() @@ -95,9 +98,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) kpb.c ) endif() - if(CONFIG_COMP_SEL) - add_subdirectory(selector) - endif() if(CONFIG_COMP_SMART_AMP) add_subdirectory(smart_amp) endif() diff --git a/src/audio/selector/CMakeLists.txt b/src/audio/selector/CMakeLists.txt index 1c7e9a43ad44..eb92a8c29510 100644 --- a/src/audio/selector/CMakeLists.txt +++ b/src/audio/selector/CMakeLists.txt @@ -1,3 +1,9 @@ # SPDX-License-Identifier: BSD-3-Clause +if(CONFIG_COMP_SEL STREQUAL "m") + add_subdirectory(llext ${PROJECT_BINARY_DIR}/selector_llext) + add_dependencies(app selector) + return() +endif() + add_local_sources(sof selector_generic.c selector.c) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 760f0c7ee374..0883958c3c2d 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -506,17 +506,6 @@ elseif(CONFIG_IPC_MAJOR_4) set(ipc_suffix ipc4) endif() -if(CONFIG_COMP_SEL STREQUAL "m") - add_subdirectory(${SOF_AUDIO_PATH}/selector/llext - ${PROJECT_BINARY_DIR}/selector_llext) - add_dependencies(app selector) -elseif(CONFIG_COMP_SEL) - zephyr_library_sources( - ${SOF_AUDIO_PATH}/selector/selector_generic.c - ${SOF_AUDIO_PATH}/selector/selector.c - ) -endif() - zephyr_library_sources_ifdef(CONFIG_COMP_KPB ${SOF_AUDIO_PATH}/kpb.c ) From df91fc187fcbcb8ce61d43f4ebcc979ba03d69c4 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 19 Mar 2025 16:09:51 +0200 Subject: [PATCH 14/14] cmake/zephyr: unify cmake rules for src/audio/kpb.c Adding all source files in a single, giant zephyr/CMakeLists.txt is inconvenient and does not scale. Modify Zephyr rules to use definitions in src/audio instead Link: https://github.com/thesofproject/sof/issues/8260 Signed-off-by: Kai Vehmanen --- src/audio/CMakeLists.txt | 10 +++++----- zephyr/CMakeLists.txt | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 2be1e1f79c17..2810a0e452de 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -26,6 +26,11 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_IIR) add_subdirectory(eq_iir) endif() + if(CONFIG_COMP_KPB AND NOT CONFIG_LIBRARY_STATIC) + add_local_sources(sof + kpb.c + ) + endif() if(CONFIG_COMP_SEL) add_subdirectory(selector) endif() @@ -93,11 +98,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) dai-legacy.c ) endif() - if(CONFIG_COMP_KPB AND NOT CONFIG_LIBRARY_STATIC) - add_local_sources(sof - kpb.c - ) - endif() if(CONFIG_COMP_SMART_AMP) add_subdirectory(smart_amp) endif() diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 0883958c3c2d..7a3c92f9ce64 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -506,10 +506,6 @@ elseif(CONFIG_IPC_MAJOR_4) set(ipc_suffix ipc4) endif() -zephyr_library_sources_ifdef(CONFIG_COMP_KPB - ${SOF_AUDIO_PATH}/kpb.c -) - zephyr_library_sources_ifdef(CONFIG_COMP_MIXER ${SOF_AUDIO_PATH}/mixer/mixer.c ${SOF_AUDIO_PATH}/mixer/mixer_generic.c