Skip to content

Support .last_section and _flash_used on all architectures #50840

@tejlmand

Description

@tejlmand

Is your enhancement proposal related to a problem? Please describe.
The following achitectures contains a .last_section section to facilitate flash / rom region usage calculation: riscv, arm, arm64.

SECTION_PROLOGUE(.last_section,(NOLOAD),)
{
} GROUP_LINK_IN(ROMABLE_REGION)

SECTION_PROLOGUE(.last_section,(NOLOAD),)
{
} GROUP_LINK_IN(ROMABLE_REGION)

The arm architectures also contains a _flash_used symbol.

_flash_used = LOADADDR(.last_section) - __rom_region_start;

Describe the solution you'd like
Introduce the .last_section as common section on all architectures, together with a common symbol, for examplke _flash_used, that is then universally available on all architectures if a sample needs to use it.

This will also ensure the different architectures are aligned in their support for linker symbols, thus making it both easier to understand use Zephyr, as well as maintain the linker scripts.

Describe alternatives you've considered
N/A

Additional context
N/A

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions