scripts: implement automatic generation of various files#335
scripts: implement automatic generation of various files#335mathieuchopstm wants to merge 3 commits intozephyrproject-rtos:mainfrom
Conversation
Add an automatic generator for various files found in the hal_stm32 repo: - global stm32_assert.h header - global series list enumeration - per-series top-level CMakeLists - Zephyr-side modules/Kconfig.stm32 Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Generate series list using autogenpackage and consume this auto-generated list in the module's top-level CMakeLists.txt Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Generate multi-series stm32_assert.h using autogenpackage and consume it by replacing all existing files with one in a shared include directory, which is then added to the zephyr_include_directories(). Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
a6814df to
2fb7319
Compare
djiatsaf-st
left a comment
There was a problem hiding this comment.
I tested locally, and it works fine, but I have some questions /suggestions:
-
Is it okay to remove these copyrights?
-
Is it possible to add a
--only-seriesoption for a limited scope? This could be used when introducing a new series to generate packages only for that series instead of all series.
The new files are entirely generated from scratch (i.e., they have no relation to the "old" ones) so I don't think the old copyright has any reason to apply. On the other hand, maybe the copyright notice should be removed from the script-generated headers since they are merely script-generated.
Why? The script is idempotent, if you run it multiple times on the same files (i.e., unmodified series) then it won't have any effect. Unlike |
Okay, I understand. I think so; it will align with the other HAL-generated files.
Okay, I see. I was too focused on harmonizing the functions, like with HAL update and genpintcrl. |
Add a new script
autogenpackage(better name suggestions welcome) which can be used to automatically generate various files that were so far hand-authored:stm32_assert.hcommon_llCMakeLists.txtAdditionally, the script can generate the Zephyr-side
modules/Kconfig.stm32, ensuring that the HAL and Zephyr side of the module are always in sync. Other features include the ability to gate different drivers under the same Kconfig option (e.g.,DLYBfor drivers calleddlyb.con some series anddelayblock.con others) and easily include or force-exclude drivers from the build system (although this should be done as little as possible).As part of this PR, the series list and
stm32_assert.hare updated for the new infrastructure, but per-seriesCMakeLists.txtis left unchanged for now.There are still some points to discuss (e.g., script is oriented towards
system_stm32XXxx.cremoval) so this PR is opened as draft for discussion.