Skip to content
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

linker: aarch32: automatically enumerate linker memory regions #34537

Closed

Conversation

JordanYates
Copy link
Collaborator

Update the aarch32 linker script to automatically generate memory regions for nodes with a new compatible, linkable-memory.
The goal of this PR is to enable the generation of (simple) memory regions purely from devicetree, without having to modify linker.ld.

Based on a good idea here: #34167 (comment)

Jordan Yates added 3 commits May 1, 2021 10:24
Adds `DT_COMPAT_FOREACH_STATUS_OKAY`, which has the same behaviour as
`DT_INST_FOREACH_STATUS_OKAY`, except that it takes an explicit
compatible instead of `DT_DRV_COMPAT`. This allows users to run macros
on multiple compatibles without requiring a `#define` `#undef` pair for
each one.

Reimplements `DT_INST_FOREACH_STATUS_OKAY` in terms of the new macro.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Adds a macro that automatically generate memory regions for all
devicetree nodes with a compatible matching 'linkable-memory'.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Automatically generate memory regions from devicetree compatibles.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Jordan Yates added 5 commits May 1, 2021 11:40
Add the `linkable-memory` compatible to all in-tree definitions of ITCM
(Instruction Tighly-Coupled Memory). Also adds a label property to
ensure that memory region names remain the same.

Remove the manual inclusion of ITCM regions in linker.ld, as they are
automatically picked up by `DT_LINKABLE_MEMORY_REGIONS()`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add the `linkable-memory` compatible to all in-tree definitions of DTCM
(Data Tighly-Coupled Memory). Also adds a label property to ensure that
memory region names remain the same.

Remove the manual inclusion of DTCM regions in linker.ld, as they are
automatically picked up by `DT_LINKABLE_MEMORY_REGIONS()`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add the `linkable-memory` compatible to all in-tree definitions of CCM
(Core Coupled Memory). Also adds a label property to ensure that memory
region names remain the same.

Remove the manual inclusion of CCM regions in linker.ld, as they are
automatically picked up by `DT_LINKABLE_MEMORY_REGIONS()`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add the `linkable-memory` compatible to all in-tree definitions of
backup_sram.

Remove the manual inclusion of backup_sram regions in linker.ld, as they
are automatically picked up by `DT_LINKABLE_MEMORY_REGIONS()`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add the `linkable-memory` compatible to stm32wb IPC nodes sram1 and
sram2. Also adds a label property to ensure that memory region names
remain the same.

Remove the manual inclusion of IPC sram regions in linker.ld, as they
are automatically picked up by `DT_LINKABLE_MEMORY_REGIONS()`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add the `linkable-memory` compatible to stm32 SDRAM nodes sdram1 and
sdram2. Also adds a label property to ensure that memory region names
remain the same.

Remove the manual inclusion of these regions in linker.ld, as they
are automatically picked up by `DT_LINKABLE_MEMORY_REGIONS()`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add the `linkable-memory` compatible to sram3 and sram4 memories. Also
adds a label property to ensure that memory region names remain the
same.

Remove the manual inclusion of these regions in linker.ld, as they
are automatically picked up by `DT_LINKABLE_MEMORY_REGIONS()`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
@JordanYates
Copy link
Collaborator Author

Closing as a new hardcoded compatible is not the best direction. Using existing "mmio-sram" is preferable, but requires other work beforehand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants