-
Notifications
You must be signed in to change notification settings - Fork 349
zephyr/cmake: move math/*.c files to now common math/CMakeLists.txt #8548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,31 +5,40 @@ if(BUILD_LIBRARY) | |
| return() | ||
| endif() | ||
|
|
||
| is_zephyr(it_is_zephyr) | ||
|
|
||
| add_local_sources(sof numbers.c) | ||
|
|
||
| if(CONFIG_CORDIC_FIXED) | ||
| # Up to now, trig.c has never been optional in Zephyr. | ||
| # Maybe it should be in the future. | ||
| if(CONFIG_CORDIC_FIXED OR it_is_zephyr) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using the same name for managing math functions under Zephyr is not a good idea.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand @ShriramShastry. The purpose of this PR is to be very careful and NOT make any config "management" change. That can come later after this clean up. Currently, maths function are NOT managed in Zephyr. Did you not notice?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, What I mean is that
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No, that's not what it is. No one is going to "turn Zephyr on/off" to enable/disable some math functions. No one can decide whether they use Zephyr or not, it's not a choice. There is no such choice. Before this PR:
After this PR:
The purpose of this PR is to carefully NOT change that. If you want make to make CORDIC or other math code CONFIGurable in Zephyr then please submit a separate PR. This PR is a pure clean-up, it does not make any CONFIG change. |
||
| add_local_sources(sof trig.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_SQRT_FIXED sof sqrt_int16.c) | ||
|
|
||
| add_local_sources_ifdef(CONFIG_MATH_EXP sof exp_fcn.c exp_fcn_hifi.c) | ||
|
|
||
| if(CONFIG_MATH_DECIBELS) | ||
| # Up to now, decibels.c has never been optional in Zephyr. | ||
| # Maybe it should be in the future. | ||
| if(CONFIG_MATH_DECIBELS OR it_is_zephyr) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using the same name for managing math functions under Zephyr is not a good idea.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my question of the day to these changes: I understand that it's just carried over from the present global sof/zephyr/CMakeLists.txt, but now that we move to these local files, shouldn't we rather just
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I am thinking about it, and it makes more sense to me to have a select option with Zephyr.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Maybe yes but please, please do not distract this PR even further :-( |
||
| add_local_sources(sof decibels.c) | ||
| endif() | ||
|
|
||
| if(NOT it_is_zephyr) # So far none of these has ever been enabled in Zephyr. | ||
| add_local_sources_ifdef(CONFIG_NATURAL_LOGARITHM_FIXED sof log_e.c) | ||
|
|
||
| add_local_sources_ifdef(CONFIG_COMMON_LOGARITHM_FIXED sof log_10.c) | ||
|
|
||
| add_local_sources_ifdef(CONFIG_POWER_FIXED sof power.c) | ||
|
|
||
| add_local_sources_ifdef(CONFIG_BINARY_LOGARITHM_FIXED sof base2log.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_MATH_FIR sof fir_generic.c fir_hifi2ep.c fir_hifi3.c) | ||
|
|
||
| if(CONFIG_MATH_FFT) | ||
| # So far this directory has never been enabled in Zephyr. | ||
| if(CONFIG_MATH_FFT AND NOT it_is_zephyr) | ||
marc-hb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| add_subdirectory(fft) | ||
| endif() | ||
|
|
||
|
|
@@ -39,6 +48,7 @@ add_local_sources_ifdef(CONFIG_MATH_IIR_DF2T sof | |
| add_local_sources_ifdef(CONFIG_MATH_IIR_DF1 sof | ||
| iir_df1_generic.c iir_df1_hifi3.c iir_df1.c) | ||
|
|
||
| if(NOT it_is_zephyr) # So far none of these has ever been enabled in Zephyr. | ||
| if(CONFIG_MATH_WINDOW) | ||
| add_local_sources(sof window.c) | ||
| endif() | ||
|
|
@@ -54,3 +64,4 @@ endif() | |
| if(CONFIG_MATH_DCT) | ||
| add_local_sources(sof dct.c) | ||
| endif() | ||
| endif() # not Zephyr | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, do we have a CONFIG_ZEPHYR we can use here instead of
it_is_zephyr?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_zephyris only a check for CONFIG_ZEPHYR_SOF_MODULE. The indirection is for brevity, flexibility and "future-proofness".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just use
CONFIG_ZEPHYR_SOF_MODULEif they are equivalent.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are equivalent now but who knows in the future. I'm currently spreading this conditional across almost all
sof/**/CMakeLists.txtfiles, so this very thin indirection protects us against any future change. If this CONFIG_ namve ever changes in Zephyr in the future we could even make the macro support both the old and new for a seamless transition.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they are equivalent now then pls use, otherwise this is really just unneeded indirection today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tend to agree that the existing kconfigs aren't super well named for this purpose. They're artifacts of the way the upstream Zephyr module system works: ZEPHYR_SOF_MODULE is automatically generated, and 'config SOF' is added in the Kconfig for the module. FWIW I NAK'd the latter because in this context it means the opposite of what it says ("CONFIG_SOF" might be expected to mean "xtos/traditional SOF and not Zephyr", when it means the opposite).
My personal vote would be a SOF-internal API that contains "zephyr" in the name like this one. Whether it's a kconfig or a cmake macro doesn't seem all that important I guess? Would be easy to fix in a different patch too.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONFIG_CORDIC OR CONFIG_ZEPHYR_SOMETHING_MODULE_OPTION_OF_THE_DAYwould also give the wrong impression that both are choices, see discussion below. The second one is obviously not a CONFIGuration choice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a lot of naming inconsistent in SOF Kconfig space today, moving forward for v2.9 we can fix this with a
CONFIG_SOF_prefix i.e. its a SOF application Kconfig. For maths stuff we are going to be moving for v2.9 toCONFIG_SOF_MATH_XFor Zephyr stuff, we need something
CONFIG_SOF_ZEPHYR_Xthe precedence being this is a SOF Kconfig and NOT a Zephyr Kconfig.@marc-hb can you incrementally change the
is_zephyrto use the Kconfig, this way is easier for everyone to follow.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You lost me sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just found that some places started using
CONFIG_ZEPHYR_NATIVE_DRIVERS...