-
Notifications
You must be signed in to change notification settings - Fork 8.2k
linker: Create sections from zephyr,memory-region nodes #43603
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
Conversation
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.
Non-CMake part LGTM, will defer CMake bits to @tejlmand
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.
Thanks for this, looks very useful.
A couple of questions and observations before final approval.
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 think we need better error checking for required arguments.
Currently when a node has a 'zephyr,memory-region' compatible and a 'zephyr,memory-region' string property, a new memory region is created in the linker script. Having a memory region without a section to place variables in could be not that useful. With this patch we extend the memory-region mechanism to also create sections. The user can then place variables in the sections as usual by using for example the GCC attributes. Signed-off-by: Carlo Caione <[email protected]>
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.
Thanks for putting this together.
In #42008 we introduced the
zephyr,memory-regioncompatible that can be used in the DT to automate the creation of memory regions in the linker script. When a node has azephyr,memory-regioncompatible and azephyr,memory-regionstring property, a new memory region is created in the linker script.Having a memory region without a section to place variables in, could be not that useful. With this patch we extend the memory-region mechanism to also create sections (more specifically we create one section for each memory region).
The user can then place variables in the sections as usual by using for example the GCC attributes.
This will be particularly useful when also #43119 will be merged so that for example we can place buffers and variables in non-cacheable memory regions / sections very easily and in a general way backed by DT.