blob: 0a2bad01e5a13b9b43de9e365fbc78d7c001d321 [file] [log] [blame]
Soby Mathewec8ac1c2016-05-05 14:32:05 +01001/*
Chris Kay33bfc5e2023-02-14 11:30:04 +00002 * Copyright (c) 2016-2023, 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
Chris Kay4b7660a2022-09-29 14:36:53 +010019# include <plat_sp_min.ld.S>
20#endif /* PLAT_SP_MIN_EXTRA_LD_SCRIPT */
Soby Mathewec8ac1c2016-05-05 14:32:05 +010021
Chris Kay4b7660a2022-09-29 14:36:53 +010022SECTIONS {
Harrison Mutaic9f96d12023-04-19 09:30:15 +010023 RAM_REGION_START = ORIGIN(RAM);
24 RAM_REGION_LENGTH = LENGTH(RAM);
Soby Mathewec8ac1c2016-05-05 14:32:05 +010025 . = BL32_BASE;
Chris Kay4b7660a2022-09-29 14:36:53 +010026
Yann Gautier876be652020-10-05 09:54:09 +020027 ASSERT(. == ALIGN(PAGE_SIZE),
Chris Kay4b7660a2022-09-29 14:36:53 +010028 "BL32_BASE address is not aligned on a page boundary.")
Soby Mathewec8ac1c2016-05-05 14:32:05 +010029
30#if SEPARATE_CODE_AND_RODATA
31 .text . : {
32 __TEXT_START__ = .;
Chris Kay4b7660a2022-09-29 14:36:53 +010033
Soby Mathewec8ac1c2016-05-05 14:32:05 +010034 *entrypoint.o(.text*)
Yann Gautier876be652020-10-05 09:54:09 +020035 *(SORT_BY_ALIGNMENT(.text*))
Yatharth Kochar06460cd2016-06-30 15:02:31 +010036 *(.vectors)
Chris Kay4b7660a2022-09-29 14:36:53 +010037
Roberto Vargasd93fde32018-04-11 11:53:31 +010038 . = ALIGN(PAGE_SIZE);
Chris Kay4b7660a2022-09-29 14:36:53 +010039
Soby Mathewec8ac1c2016-05-05 14:32:05 +010040 __TEXT_END__ = .;
41 } >RAM
42
Chris Kay4b7660a2022-09-29 14:36:53 +010043 /* .ARM.extab and .ARM.exidx are only added because Clang needs them */
44 .ARM.extab . : {
Roberto Vargas1d04c632018-05-10 11:01:16 +010045 *(.ARM.extab* .gnu.linkonce.armextab.*)
Chris Kay4b7660a2022-09-29 14:36:53 +010046 } >RAM
Roberto Vargas1d04c632018-05-10 11:01:16 +010047
Chris Kay4b7660a2022-09-29 14:36:53 +010048 .ARM.exidx . : {
Roberto Vargas1d04c632018-05-10 11:01:16 +010049 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
Chris Kay4b7660a2022-09-29 14:36:53 +010050 } >RAM
Roberto Vargas1d04c632018-05-10 11:01:16 +010051
Soby Mathewec8ac1c2016-05-05 14:32:05 +010052 .rodata . : {
53 __RODATA_START__ = .;
Yann Gautier876be652020-10-05 09:54:09 +020054 *(SORT_BY_ALIGNMENT(.rodata*))
Soby Mathewec8ac1c2016-05-05 14:32:05 +010055
Chris Kay4b7660a2022-09-29 14:36:53 +010056 RODATA_COMMON
Soby Mathewec8ac1c2016-05-05 14:32:05 +010057
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010058 . = ALIGN(8);
Chris Kay4b7660a2022-09-29 14:36:53 +010059
60# include <lib/el3_runtime/pubsub_events.h>
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010061
Roberto Vargasd93fde32018-04-11 11:53:31 +010062 . = ALIGN(PAGE_SIZE);
Chris Kay4b7660a2022-09-29 14:36:53 +010063
Soby Mathewec8ac1c2016-05-05 14:32:05 +010064 __RODATA_END__ = .;
65 } >RAM
Chris Kay4b7660a2022-09-29 14:36:53 +010066#else /* SEPARATE_CODE_AND_RODATA */
Chris Kay33bfc5e2023-02-14 11:30:04 +000067 .ro . : {
Soby Mathewec8ac1c2016-05-05 14:32:05 +010068 __RO_START__ = .;
Chris Kay4b7660a2022-09-29 14:36:53 +010069
Soby Mathewec8ac1c2016-05-05 14:32:05 +010070 *entrypoint.o(.text*)
Yann Gautier876be652020-10-05 09:54:09 +020071 *(SORT_BY_ALIGNMENT(.text*))
72 *(SORT_BY_ALIGNMENT(.rodata*))
Soby Mathewec8ac1c2016-05-05 14:32:05 +010073
Chris Kay4b7660a2022-09-29 14:36:53 +010074 RODATA_COMMON
Soby Mathewec8ac1c2016-05-05 14:32:05 +010075
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010076 . = ALIGN(8);
Chris Kay4b7660a2022-09-29 14:36:53 +010077
78# include <lib/el3_runtime/pubsub_events.h>
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010079
Yatharth Kochar06460cd2016-06-30 15:02:31 +010080 *(.vectors)
Chris Kay4b7660a2022-09-29 14:36:53 +010081
Soby Mathewec8ac1c2016-05-05 14:32:05 +010082 __RO_END_UNALIGNED__ = .;
83
84 /*
Chris Kay4b7660a2022-09-29 14:36:53 +010085 * Memory page(s) mapped to this section will be marked as device
86 * memory. No other unexpected data must creep in. Ensure that the rest
87 * of the current memory page is unused.
Soby Mathewec8ac1c2016-05-05 14:32:05 +010088 */
Roberto Vargasd93fde32018-04-11 11:53:31 +010089 . = ALIGN(PAGE_SIZE);
Chris Kay4b7660a2022-09-29 14:36:53 +010090
Soby Mathewec8ac1c2016-05-05 14:32:05 +010091 __RO_END__ = .;
92 } >RAM
Chris Kay4b7660a2022-09-29 14:36:53 +010093#endif /* SEPARATE_CODE_AND_RODATA */
Soby Mathewec8ac1c2016-05-05 14:32:05 +010094
95 ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__,
Chris Kay4b7660a2022-09-29 14:36:53 +010096 "cpu_ops not defined for this platform.")
97
98 __RW_START__ = .;
Soby Mathewec8ac1c2016-05-05 14:32:05 +010099
Masahiro Yamadac5864d82020-04-22 10:50:12 +0900100 DATA_SECTION >RAM
Yann Gautier514e59c2020-10-05 11:02:54 +0200101 RELA_SECTION >RAM
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100102
Soby Mathewbf169232017-11-14 14:10:10 +0000103#ifdef BL32_PROGBITS_LIMIT
104 ASSERT(. <= BL32_PROGBITS_LIMIT, "BL32 progbits has exceeded its limit.")
Chris Kay4b7660a2022-09-29 14:36:53 +0100105#endif /* BL32_PROGBITS_LIMIT */
Soby Mathewbf169232017-11-14 14:10:10 +0000106
Masahiro Yamada403990e2020-04-07 13:04:24 +0900107 STACK_SECTION >RAM
Masahiro Yamadadd053b62020-03-26 13:16:33 +0900108 BSS_SECTION >RAM
Masahiro Yamada0b67e562020-03-09 17:39:48 +0900109 XLAT_TABLE_SECTION >RAM
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100110
Chris Kay4b7660a2022-09-29 14:36:53 +0100111 __BSS_SIZE__ = SIZEOF(.bss);
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100112
113#if USE_COHERENT_MEM
114 /*
Chris Kay4b7660a2022-09-29 14:36:53 +0100115 * The base address of the coherent memory section must be page-aligned to
116 * guarantee that the coherent data are stored on their own pages and are
117 * not mixed with normal data. This is required to set up the correct
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100118 * memory attributes for the coherent data page tables.
119 */
Chris Kay33bfc5e2023-02-14 11:30:04 +0000120 .coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100121 __COHERENT_RAM_START__ = .;
Chris Kay4b7660a2022-09-29 14:36:53 +0100122
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100123 /*
Chris Kay4b7660a2022-09-29 14:36:53 +0100124 * Bakery locks are stored in coherent memory. Each lock's data is
125 * contiguous and fully allocated by the compiler.
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100126 */
Chris Kay33bfc5e2023-02-14 11:30:04 +0000127 *(.bakery_lock)
128 *(.tzfw_coherent_mem)
Chris Kay4b7660a2022-09-29 14:36:53 +0100129
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100130 __COHERENT_RAM_END_UNALIGNED__ = .;
Chris Kay4b7660a2022-09-29 14:36:53 +0100131
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100132 /*
Chris Kay4b7660a2022-09-29 14:36:53 +0100133 * Memory page(s) mapped to this section will be marked as device
134 * memory. No other unexpected data must creep in. Ensure that the rest
135 * of the current memory page is unused.
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100136 */
Roberto Vargasd93fde32018-04-11 11:53:31 +0100137 . = ALIGN(PAGE_SIZE);
Chris Kay4b7660a2022-09-29 14:36:53 +0100138
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100139 __COHERENT_RAM_END__ = .;
140 } >RAM
141
142 __COHERENT_RAM_UNALIGNED_SIZE__ =
143 __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__;
Chris Kay4b7660a2022-09-29 14:36:53 +0100144#endif /* USE_COHERENT_MEM */
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100145
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100146 __RW_END__ = .;
Yann Gautier876be652020-10-05 09:54:09 +0200147 __BL32_END__ = .;
Yann Gautier1b4d6ae2020-10-05 11:39:19 +0200148
Yann Gautier514e59c2020-10-05 11:02:54 +0200149 /DISCARD/ : {
150 *(.dynsym .dynstr .hash .gnu.hash)
151 }
152
Yann Gautier1b4d6ae2020-10-05 11:39:19 +0200153 ASSERT(. <= BL32_LIMIT, "BL32 image has exceeded its limit.")
Harrison Mutaic9f96d12023-04-19 09:30:15 +0100154 RAM_REGION_END = .;
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100155}