blob: 48af3036b7729296db2c81861a42b89d6174a38c [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
2 * Copyright (c) 2018, Arm Limited. All rights reserved.
3 *
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
24 ro . : {
25 __RO_START__ = .;
26 *ns_bl2u_entrypoint.o(.text*)
27 *(.text*)
28 *(.rodata*)
29 *(.vectors)
30 __RO_END_UNALIGNED__ = .;
31 /*
32 * Memory page(s) mapped to this section will be marked as
33 * read-only, executable. No RW data from the next section must
34 * creep in. Ensure the rest of the current memory page is unused.
35 */
36 . = ALIGN(PAGE_SIZE);
37 __RO_END__ = .;
38 } >RAM
39
40 .data . : {
41 __DATA_START__ = .;
42 *(.data*)
43 __DATA_END__ = .;
44 } >RAM
45
46 stacks (NOLOAD) : {
47 __STACKS_START__ = .;
48 *(ns_bl_normal_stacks)
49 __STACKS_END__ = .;
50 } >RAM
51
52 /*
53 * The .bss section gets initialised to 0 at runtime.
54 * Its base address must be 16-byte aligned.
55 */
56 .bss : ALIGN(16) {
57 __BSS_START__ = .;
58 *(SORT_BY_ALIGNMENT(.bss*))
59 *(COMMON)
60 __BSS_END__ = .;
61 } >RAM
62
63 /*
64 * The xlat_table section is for full, aligned page tables (4K).
65 * Removing them from .bss avoids forcing 4K alignment on
66 * the .bss section and eliminates the unecessary zero init
67 */
68 xlat_table (NOLOAD) : {
69 *(xlat_table)
70 } >RAM
71
72 __NS_BL2U_END__ = .;
73
74 __BSS_SIZE__ = SIZEOF(.bss);
75
76 ASSERT(. <= NS_BL2U_LIMIT, "NS_BL2U image has exceeded its limit.")
77}