blob: d83b4e0183e7028906f55a6af080c731f3dd6351 [file] [log] [blame]
Soby Mathewec8ac1c2016-05-05 14:32:05 +01001/*
Masahiro Yamada0b67e562020-03-09 17:39:48 +09002 * Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved.
Soby Mathewec8ac1c2016-05-05 14:32:05 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soby Mathewec8ac1c2016-05-05 14:32:05 +01005 */
6
Masahiro Yamada0b67e562020-03-09 17:39:48 +09007#include <common/bl_common.ld.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008#include <lib/xlat_tables/xlat_tables_defs.h>
Soby Mathewec8ac1c2016-05-05 14:32:05 +01009
10OUTPUT_FORMAT(elf32-littlearm)
11OUTPUT_ARCH(arm)
12ENTRY(sp_min_vector_table)
13
14MEMORY {
15 RAM (rwx): ORIGIN = BL32_BASE, LENGTH = BL32_LIMIT - BL32_BASE
16}
17
Heiko Stuebner95ba3552019-04-11 15:26:07 +020018#ifdef PLAT_SP_MIN_EXTRA_LD_SCRIPT
19#include <plat_sp_min.ld.S>
20#endif
Soby Mathewec8ac1c2016-05-05 14:32:05 +010021
22SECTIONS
23{
24 . = BL32_BASE;
Antonio Nino Diaz2ce2b092017-11-15 11:45:35 +000025 ASSERT(. == ALIGN(PAGE_SIZE),
Soby Mathewec8ac1c2016-05-05 14:32:05 +010026 "BL32_BASE address is not aligned on a page boundary.")
27
28#if SEPARATE_CODE_AND_RODATA
29 .text . : {
30 __TEXT_START__ = .;
31 *entrypoint.o(.text*)
32 *(.text*)
Yatharth Kochar06460cd2016-06-30 15:02:31 +010033 *(.vectors)
Roberto Vargasd93fde32018-04-11 11:53:31 +010034 . = ALIGN(PAGE_SIZE);
Soby Mathewec8ac1c2016-05-05 14:32:05 +010035 __TEXT_END__ = .;
36 } >RAM
37
Roberto Vargas1d04c632018-05-10 11:01:16 +010038 /* .ARM.extab and .ARM.exidx are only added because Clang need them */
39 .ARM.extab . : {
40 *(.ARM.extab* .gnu.linkonce.armextab.*)
41 } >RAM
42
43 .ARM.exidx . : {
44 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
45 } >RAM
46
Soby Mathewec8ac1c2016-05-05 14:32:05 +010047 .rodata . : {
48 __RODATA_START__ = .;
49 *(.rodata*)
50
Masahiro Yamadaac1bfb92020-03-26 10:51:39 +090051 RT_SVC_DESCS
52 FCONF_POPULATOR
53 PMF_SVC_DESCS
54 CPU_OPS
Soby Mathewec8ac1c2016-05-05 14:32:05 +010055
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010056 /* Place pubsub sections for events */
57 . = ALIGN(8);
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000058#include <lib/el3_runtime/pubsub_events.h>
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010059
Roberto Vargasd93fde32018-04-11 11:53:31 +010060 . = ALIGN(PAGE_SIZE);
Soby Mathewec8ac1c2016-05-05 14:32:05 +010061 __RODATA_END__ = .;
62 } >RAM
63#else
64 ro . : {
65 __RO_START__ = .;
66 *entrypoint.o(.text*)
67 *(.text*)
68 *(.rodata*)
69
Masahiro Yamadaac1bfb92020-03-26 10:51:39 +090070 RT_SVC_DESCS
71 FCONF_POPULATOR
72 CPU_OPS
Soby Mathewec8ac1c2016-05-05 14:32:05 +010073
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010074 /* Place pubsub sections for events */
75 . = ALIGN(8);
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000076#include <lib/el3_runtime/pubsub_events.h>
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010077
Yatharth Kochar06460cd2016-06-30 15:02:31 +010078 *(.vectors)
Soby Mathewec8ac1c2016-05-05 14:32:05 +010079 __RO_END_UNALIGNED__ = .;
80
81 /*
82 * Memory page(s) mapped to this section will be marked as
83 * read-only, executable. No RW data from the next section must
84 * creep in. Ensure the rest of the current memory block is unused.
85 */
Roberto Vargasd93fde32018-04-11 11:53:31 +010086 . = ALIGN(PAGE_SIZE);
Soby Mathewec8ac1c2016-05-05 14:32:05 +010087 __RO_END__ = .;
88 } >RAM
89#endif
90
91 ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__,
92 "cpu_ops not defined for this platform.")
93 /*
94 * Define a linker symbol to mark start of the RW memory area for this
95 * image.
96 */
97 __RW_START__ = . ;
98
99 .data . : {
100 __DATA_START__ = .;
101 *(.data*)
102 __DATA_END__ = .;
103 } >RAM
104
Soby Mathewbf169232017-11-14 14:10:10 +0000105#ifdef BL32_PROGBITS_LIMIT
106 ASSERT(. <= BL32_PROGBITS_LIMIT, "BL32 progbits has exceeded its limit.")
107#endif
108
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100109 stacks (NOLOAD) : {
110 __STACKS_START__ = .;
111 *(tzfw_normal_stacks)
112 __STACKS_END__ = .;
113 } >RAM
114
115 /*
116 * The .bss section gets initialised to 0 at runtime.
Douglas Raillard21362a92016-12-02 13:51:54 +0000117 * Its base address should be 8-byte aligned for better performance of the
118 * zero-initialization code.
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100119 */
Douglas Raillard21362a92016-12-02 13:51:54 +0000120 .bss (NOLOAD) : ALIGN(8) {
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100121 __BSS_START__ = .;
122 *(.bss*)
123 *(COMMON)
Masahiro Yamadaac1bfb92020-03-26 10:51:39 +0900124 BAKERY_LOCK_NORMAL
125 PMF_TIMESTAMP
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100126 __BSS_END__ = .;
127 } >RAM
128
Masahiro Yamada0b67e562020-03-09 17:39:48 +0900129 XLAT_TABLE_SECTION >RAM
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100130
131 __BSS_SIZE__ = SIZEOF(.bss);
132
133#if USE_COHERENT_MEM
134 /*
135 * The base address of the coherent memory section must be page-aligned (4K)
136 * to guarantee that the coherent data are stored on their own pages and
137 * are not mixed with normal data. This is required to set up the correct
138 * memory attributes for the coherent data page tables.
139 */
Antonio Nino Diaz2ce2b092017-11-15 11:45:35 +0000140 coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100141 __COHERENT_RAM_START__ = .;
142 /*
143 * Bakery locks are stored in coherent memory
144 *
145 * Each lock's data is contiguous and fully allocated by the compiler
146 */
147 *(bakery_lock)
148 *(tzfw_coherent_mem)
149 __COHERENT_RAM_END_UNALIGNED__ = .;
150 /*
151 * Memory page(s) mapped to this section will be marked
152 * as device memory. No other unexpected data must creep in.
153 * Ensure the rest of the current memory page is unused.
154 */
Roberto Vargasd93fde32018-04-11 11:53:31 +0100155 . = ALIGN(PAGE_SIZE);
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100156 __COHERENT_RAM_END__ = .;
157 } >RAM
158
159 __COHERENT_RAM_UNALIGNED_SIZE__ =
160 __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__;
161#endif
162
163 /*
164 * Define a linker symbol to mark end of the RW memory area for this
165 * image.
166 */
167 __RW_END__ = .;
168
169 __BL32_END__ = .;
170}