-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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: simplify memory region generation #34185
linker: aarch32: simplify memory region generation #34185
Conversation
Adds a public macro for creating memory regions from devicetree nodes. `DT_REGION_FROM_NODE_STATUS_OKAY` declares the memory regions for consumption by ld, assuming the node exists and has `status = "okay"`. Signed-off-by: Jordan Yates <[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.
Minor changes requested but otherwise welcomed addition, thanks!
Simplify the linker script by using the helper macros introduced in <linker/devicetree_regions.h>. The conditional checks on the Kconfig symbols are discarded as their default values are typically set via the status="okay" property of the nodes, and hence the behaviour doesn't change. Signed-off-by: Jordan Yates <[email protected]>
Move the definition of the two IPC RAM blocks from `#define`'s in family linker scripts to proper devicetree nodes. Use the devicetree nodes to generate the memory regions. Signed-off-by: Jordan Yates <[email protected]>
Define the FLASH_CCFG memory region from a devicetree partition instead of from math in the linker file. Removing the special math case results in the FLASH_CCFG region overlapping the FLASH region, but the linker accepts this until the FLASH region actually starts placing variables in the FLASH_CCFG region. As a result, applications that don't fit in (FLASH_SIZE - 88) bytes will still fail to link, just with an overlapping memory region error instead of an overflow error. Signed-off-by: Jordan Yates <[email protected]>
Move the TI_CCFG linker section code into a dedicated snippet in the soc directory. Signed-off-by: Jordan Yates <[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.
Nice cleanup, thanks. 👍
Nice work here - sorry I had no chance to review this. |
Turns out this broke code relocation to these regions, as the relocation script expects |
@MaureenHelm is there a sample which produces the error, or can be modified to produce it? |
@JordanYates the relocate script uses the |
@pdgendt thanks for that link, can you provide a board & sample which fails to build? |
@JordanYates you can build
|
With the addition of #34185, it is not longer gauranteed that for a memory region `NAME` there exists a symbol `NAME_ADDR`. Use the linker builtin function `ORIGIN` to instead directly get the start address of the selected memory region. Signed-off-by: Jordan Yates <[email protected]>
Generating linker memory regions from devicetree nodes is a common pattern in the linker script. This PR adds a macro which automatically generates a region given a devicetree node. The macro is then used in the linker script to cleanup definitions.
Dedicated devicetree nodes are created for SRAM1 and SRAM2 for the STM32WB family to facilitate macro usage.
The TI_CCFG registers are redefined as a partition on
flash0
to enable more cleanup.