File tree 8 files changed +30
-30
lines changed
8 files changed +30
-30
lines changed Original file line number Diff line number Diff line change @@ -402,11 +402,9 @@ GROUP_END(OCM)
402
402
/* Must be last in romable region */
403
403
SECTION_PROLOGUE(.last_section,,)
404
404
{
405
- #ifdef CONFIG_LINKER_LAST_SECTION_ID
406
- /* Fill last section with a word to ensure location counter and actual rom
407
- * region data usage match. */
408
- LONG (CONFIG_LINKER_LAST_SECTION_ID_PATTERN )
409
- #endif
405
+ /* .last_section contains a fixed word to ensure location counter and actual
406
+ * rom region data usage match when CONFIG_LINKER_LAST_SECTION_ID=y. */
407
+ KEEP(*(.last_section))
410
408
} GROUP_LINK_IN(ROMABLE_REGION)
411
409
412
410
/* To provide the image size as a const expression,
Original file line number Diff line number Diff line change @@ -488,11 +488,9 @@ GROUP_END(DTCM)
488
488
/* Must be last in romable region */
489
489
SECTION_PROLOGUE(.last_section,,)
490
490
{
491
- #ifdef CONFIG_LINKER_LAST_SECTION_ID
492
- /* Fill last section with a word to ensure location counter and actual rom
493
- * region data usage match. */
494
- LONG (CONFIG_LINKER_LAST_SECTION_ID_PATTERN )
495
- #endif
491
+ /* .last_section contains a fixed word to ensure location counter and actual
492
+ * rom region data usage match when CONFIG_LINKER_LAST_SECTION_ID=y. */
493
+ KEEP(*(.last_section))
496
494
} GROUP_LINK_IN(ROMABLE_REGION)
497
495
498
496
/* To provide the image size as a const expression,
Original file line number Diff line number Diff line change @@ -351,11 +351,9 @@ SECTIONS
351
351
/* Must be last in romable region */
352
352
SECTION_PROLOGUE(.last_section,,)
353
353
{
354
- #ifdef CONFIG_LINKER_LAST_SECTION_ID
355
- /* Fill last section with a word to ensure location counter and actual rom
356
- * region data usage match. */
357
- LONG (CONFIG_LINKER_LAST_SECTION_ID_PATTERN )
358
- #endif
354
+ /* .last_section contains a fixed word to ensure location counter and actual
355
+ * rom region data usage match when CONFIG_LINKER_LAST_SECTION_ID=y. */
356
+ KEEP(*(.last_section))
359
357
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
360
358
361
359
/* To provide the image size as a const expression,
Original file line number Diff line number Diff line change @@ -454,15 +454,13 @@ GROUP_END(DTCM)
454
454
/* Must be last in romable region */
455
455
SECTION_PROLOGUE(.last_section,,)
456
456
{
457
- #ifdef CONFIG_LINKER_LAST_SECTION_ID
458
- /* Fill last section with a word to ensure location counter and actual rom
459
- * region data usage match. */
460
- LONG (CONFIG_LINKER_LAST_SECTION_ID_PATTERN )
457
+ /* .last_section contains a fixed word to ensure location counter and actual
458
+ * rom region data usage match when CONFIG_LINKER_LAST_SECTION_ID=y. */
459
+ KEEP(*(.last_section))
461
460
/* __rom_region_size is used when configuring the PMP entry of the ROM region.
462
461
* Addresses (pmpaddr) in PMP registers need to be aligned to 4. Align
463
462
* __rom_region_size to 4 to meet that requirement. */
464
463
MPU_MIN_SIZE_ALIGN
465
- #endif
466
464
} GROUP_LINK_IN(ROMABLE_REGION)
467
465
468
466
/* To provide the image size as a const expression,
Original file line number Diff line number Diff line change @@ -25,3 +25,5 @@ zephyr_library_include_directories(
25
25
${ZEPHYR_BASE} /kernel/include
26
26
${ZEPHYR_BASE} /arch/${ARCH} /include
27
27
)
28
+
29
+ zephyr_sources_ifdef(CONFIG_LINKER_LAST_SECTION_ID last_section_id.c)
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2025, Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ */
7
+ #include <zephyr/types.h>
8
+
9
+ static uint32_t last_id __attribute__((section (".last_section" ))) __attribute__((__used__ )) =
10
+ CONFIG_LINKER_LAST_SECTION_ID_PATTERN ;
Original file line number Diff line number Diff line change @@ -412,11 +412,9 @@ GROUP_END(DTCM)
412
412
/* Must be last in romable region */
413
413
SECTION_PROLOGUE(.last_section,,)
414
414
{
415
- #ifdef CONFIG_LINKER_LAST_SECTION_ID
416
- /* Fill last section with a word to ensure location counter and actual rom
417
- * region data usage match. */
418
- LONG (CONFIG_LINKER_LAST_SECTION_ID_PATTERN )
419
- #endif
415
+ /* .last_section contains a fixed word to ensure location counter and actual
416
+ * rom region data usage match when CONFIG_LINKER_LAST_SECTION_ID=y. */
417
+ KEEP(*(.last_section))
420
418
} GROUP_LINK_IN(ROMABLE_REGION)
421
419
422
420
/* Because ROMABLE_REGION != RAMABLE_REGION in XIP-system, it is valid
Original file line number Diff line number Diff line change @@ -466,11 +466,9 @@ GROUP_END(DTCM)
466
466
/* Must be last in romable region */
467
467
SECTION_PROLOGUE(.last_section,,)
468
468
{
469
- #ifdef CONFIG_LINKER_LAST_SECTION_ID
470
- /* Fill last section with a word to ensure location counter and actual rom
471
- * region data usage match. */
472
- LONG (CONFIG_LINKER_LAST_SECTION_ID_PATTERN )
473
- #endif
469
+ /* .last_section contains a fixed word to ensure location counter and actual
470
+ * rom region data usage match when CONFIG_LINKER_LAST_SECTION_ID=y. */
471
+ KEEP(*(.last_section))
474
472
} GROUP_LINK_IN(ROMABLE_REGION)
475
473
476
474
/* To provide the image size as a const expression,
You can’t perform that action at this time.
0 commit comments