Skip to content

Commit f079e66

Browse files
povergoingcfriedt
authored andcommitted
scripts: Add align for empty _app_smem region
When _app_smem region is empty, alignment is also needed. If there is no alignment, the _app_smem_start used by arm mpu can be lower than __rodata_region_end, and this two regions can overlap. The Armv8-R aarch64 MPU does not allow overlapped regions. Signed-off-by: Jaxson Han <[email protected]>
1 parent b7734d2 commit f079e66

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/arch/arm64/scripts/linker.ld

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,16 @@ SECTIONS
218218
#define APP_SHARED_ALIGN . = ALIGN(_region_min_align);
219219
#define SMEM_PARTITION_ALIGN(size) MMU_ALIGN
220220

221+
#if defined(CONFIG_ARM_MPU)
222+
/*
223+
* When _app_smem region is empty, alignment is also needed. If there
224+
* is no alignment, the _app_smem_start used by arm mpu can be lower
225+
* than __rodata_region_end, and this two regions can overlap.
226+
* The Armv8-R aarch64 MPU does not allow overlapped regions.
227+
*/
228+
#define EMPTY_APP_SHARED_ALIGN APP_SHARED_ALIGN
229+
#endif
230+
221231
#include <app_smem.ld>
222232

223233
_app_smem_size = _app_smem_end - _app_smem_start;

scripts/gen_app_partitions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@
9090
empty_app_smem = """
9191
SECTION_PROLOGUE(_APP_SMEM{1}_SECTION_NAME,,)
9292
{{
93+
#ifdef EMPTY_APP_SHARED_ALIGN
94+
EMPTY_APP_SHARED_ALIGN;
95+
#endif
9396
_app_smem{0}_start = .;
9497
_app_smem{0}_end = .;
9598
}} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)

0 commit comments

Comments
 (0)