Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
Zelalem Aweke | 667416c | 2021-10-13 17:49:24 -0500 | [diff] [blame] | 2 | * Copyright (c) 2018-2021, Arm Limited. All rights reserved. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <platform_def.h> |
| 8 | #include <xlat_tables_defs.h> |
| 9 | |
| 10 | OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) |
| 11 | OUTPUT_ARCH(PLATFORM_LINKER_ARCH) |
| 12 | ENTRY(ns_bl2u_entrypoint) |
| 13 | |
| 14 | MEMORY { |
| 15 | RAM (rwx): ORIGIN = NS_BL2U_BASE, LENGTH = NS_BL2U_LIMIT - NS_BL2U_BASE |
| 16 | } |
| 17 | |
| 18 | SECTIONS |
| 19 | { |
| 20 | . = NS_BL2U_BASE; |
| 21 | ASSERT(. == ALIGN(PAGE_SIZE), |
| 22 | "NS_BL2U_BASE address is not aligned on a page boundary.") |
| 23 | |
Ambroise Vincent | ee3e7cd | 2019-07-03 16:44:49 +0100 | [diff] [blame] | 24 | .text . : { |
| 25 | __TEXT_START__ = .; |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 26 | *ns_bl2u_entrypoint.o(.text*) |
| 27 | *(.text*) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 28 | *(.vectors) |
Ambroise Vincent | ee3e7cd | 2019-07-03 16:44:49 +0100 | [diff] [blame] | 29 | . = ALIGN(PAGE_SIZE); |
| 30 | __TEXT_END__ = .; |
| 31 | } >RAM |
| 32 | |
| 33 | .rodata . : { |
| 34 | __RODATA_START__ = .; |
| 35 | *(.rodata*) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 36 | /* |
| 37 | * Memory page(s) mapped to this section will be marked as |
Ambroise Vincent | ee3e7cd | 2019-07-03 16:44:49 +0100 | [diff] [blame] | 38 | * read-only, non-executable. No RW data from the next section must |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 39 | * creep in. Ensure the rest of the current memory page is unused. |
| 40 | */ |
| 41 | . = ALIGN(PAGE_SIZE); |
Ambroise Vincent | ee3e7cd | 2019-07-03 16:44:49 +0100 | [diff] [blame] | 42 | __RODATA_END__ = .; |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 43 | } >RAM |
| 44 | |
Zelalem Aweke | 667416c | 2021-10-13 17:49:24 -0500 | [diff] [blame] | 45 | __RW_START__ = .; |
| 46 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 47 | .data . : { |
| 48 | __DATA_START__ = .; |
| 49 | *(.data*) |
| 50 | __DATA_END__ = .; |
| 51 | } >RAM |
| 52 | |
| 53 | stacks (NOLOAD) : { |
| 54 | __STACKS_START__ = .; |
| 55 | *(ns_bl_normal_stacks) |
| 56 | __STACKS_END__ = .; |
| 57 | } >RAM |
| 58 | |
| 59 | /* |
| 60 | * The .bss section gets initialised to 0 at runtime. |
| 61 | * Its base address must be 16-byte aligned. |
| 62 | */ |
| 63 | .bss : ALIGN(16) { |
| 64 | __BSS_START__ = .; |
| 65 | *(SORT_BY_ALIGNMENT(.bss*)) |
| 66 | *(COMMON) |
| 67 | __BSS_END__ = .; |
| 68 | } >RAM |
| 69 | |
| 70 | /* |
| 71 | * The xlat_table section is for full, aligned page tables (4K). |
| 72 | * Removing them from .bss avoids forcing 4K alignment on |
| 73 | * the .bss section and eliminates the unecessary zero init |
| 74 | */ |
| 75 | xlat_table (NOLOAD) : { |
| 76 | *(xlat_table) |
| 77 | } >RAM |
| 78 | |
| 79 | __NS_BL2U_END__ = .; |
Zelalem Aweke | 667416c | 2021-10-13 17:49:24 -0500 | [diff] [blame] | 80 | __RW_END__ = .; |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 81 | |
| 82 | __BSS_SIZE__ = SIZEOF(.bss); |
| 83 | |
| 84 | ASSERT(. <= NS_BL2U_LIMIT, "NS_BL2U image has exceeded its limit.") |
| 85 | } |