File tree Expand file tree Collapse file tree 8 files changed +30
-30
lines changed Expand file tree Collapse file tree 8 files changed +30
-30
lines changed Original file line number Diff line number Diff line change @@ -366,11 +366,9 @@ GROUP_END(OCM)
366
366
/* Must be last in romable region */
367
367
SECTION_PROLOGUE(.last_section,,)
368
368
{
369
- #ifdef CONFIG_LINKER_LAST_SECTION_ID
370
- /* Fill last section with a word to ensure location counter and actual rom
371
- * region data usage match. */
372
- LONG (CONFIG_LINKER_LAST_SECTION_ID_PATTERN )
373
- #endif
369
+ /* .last_section contains a fixed word to ensure location counter and actual
370
+ * rom region data usage match when CONFIG_LINKER_LAST_SECTION_ID=y. */
371
+ KEEP(*(.last_section))
374
372
} GROUP_LINK_IN(ROMABLE_REGION)
375
373
376
374
/* To provide the image size as a const expression,
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
/* 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 @@ -28,3 +28,5 @@ zephyr_library_include_directories(
28
28
${ZEPHYR_BASE} /kernel/include
29
29
${ZEPHYR_BASE} /arch/${ARCH}/include
30
30
)
31
+
32
+ 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 @@ -421,11 +421,9 @@ GROUP_END(DTCM)
421
421
/* Must be last in romable region */
422
422
SECTION_PROLOGUE(.last_section,,)
423
423
{
424
- #ifdef CONFIG_LINKER_LAST_SECTION_ID
425
- /* Fill last section with a word to ensure location counter and actual rom
426
- * region data usage match. */
427
- LONG (CONFIG_LINKER_LAST_SECTION_ID_PATTERN )
428
- #endif
424
+ /* .last_section contains a fixed word to ensure location counter and actual
425
+ * rom region data usage match when CONFIG_LINKER_LAST_SECTION_ID=y. */
426
+ KEEP(*(.last_section))
429
427
} GROUP_LINK_IN(ROMABLE_REGION)
430
428
431
429
/* 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