blob: d8949f3cd9eecb94d0fef6ee5faf295d6e92345d [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
Zelalem Aweke667416c2021-10-13 17:49:24 -05002 * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <platform_def.h>
8#include <xlat_tables_defs.h>
9
10OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
11OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
12ENTRY(ns_bl2u_entrypoint)
13
14MEMORY {
15 RAM (rwx): ORIGIN = NS_BL2U_BASE, LENGTH = NS_BL2U_LIMIT - NS_BL2U_BASE
16}
17
18SECTIONS
19{
20 . = NS_BL2U_BASE;
21 ASSERT(. == ALIGN(PAGE_SIZE),
22 "NS_BL2U_BASE address is not aligned on a page boundary.")
23
Ambroise Vincentee3e7cd2019-07-03 16:44:49 +010024 .text . : {
25 __TEXT_START__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020026 *ns_bl2u_entrypoint.o(.text*)
27 *(.text*)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020028 *(.vectors)
Ambroise Vincentee3e7cd2019-07-03 16:44:49 +010029 . = ALIGN(PAGE_SIZE);
30 __TEXT_END__ = .;
31 } >RAM
32
33 .rodata . : {
34 __RODATA_START__ = .;
35 *(.rodata*)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020036 /*
37 * Memory page(s) mapped to this section will be marked as
Ambroise Vincentee3e7cd2019-07-03 16:44:49 +010038 * read-only, non-executable. No RW data from the next section must
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020039 * creep in. Ensure the rest of the current memory page is unused.
40 */
41 . = ALIGN(PAGE_SIZE);
Ambroise Vincentee3e7cd2019-07-03 16:44:49 +010042 __RODATA_END__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020043 } >RAM
44
Zelalem Aweke667416c2021-10-13 17:49:24 -050045 __RW_START__ = .;
46
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020047 .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 Aweke667416c2021-10-13 17:49:24 -050080 __RW_END__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020081
82 __BSS_SIZE__ = SIZEOF(.bss);
83
84 ASSERT(. <= NS_BL2U_LIMIT, "NS_BL2U image has exceeded its limit.")
85}