-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Improve STM32 LL HAL usage #28822
Comments
cc: @erwango @ABOSTM, @FRASTM, @arnopo, @Mani-Sadhasivam, @ydamigos, @cybertale, @lowlander, @Nukersson, @lochej, @avisconti, @loicpoulain |
@gmarull is the generation of those files in the |
@lowlander The idea is to have a script that generates these headers in the |
Good idea. For me it looks like you're building some kind of My suggestion: Maybe we should define the needed functionality/architecture of |
@gmarull Sorry, I have previously occasionally edited your answer below (don't know, how it happened). Your comment is still in it's original form 😃 |
@Nukersson The proposal is not an abstraction layer in itself, it's just an additional header that includes the right LL header based on the active SOC_FAMILY in Zephyr. |
Just skimmed over your approach more intensively. I like it anyway. And it brings more portability between STM32 and Zephyr! Good work! |
Introduction
This RFC aims to improve the usage of STM32 LL HAL in both Zephyr drivers and for out-of-tree users.
Problem description
STM32 drivers using LL API need to include
stm32xxx_ll_yyy.h
headers in order to make use of the API. Nowadays this is done via thesoc.h
file, e.g. https://github.com/zephyrproject-rtos/zephyr/blob/master/soc/arm/st_stm32/stm32f4/soc.h. Inclusion of LL headers is dependent on active configuration, e.g.This approach has some problems:
soc.h
needs to be adjusted accordingly (SoC headers depend on driver configuration)soc.h
, it will include all LL headers that are active. For example, if ADC and DMA are active, both will be included. STM32 LL API is mainly built uponstatic inline
functions, so when we include all these headers we are pasting all of them in a driver that will, in most cases, just need one of the LL headers.soc.h
, so in case the application is designed for multiple series, it needs to include LL API based on the active SoC, e.g.Note that the non-LL HAL is not affected, as it already provides a header gathering all APIs. It can remain part of
soc.h
.Proposed change
My proposal is to provide SoC generic LL HAL headers, for example:
and then the driver would just include:
The advantages of this approach:
Detailed RFC
Proposed change (Detailed)
The first step would be to have the generic LL headers. Their generation can be scripted and included in the
stm32_hal
repository. The second step would be to take a reference driver, removesoc.h
entries and include LL API directly in the driver. It should be a small change and can be done gradually to all other drivers.Dependencies
To be discussed.
Concerns and Unresolved Questions
To be discussed.
Alternatives
N/A
The text was updated successfully, but these errors were encountered: