Skip to content

Commit 8e2c053

Browse files
hakehuangnashif
authored andcommitted
linker: device_state : add alignment setting
the device_state need realocate when boot as second core. as the relocation does not know the alignment, this could be a case that the next data is mis-place after relocation. fix this by add a alignment in device_state section. still need revert aec0355 reported in #86871 fixes: #82841 Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
1 parent b2340ba commit 8e2c053

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

arch/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,12 @@ config ARCH_IRQ_VECTOR_TABLE_ALIGN
515515
to be aligned to architecture specific size. The default
516516
size is 0 for no alignment.
517517

518+
config ARCH_DEVICE_STATE_ALIGN
519+
int "Alignment size of device state"
520+
default 4
521+
help
522+
This option controls alignment size of device state.
523+
518524
choice IRQ_VECTOR_TABLE_TYPE
519525
prompt "IRQ vector table type"
520526
depends on GEN_IRQ_VECTOR_TABLE

include/zephyr/linker/common-ram.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ ITERABLE_SECTION_RAM(scmi_protocol, Z_LINK_ITERABLE_SUBALIGN)
4141

4242
SECTION_DATA_PROLOGUE(device_states,,)
4343
{
44+
. = ALIGN(CONFIG_ARCH_DEVICE_STATE_ALIGN);
4445
/* Device states used by the device objects. */
4546
PLACE_SYMBOL_HERE(__device_states_start);
4647
KEEP(*(".z_devstate"));
4748
KEEP(*(".z_devstate.*"));
4849
PLACE_SYMBOL_HERE(__device_states_end);
50+
. = ALIGN(CONFIG_ARCH_DEVICE_STATE_ALIGN);
4951
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
5052

5153
#ifdef CONFIG_PM_DEVICE

0 commit comments

Comments
 (0)