Add missing zephyr,memory-region in STM32 dts & use LINKER_DT_NODE_REGION_NAME in LTDC for ext-sdram #95299
+80
−100
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR first goal is to introduce usage of the LINKER_DT_NODE_REGION_NAME within the STM32 LTDC driver in order to benefit from the Zephyr linker script generated based on zephyr,memory-region. With that done it is no more necessary to rely on STM32 specific linker scripts to select the area to store the framebuffer and simply point to the node of that memory using the ext-sdram property of the LTDC.
(btw, might want to change that property name, since this is not only SDRAM however maybe another PR, including migration-guide update might be better for that ...).
For this to work, regions to hold that framebuffer must have the right compatible in order to have Zephyr generate the linker-script properly. Looking within stm32 dtsi/dts files, I noticed that some were missing, especially for the STM32L4 for which I targetted that in the first place.
The first commit is thus adding the missing zephy,memory-region compatibles. While some are really necessary, I have doubt regarding some others. Since over the zephyr,sram is also pointing to such memory area, this leads also to cases where there is two lines printed in the print-memory-usage at the end of the build, such as below:
Above, the RAM and SRAM0 are actually the same region. Adding the zephyr,memory-region to SRAM0 makes it appears in the memory usage summary, and wrongly mentioned as usage is 0 while it is actually also RAM, hence 12.76% in the case above.
At the same time, the choice of having zephyr,sram pointing to the sram0 can vary (not always though) from a board / variant to another so it sounds like a good thing to have sram0 described as compatible zephyr,memory-region from within the .dtsi.
So, here a discussion point.
In a second commit, LTDC driver is updated to rely on the LINKER_DT_NODE_REGION_NAME macro to figure out the attribute to where store the framebuffer instead of STM32 specific hardcoded region names.
My understanding is that memc stm32 specific linker scripts were added for this purpose, so since LTDC do not need them anymore I removed them. If there were another usage for those linker scripts, then 3rd commit might not be needed.