blob: ce6c954eca54d95d4eb2e01c333092c985c3b8cc [file] [log] [blame]
Soby Mathewec8ac1c2016-05-05 14:32:05 +01001/*
Antonio Nino Diaz7c2a3ca2018-02-23 15:07:54 +00002 * Copyright (c) 2016-2018, 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
7#include <platform_def.h>
Antonio Nino Diaz2ce2b092017-11-15 11:45:35 +00008#include <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
18
19SECTIONS
20{
21 . = BL32_BASE;
Antonio Nino Diaz2ce2b092017-11-15 11:45:35 +000022 ASSERT(. == ALIGN(PAGE_SIZE),
Soby Mathewec8ac1c2016-05-05 14:32:05 +010023 "BL32_BASE address is not aligned on a page boundary.")
24
25#if SEPARATE_CODE_AND_RODATA
26 .text . : {
27 __TEXT_START__ = .;
28 *entrypoint.o(.text*)
29 *(.text*)
Yatharth Kochar06460cd2016-06-30 15:02:31 +010030 *(.vectors)
Roberto Vargasd93fde32018-04-11 11:53:31 +010031 . = ALIGN(PAGE_SIZE);
Soby Mathewec8ac1c2016-05-05 14:32:05 +010032 __TEXT_END__ = .;
33 } >RAM
34
Roberto Vargas1d04c632018-05-10 11:01:16 +010035 /* .ARM.extab and .ARM.exidx are only added because Clang need them */
36 .ARM.extab . : {
37 *(.ARM.extab* .gnu.linkonce.armextab.*)
38 } >RAM
39
40 .ARM.exidx . : {
41 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
42 } >RAM
43
Soby Mathewec8ac1c2016-05-05 14:32:05 +010044 .rodata . : {
45 __RODATA_START__ = .;
46 *(.rodata*)
47
48 /* Ensure 4-byte alignment for descriptors and ensure inclusion */
49 . = ALIGN(4);
50 __RT_SVC_DESCS_START__ = .;
51 KEEP(*(rt_svc_descs))
52 __RT_SVC_DESCS_END__ = .;
53
54 /*
55 * Ensure 4-byte alignment for cpu_ops so that its fields are also
56 * aligned. Also ensure cpu_ops inclusion.
57 */
58 . = ALIGN(4);
59 __CPU_OPS_START__ = .;
60 KEEP(*(cpu_ops))
61 __CPU_OPS_END__ = .;
62
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010063 /* Place pubsub sections for events */
64 . = ALIGN(8);
65#include <pubsub_events.h>
66
Roberto Vargasd93fde32018-04-11 11:53:31 +010067 . = ALIGN(PAGE_SIZE);
Soby Mathewec8ac1c2016-05-05 14:32:05 +010068 __RODATA_END__ = .;
69 } >RAM
70#else
71 ro . : {
72 __RO_START__ = .;
73 *entrypoint.o(.text*)
74 *(.text*)
75 *(.rodata*)
76
77 /* Ensure 4-byte alignment for descriptors and ensure inclusion */
78 . = ALIGN(4);
79 __RT_SVC_DESCS_START__ = .;
80 KEEP(*(rt_svc_descs))
81 __RT_SVC_DESCS_END__ = .;
82
83 /*
84 * Ensure 4-byte alignment for cpu_ops so that its fields are also
85 * aligned. Also ensure cpu_ops inclusion.
86 */
87 . = ALIGN(4);
88 __CPU_OPS_START__ = .;
89 KEEP(*(cpu_ops))
90 __CPU_OPS_END__ = .;
91
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010092 /* Place pubsub sections for events */
93 . = ALIGN(8);
94#include <pubsub_events.h>
95
Yatharth Kochar06460cd2016-06-30 15:02:31 +010096 *(.vectors)
Soby Mathewec8ac1c2016-05-05 14:32:05 +010097 __RO_END_UNALIGNED__ = .;
98
99 /*
100 * Memory page(s) mapped to this section will be marked as
101 * read-only, executable. No RW data from the next section must
102 * creep in. Ensure the rest of the current memory block is unused.
103 */
Roberto Vargasd93fde32018-04-11 11:53:31 +0100104 . = ALIGN(PAGE_SIZE);
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100105 __RO_END__ = .;
106 } >RAM
107#endif
108
109 ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__,
110 "cpu_ops not defined for this platform.")
111 /*
112 * Define a linker symbol to mark start of the RW memory area for this
113 * image.
114 */
115 __RW_START__ = . ;
116
117 .data . : {
118 __DATA_START__ = .;
119 *(.data*)
120 __DATA_END__ = .;
121 } >RAM
122
Soby Mathewbf169232017-11-14 14:10:10 +0000123#ifdef BL32_PROGBITS_LIMIT
124 ASSERT(. <= BL32_PROGBITS_LIMIT, "BL32 progbits has exceeded its limit.")
125#endif
126
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100127 stacks (NOLOAD) : {
128 __STACKS_START__ = .;
129 *(tzfw_normal_stacks)
130 __STACKS_END__ = .;
131 } >RAM
132
133 /*
134 * The .bss section gets initialised to 0 at runtime.
Douglas Raillard21362a92016-12-02 13:51:54 +0000135 * Its base address should be 8-byte aligned for better performance of the
136 * zero-initialization code.
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100137 */
Douglas Raillard21362a92016-12-02 13:51:54 +0000138 .bss (NOLOAD) : ALIGN(8) {
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100139 __BSS_START__ = .;
140 *(.bss*)
141 *(COMMON)
142#if !USE_COHERENT_MEM
143 /*
144 * Bakery locks are stored in normal .bss memory
145 *
146 * Each lock's data is spread across multiple cache lines, one per CPU,
147 * but multiple locks can share the same cache line.
148 * The compiler will allocate enough memory for one CPU's bakery locks,
149 * the remaining cache lines are allocated by the linker script
150 */
151 . = ALIGN(CACHE_WRITEBACK_GRANULE);
152 __BAKERY_LOCK_START__ = .;
153 *(bakery_lock)
154 . = ALIGN(CACHE_WRITEBACK_GRANULE);
155 __PERCPU_BAKERY_LOCK_SIZE__ = ABSOLUTE(. - __BAKERY_LOCK_START__);
156 . = . + (__PERCPU_BAKERY_LOCK_SIZE__ * (PLATFORM_CORE_COUNT - 1));
157 __BAKERY_LOCK_END__ = .;
158#ifdef PLAT_PERCPU_BAKERY_LOCK_SIZE
159 ASSERT(__PERCPU_BAKERY_LOCK_SIZE__ == PLAT_PERCPU_BAKERY_LOCK_SIZE,
160 "PLAT_PERCPU_BAKERY_LOCK_SIZE does not match bakery lock requirements");
161#endif
162#endif
163
164#if ENABLE_PMF
165 /*
166 * Time-stamps are stored in normal .bss memory
167 *
168 * The compiler will allocate enough memory for one CPU's time-stamps,
169 * the remaining memory for other CPU's is allocated by the
170 * linker script
171 */
172 . = ALIGN(CACHE_WRITEBACK_GRANULE);
173 __PMF_TIMESTAMP_START__ = .;
174 KEEP(*(pmf_timestamp_array))
175 . = ALIGN(CACHE_WRITEBACK_GRANULE);
176 __PMF_PERCPU_TIMESTAMP_END__ = .;
177 __PERCPU_TIMESTAMP_SIZE__ = ABSOLUTE(. - __PMF_TIMESTAMP_START__);
178 . = . + (__PERCPU_TIMESTAMP_SIZE__ * (PLATFORM_CORE_COUNT - 1));
179 __PMF_TIMESTAMP_END__ = .;
180#endif /* ENABLE_PMF */
181
182 __BSS_END__ = .;
183 } >RAM
184
185 /*
186 * The xlat_table section is for full, aligned page tables (4K).
187 * Removing them from .bss avoids forcing 4K alignment on
Antonio Nino Diaz7c2a3ca2018-02-23 15:07:54 +0000188 * the .bss section. The tables are initialized to zero by the translation
189 * tables library.
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100190 */
191 xlat_table (NOLOAD) : {
192 *(xlat_table)
193 } >RAM
194
195 __BSS_SIZE__ = SIZEOF(.bss);
196
197#if USE_COHERENT_MEM
198 /*
199 * The base address of the coherent memory section must be page-aligned (4K)
200 * to guarantee that the coherent data are stored on their own pages and
201 * are not mixed with normal data. This is required to set up the correct
202 * memory attributes for the coherent data page tables.
203 */
Antonio Nino Diaz2ce2b092017-11-15 11:45:35 +0000204 coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100205 __COHERENT_RAM_START__ = .;
206 /*
207 * Bakery locks are stored in coherent memory
208 *
209 * Each lock's data is contiguous and fully allocated by the compiler
210 */
211 *(bakery_lock)
212 *(tzfw_coherent_mem)
213 __COHERENT_RAM_END_UNALIGNED__ = .;
214 /*
215 * Memory page(s) mapped to this section will be marked
216 * as device memory. No other unexpected data must creep in.
217 * Ensure the rest of the current memory page is unused.
218 */
Roberto Vargasd93fde32018-04-11 11:53:31 +0100219 . = ALIGN(PAGE_SIZE);
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100220 __COHERENT_RAM_END__ = .;
221 } >RAM
222
223 __COHERENT_RAM_UNALIGNED_SIZE__ =
224 __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__;
225#endif
226
227 /*
228 * Define a linker symbol to mark end of the RW memory area for this
229 * image.
230 */
231 __RW_END__ = .;
232
233 __BL32_END__ = .;
234}