Skip to content

Conversation

@carlocaione
Copy link
Contributor

@carlocaione carlocaione commented Mar 9, 2022

In #42008 we introduced the zephyr,memory-region compatible that can be used in the DT to automate the creation of memory regions in the linker script. 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 (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.

@github-actions github-actions bot added area: API Changes to public APIs area: ARM ARM (32-bit) Architecture area: Build System area: RISCV RISCV Architecture (32-bit & 64-bit) area: Tests Issues related to a particular existing or missing test area: native port Host native arch port (native_sim) labels Mar 9, 2022
@carlocaione carlocaione removed area: RISCV RISCV Architecture (32-bit & 64-bit) area: Tests Issues related to a particular existing or missing test area: native port Host native arch port (native_sim) labels Mar 9, 2022
@carlocaione carlocaione marked this pull request as ready for review March 9, 2022 20:09
gmarull
gmarull previously approved these changes Mar 9, 2022
Copy link
Member

@gmarull gmarull left a 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

Copy link
Contributor

@tejlmand tejlmand left a 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.

@carlescufi carlescufi requested a review from tejlmand March 17, 2022 11:48
Copy link
Contributor

@tejlmand tejlmand left a 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.

@github-actions github-actions bot added the area: Devicetree Tooling PR modifies or adds a Device Tree tooling label Mar 17, 2022
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]>
Copy link
Member

@microbuilder microbuilder left a 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.

@nashif nashif merged commit bc72fb6 into zephyrproject-rtos:main Mar 19, 2022
@carlocaione carlocaione deleted the linker_sections branch March 21, 2022 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: API Changes to public APIs area: ARM ARM (32-bit) Architecture area: Build System area: Devicetree Tooling PR modifies or adds a Device Tree tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants