Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions src/debug/tester/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
add_local_sources(tester.c)
add_local_sources(tester_dummy_test.c)
add_local_sources(tester_simple_dram_test.c)
# SPDX-License-Identifier: BSD-3-Clause

set(base_files
tester.c
tester_dummy_test.c
tester_simple_dram_test.c
)

is_zephyr(it_is)
if(it_is) ### Zephyr ###

if(CONFIG_COMP_TESTER STREQUAL "m")

add_subdirectory(llext ${PROJECT_BINARY_DIR}/tester_llext)
add_dependencies(app tester)

elseif(CONFIG_COMP_TESTER)

zephyr_library_sources(${base_files})

endif()

else() ### XTOS ###

add_local_sources(sof ${base_files})

endif()
78 changes: 56 additions & 22 deletions src/math/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,58 +1,92 @@
# SPDX-License-Identifier: BSD-3-Clause

if(BUILD_LIBRARY)
add_local_sources(sof numbers.c)
return()
add_local_sources(sof numbers.c)
return()
endif()

add_local_sources(sof numbers.c)
set(base_files numbers.c)

if(CONFIG_CORDIC_FIXED)
add_local_sources(sof trig.c)
list(APPEND base_files trig.c)
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can a add_list_ifdef() cmake function be used? I'm not a cmake expert, so not sure whether objects are passed by reference

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lyakh I was going back and forth with this. Not an cmake expert here either, but given we need new owners for cmake magic in SOF, we probably need to just learn more.

We could add a function, but we'd need to add it as a SOF extension (Zephyr has list_append_if() but we can't use that).
What I'm personally not sure is that is it worth it to save some lines in definitions versus keeping SOF cmake files as close to standard cmake files as possible. I.e. functions that are used are standard cmake functions. Most of people contributing to SOF will not be cmake experts either.

On the other hand, we have a LOT of use for add_local_sources_if(), so having a replacement macro that facilitates Zephyr/XTOS might still be useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: hmm, it seems add_local_sources_if() is already a "SOF'ism", a macro defined and used only in SOF. So it seems we've already gone the path to use SOF specific macros to avoid repetition. I can update to this approach.


add_local_sources_ifdef(CONFIG_MATH_LUT_SINE_FIXED sof lut_trig.c)
if(CONFIG_MATH_LUT_SINE_FIXED)
list(APPEND base_files lut_trig.c)
endif()

add_local_sources_ifdef(CONFIG_SQRT_FIXED sof sqrt_int16.c)
if(CONFIG_SQRT_FIXED)
list(APPEND base_files sqrt_int16.c)
endif()

add_local_sources_ifdef(CONFIG_MATH_EXP sof exp_fcn.c exp_fcn_hifi.c)
if(CONFIG_MATH_EXP)
list(APPEND base_files exp_fcn.c exp_fcn_hifi.c)
endif()

if(CONFIG_MATH_DECIBELS)
add_local_sources(sof decibels.c)
list(APPEND base_files decibels.c)
endif()

add_local_sources_ifdef(CONFIG_NATURAL_LOGARITHM_FIXED sof log_e.c)
if(CONFIG_NATURAL_LOGARITHM_FIXED)
list(APPEND base_files log_e.c)
endif()

add_local_sources_ifdef(CONFIG_COMMON_LOGARITHM_FIXED sof log_10.c)
if(CONFIG_COMMON_LOGARITHM_FIXED)
list(APPEND base_files log_10.c)
endif()

add_local_sources_ifdef(CONFIG_POWER_FIXED sof power.c)
if(CONFIG_POWER_FIXED)
list(APPEND base_files power.c)
endif()

add_local_sources_ifdef(CONFIG_BINARY_LOGARITHM_FIXED sof base2log.c)
if(CONFIG_BINARY_LOGARITHM_FIXED)
list(APPEND base_files base2log.c)
endif()

add_local_sources_ifdef(CONFIG_MATH_FIR sof fir_generic.c fir_hifi2ep.c fir_hifi3.c fir_hifi5.c)
if(CONFIG_MATH_FIR STREQUAL "m")
add_subdirectory(fir_llext ${PROJECT_BINARY_DIR}/fir_llext)
add_dependencies(app fir)
elseif(CONFIG_MATH_FIR)
list(APPEND base_files fir_generic.c fir_hifi2ep.c fir_hifi3.c fir_hifi5.c)
endif()

if(CONFIG_MATH_FFT)
add_subdirectory(fft)
add_subdirectory(fft)
endif()

add_local_sources_ifdef(CONFIG_MATH_IIR_DF2T sof
iir_df2t_generic.c iir_df2t_hifi3.c iir_df2t.c)
if(CONFIG_MATH_IIR_DF2T)
list(APPEND base_files iir_df2t_generic.c iir_df2t_hifi3.c iir_df2t.c)
endif()

add_local_sources_ifdef(CONFIG_MATH_IIR_DF1 sof
iir_df1_generic.c iir_df1_hifi3.c iir_df1_hifi4.c iir_df1_hifi5.c iir_df1.c)
if(CONFIG_MATH_IIR_DF1)
list(APPEND base_files iir_df1_generic.c iir_df1_hifi3.c iir_df1_hifi4.c iir_df1_hifi5.c iir_df1.c)
endif()

if(CONFIG_MATH_WINDOW)
add_local_sources(sof window.c)
list(APPEND base_files window.c)
endif()

if(CONFIG_MATH_MATRIX)
add_local_sources(sof matrix.c)
list(APPEND base_files matrix.c)
endif()

if(CONFIG_MATH_AUDITORY)
add_subdirectory(auditory)
add_subdirectory(auditory)
endif()

if(CONFIG_MATH_DCT)
add_local_sources(sof dct.c)
list(APPEND base_files dct.c)
endif()

is_zephyr(it_is)
if(it_is) ### Zephyr ###

zephyr_library_sources(
${base_files}
)

else() ### XTOS ###

add_local_sources(sof ${base_files})

endif()
23 changes: 20 additions & 3 deletions src/math/auditory/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
# SPDX-License-Identifier: BSD-3-Clause

add_local_sources(sof auditory.c)
set(base_files auditory.c)

add_local_sources_ifdef(CONFIG_MATH_16BIT_MEL_FILTERBANK sof mel_filterbank_16.c)
if(CONFIG_MATH_16BIT_MEL_FILTERBANK)
list(APPEND base_files mel_filterbank_16.c)
endif()

add_local_sources_ifdef(CONFIG_MATH_32BIT_MEL_FILTERBANK sof mel_filterbank_32.c)
if(CONFIG_MATH_32BIT_MEL_FILTERBANK)
list(APPEND base_files mel_filterbank_32.c)
endif()

is_zephyr(it_is)
if(it_is) ### Zephyr ###

zephyr_library_sources(
${base_files}
)

else() ### XTOS ###

add_local_sources(sof ${base_files})

endif()
23 changes: 20 additions & 3 deletions src/math/fft/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
# SPDX-License-Identifier: BSD-3-Clause

add_local_sources(sof fft_common.c)
set(base_files fft_common.c)

add_local_sources_ifdef(CONFIG_MATH_16BIT_FFT sof fft_16.c fft_16_hifi3.c)
if(CONFIG_MATH_16BIT_FFT)
list(APPEND base_files fft_16.c fft_16_hifi3.c)
endif()

add_local_sources_ifdef(CONFIG_MATH_32BIT_FFT sof fft_32.c fft_32_hifi3.c)
if(CONFIG_MATH_32BIT_FFT)
list(APPEND base_files fft_32.c fft_32_hifi3.c)
endif()

is_zephyr(it_is)
if(it_is) ### Zephyr ###

zephyr_library_sources(
${base_files}
)

else() ### XTOS ###

add_local_sources(sof ${base_files})

endif()
4 changes: 2 additions & 2 deletions src/schedule/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ else()
endif()

zephyr_library_sources_ifdef(CONFIG_ZEPHYR_DP_SCHEDULER
${SOF_SRC_PATH}/schedule/zephyr_dp_schedule.c
zephyr_dp_schedule.c
)

zephyr_library_sources_ifdef(CONFIG_ZEPHYR_TWB_SCHEDULER
${SOF_SRC_PATH}/schedule/zephyr_twb_schedule.c
zephyr_twb_schedule.c
)

else() ### Not Zephyr ###
Expand Down
114 changes: 4 additions & 110 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ set(SOF_SAMPLES_PATH "${SOF_SRC_PATH}/samples")
set(SOF_LIB_PATH "${SOF_SRC_PATH}/lib")
set(SOF_DRIVERS_PATH "${SOF_SRC_PATH}/drivers")
set(SOF_DEBUG_PATH "${SOF_SRC_PATH}/debug")
set(SOF_MATH_PATH "${SOF_SRC_PATH}/math")
set(SOF_TRACE_PATH "${SOF_SRC_PATH}/trace")

set(RIMAGE_TOP ${sof_top_dir}/tools/rimage)
Expand Down Expand Up @@ -199,24 +198,13 @@ macro(add_local_sources_ifdef condition target)
zephyr_library_sources_ifdef(${condition} ${ARGN})
endmacro()

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/)
add_subdirectory(../src/init/ init_unused_install/)
add_subdirectory(../src/ipc/ ipc_unused_install/)
add_subdirectory(../src/debug/telemetry/ telemetry_unused_install/)
add_subdirectory(../src/debug/debug_stream/ debug_stream_unused_install/)
add_subdirectory(../src/math/ math_unused_install/)
add_subdirectory(../src/schedule/ schedule_unused_install/)

if(CONFIG_COMP_TESTER STREQUAL "m")
add_subdirectory(${SOF_DEBUG_PATH}/tester/llext
${PROJECT_BINARY_DIR}/tester_llext)
add_dependencies(app tester)
elseif(CONFIG_COMP_TESTER)
zephyr_library_sources_ifdef(CONFIG_COMP_TESTER
${SOF_DEBUG_PATH}/tester/tester.c
${SOF_DEBUG_PATH}/tester/tester_dummy_test.c
${SOF_DEBUG_PATH}/tester/tester_simple_dram_test.c
)
endif()

add_subdirectory(test/)


