blob: 2ca5292c5478d5b5c63af326839cb3654e23f2c9 [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_bl1u_entrypoint)
13
14MEMORY {
15 ROM (rx): ORIGIN = NS_BL1U_RO_BASE, LENGTH = NS_BL1U_RO_LIMIT - NS_BL1U_RO_BASE
16 RAM (rwx): ORIGIN = NS_BL1U_RW_BASE, LENGTH = NS_BL1U_RW_LIMIT - NS_BL1U_RW_BASE
17}
18
19SECTIONS
20{
21 . = NS_BL1U_RO_BASE;
22 ASSERT(. == ALIGN(PAGE_SIZE),
23 "NS_BL1U_RO_BASE address is not aligned on a page boundary.")
24
25 ro . : {
26 __RO_START__ = .;
27 *ns_bl1u_entrypoint.o(.text*)
28 *(.text*)
29 *(.rodata*)
30 __RO_END__ = .;
31 } >ROM
32
33 /*
34 * The .data section gets copied from ROM to RAM at runtime.
35 * Its LMA must be 16-byte aligned.
36 * Its VMA must be page-aligned as it marks the first read/write page.
37 */
38 . = NS_BL1U_RW_BASE;
39 ASSERT(. == ALIGN(PAGE_SIZE),
40 "NS_BL1U_RW_BASE address is not aligned on a page boundary.")
41 .data . : ALIGN(16) {
42 __DATA_RAM_START__ = .;
43 *(.data*)
44 __DATA_RAM_END__ = .;
45 } >RAM AT>ROM
46
47 stacks . (NOLOAD) : {
48 __STACKS_START__ = .;
49 *(ns_bl_normal_stacks)
50 __STACKS_END__ = .;
51 } >RAM
52
53 /*
54 * The .bss section gets initialised to 0 at runtime.
55 * Its base address must be 16-byte aligned.
56 */
57 .bss : ALIGN(16) {
58 __BSS_START__ = .;
59 *(SORT_BY_ALIGNMENT(.bss*))
60 *(COMMON)
61 __BSS_END__ = .;
62 } >RAM
63
64 /*
65 * The xlat_table section is for full, aligned page tables (4K).
66 * Removing them from .bss avoids forcing 4K alignment on
67 * the .bss section and eliminates the unecessary zero init
68 */
69 xlat_table (NOLOAD) : {
70 *(xlat_table)
71 } >RAM
72
73 __NS_BL1U_RAM_START__ = ADDR(.data);
74 __NS_BL1U_RAM_END__ = .;
75
76 __DATA_ROM_START__ = LOADADDR(.data);
77 __DATA_SIZE__ = SIZEOF(.data);
78
79 /*
80 * The .data section is the last PROGBITS section so its end marks the end
81 * of the read-only part of NS_BL1U's binary.
82 */
83 ASSERT(__DATA_ROM_START__ + __DATA_SIZE__ <= NS_BL1U_RO_LIMIT,
84 "NS_BL1U's RO section has exceeded its limit.")
85
86 __BSS_SIZE__ = SIZEOF(.bss);
87
88 ASSERT(. <= NS_BL1U_RW_LIMIT, "NS_BL1U's RW section has exceeded its limit.")
89}