Expand Down Expand Up @@ -462,13 +450,6 @@ zephyr_include_directories(${SOF_PLATFORM_PATH}/${PLATFORM}/include)
# Commented files will be added/removed as integration dictates.
zephyr_library_sources(

# SOF math utilities
${SOF_MATH_PATH}/decibels.c
${SOF_MATH_PATH}/numbers.c
${SOF_MATH_PATH}/trig.c
${SOF_MATH_PATH}/exp_fcn.c
${SOF_MATH_PATH}/exp_fcn_hifi.c

# SOF library - parts to transition to Zephyr over time
${SOF_LIB_PATH}/notifier.c
${SOF_LIB_PATH}/dma.c
Expand Down Expand Up @@ -514,57 +495,6 @@ zephyr_library_sources_ifdef(CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL
${SOF_LIB_PATH}/cpu-clk-manager.c
)

# Optional math utility
zephyr_library_sources_ifdef(CONFIG_MATH_LUT_SINE_FIXED
${SOF_MATH_PATH}/lut_trig.c
)

zephyr_library_sources_ifdef(CONFIG_MATH_FFT
${SOF_MATH_PATH}/fft/fft_common.c
)

zephyr_library_sources_ifdef(CONFIG_MATH_16BIT_FFT
${SOF_MATH_PATH}/fft/fft_16.c
${SOF_MATH_PATH}/fft/fft_16_hifi3.c
)

zephyr_library_sources_ifdef(ONFIG_MATH_32BIT_FFT
${SOF_MATH_PATH}/fft/fft_32.c
${SOF_MATH_PATH}/fft/fft_32_hifi3.c
)

zephyr_library_sources_ifdef(CONFIG_MATH_DCT
${SOF_MATH_PATH}/dct.c
)

zephyr_library_sources_ifdef(CONFIG_MATH_WINDOW
${SOF_MATH_PATH}/window.c
)

zephyr_library_sources_ifdef(CONFIG_MATH_MATRIX
${SOF_MATH_PATH}/matrix.c
)

zephyr_library_sources_ifdef(CONFIG_MATH_AUDITORY
${SOF_MATH_PATH}/auditory/auditory.c
)

zephyr_library_sources_ifdef(CONFIG_MATH_16BIT_MEL_FILTERBANK
${SOF_MATH_PATH}/auditory/mel_filterbank_16.c
)

zephyr_library_sources_ifdef(CONFIG_MATH_32BIT_MEL_FILTERBANK
${SOF_MATH_PATH}/auditory/mel_filterbank_32.c
)

zephyr_library_sources_ifdef(CONFIG_NATURAL_LOGARITHM_FIXED
${SOF_MATH_PATH}/log_e.c
)

zephyr_library_sources_ifdef(CONFIG_BINARY_LOGARITHM_FIXED
${SOF_MATH_PATH}/base2log.c
)

# SOF module interface functions
add_subdirectory(../src/module module_unused_install/)

Expand Down Expand Up @@ -632,33 +562,6 @@ elseif(CONFIG_COMP_IIR)
)
endif()

if(CONFIG_MATH_FIR STREQUAL "m")
add_subdirectory(${SOF_MATH_PATH}/fir_llext
${PROJECT_BINARY_DIR}/fir_llext)
add_dependencies(app fir)
elseif(CONFIG_MATH_FIR)
zephyr_library_sources(
${SOF_MATH_PATH}/fir_generic.c
${SOF_MATH_PATH}/fir_hifi2ep.c
${SOF_MATH_PATH}/fir_hifi3.c
${SOF_MATH_PATH}/fir_hifi5.c
)
endif()

zephyr_library_sources_ifdef(CONFIG_MATH_IIR_DF1
${SOF_MATH_PATH}/iir_df1_generic.c
${SOF_MATH_PATH}/iir_df1_hifi3.c
${SOF_MATH_PATH}/iir_df1_hifi4.c
${SOF_MATH_PATH}/iir_df1_hifi5.c
${SOF_MATH_PATH}/iir_df1.c
)

zephyr_library_sources_ifdef(CONFIG_MATH_IIR_DF2T
${SOF_MATH_PATH}/iir_df2t_generic.c
${SOF_MATH_PATH}/iir_df2t_hifi3.c
${SOF_MATH_PATH}/iir_df2t.c
)

if(CONFIG_COMP_ASRC STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/asrc/llext
${PROJECT_BINARY_DIR}/asrc_llext)
Expand Down Expand Up @@ -1046,15 +949,6 @@ elseif(CONFIG_COMP_TDFB)
)
endif()

zephyr_library_sources_ifdef(CONFIG_SQRT_FIXED
${SOF_MATH_PATH}/sqrt_int16.c
)

zephyr_library_sources_ifdef(CONFIG_MATH_EXP
${SOF_MATH_PATH}/exp_fcn.c
${SOF_MATH_PATH}/exp_fcn_hifi.c
)

zephyr_library_sources_ifdef(CONFIG_COMP_UP_DOWN_MIXER
${SOF_AUDIO_PATH}/up_down_mixer/up_down_mixer.c
${SOF_AUDIO_PATH}/up_down_mixer/up_down_mixer_hifi3.c
Expand Down