blob: dd8197332c054cfac9a82176f76a0d77f4c23dad [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)
Michal Simek80c530e2023-04-27 14:26:03 +020037 __TEXT_END_UNALIGNED__ = .;
Chris Kay4b7660a2022-09-29 14:36:53 +010038
Roberto Vargasd93fde32018-04-11 11:53:31 +010039 . = ALIGN(PAGE_SIZE);
Chris Kay4b7660a2022-09-29 14:36:53 +010040
Soby Mathewec8ac1c2016-05-05 14:32:05 +010041 __TEXT_END__ = .;
42 } >RAM
43
Chris Kay4b7660a2022-09-29 14:36:53 +010044 /* .ARM.extab and .ARM.exidx are only added because Clang needs them */
45 .ARM.extab . : {
Roberto Vargas1d04c632018-05-10 11:01:16 +010046 *(.ARM.extab* .gnu.linkonce.armextab.*)
Chris Kay4b7660a2022-09-29 14:36:53 +010047 } >RAM
Roberto Vargas1d04c632018-05-10 11:01:16 +010048
Chris Kay4b7660a2022-09-29 14:36:53 +010049 .ARM.exidx . : {
Roberto Vargas1d04c632018-05-10 11:01:16 +010050 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
Chris Kay4b7660a2022-09-29 14:36:53 +010051 } >RAM
Roberto Vargas1d04c632018-05-10 11:01:16 +010052
Soby Mathewec8ac1c2016-05-05 14:32:05 +010053 .rodata . : {
54 __RODATA_START__ = .;
Yann Gautier876be652020-10-05 09:54:09 +020055 *(SORT_BY_ALIGNMENT(.rodata*))
Soby Mathewec8ac1c2016-05-05 14:32:05 +010056
Chris Kay4b7660a2022-09-29 14:36:53 +010057 RODATA_COMMON
Soby Mathewec8ac1c2016-05-05 14:32:05 +010058
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010059 . = ALIGN(8);
Chris Kay4b7660a2022-09-29 14:36:53 +010060
61# include <lib/el3_runtime/pubsub_events.h>
Michal Simek80c530e2023-04-27 14:26:03 +020062 __RODATA_END_UNALIGNED__ = .;
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010063
Roberto Vargasd93fde32018-04-11 11:53:31 +010064 . = ALIGN(PAGE_SIZE);
Chris Kay4b7660a2022-09-29 14:36:53 +010065
Soby Mathewec8ac1c2016-05-05 14:32:05 +010066 __RODATA_END__ = .;
67 } >RAM
Chris Kay4b7660a2022-09-29 14:36:53 +010068#else /* SEPARATE_CODE_AND_RODATA */
Chris Kay33bfc5e2023-02-14 11:30:04 +000069 .ro . : {
Soby Mathewec8ac1c2016-05-05 14:32:05 +010070 __RO_START__ = .;
Chris Kay4b7660a2022-09-29 14:36:53 +010071
Soby Mathewec8ac1c2016-05-05 14:32:05 +010072 *entrypoint.o(.text*)
Yann Gautier876be652020-10-05 09:54:09 +020073 *(SORT_BY_ALIGNMENT(.text*))
74 *(SORT_BY_ALIGNMENT(.rodata*))
Soby Mathewec8ac1c2016-05-05 14:32:05 +010075
Chris Kay4b7660a2022-09-29 14:36:53 +010076 RODATA_COMMON
Soby Mathewec8ac1c2016-05-05 14:32:05 +010077
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010078 . = ALIGN(8);
Chris Kay4b7660a2022-09-29 14:36:53 +010079
80# include <lib/el3_runtime/pubsub_events.h>
Jeenu Viswambharane3f22002017-09-22 08:32:10 +010081
Yatharth Kochar06460cd2016-06-30 15:02:31 +010082 *(.vectors)
Chris Kay4b7660a2022-09-29 14:36:53 +010083
Soby Mathewec8ac1c2016-05-05 14:32:05 +010084 __RO_END_UNALIGNED__ = .;
85
86 /*
Chris Kay4b7660a2022-09-29 14:36:53 +010087 * Memory page(s) mapped to this section will be marked as device
88 * memory. No other unexpected data must creep in. Ensure that the rest
89 * of the current memory page is unused.
Soby Mathewec8ac1c2016-05-05 14:32:05 +010090 */
Roberto Vargasd93fde32018-04-11 11:53:31 +010091 . = ALIGN(PAGE_SIZE);
Chris Kay4b7660a2022-09-29 14:36:53 +010092
Soby Mathewec8ac1c2016-05-05 14:32:05 +010093 __RO_END__ = .;
94 } >RAM
Chris Kay4b7660a2022-09-29 14:36:53 +010095#endif /* SEPARATE_CODE_AND_RODATA */
Soby Mathewec8ac1c2016-05-05 14:32:05 +010096
97 ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__,
Chris Kay4b7660a2022-09-29 14:36:53 +010098 "cpu_ops not defined for this platform.")
99
100 __RW_START__ = .;
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100101
Masahiro Yamadac5864d82020-04-22 10:50:12 +0900102 DATA_SECTION >RAM
Yann Gautier514e59c2020-10-05 11:02:54 +0200103 RELA_SECTION >RAM
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100104
Soby Mathewbf169232017-11-14 14:10:10 +0000105#ifdef BL32_PROGBITS_LIMIT
106 ASSERT(. <= BL32_PROGBITS_LIMIT, "BL32 progbits has exceeded its limit.")
Chris Kay4b7660a2022-09-29 14:36:53 +0100107#endif /* BL32_PROGBITS_LIMIT */
Soby Mathewbf169232017-11-14 14:10:10 +0000108
Masahiro Yamada403990e2020-04-07 13:04:24 +0900109 STACK_SECTION >RAM
Masahiro Yamadadd053b62020-03-26 13:16:33 +0900110 BSS_SECTION >RAM
Masahiro Yamada0b67e562020-03-09 17:39:48 +0900111 XLAT_TABLE_SECTION >RAM
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100112
Chris Kay4b7660a2022-09-29 14:36:53 +0100113 __BSS_SIZE__ = SIZEOF(.bss);
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100114
115#if USE_COHERENT_MEM
116 /*
Chris Kay4b7660a2022-09-29 14:36:53 +0100117 * The base address of the coherent memory section must be page-aligned to
118 * guarantee that the coherent data are stored on their own pages and are
119 * not mixed with normal data. This is required to set up the correct
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100120 * memory attributes for the coherent data page tables.
121 */
Chris Kay33bfc5e2023-02-14 11:30:04 +0000122 .coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100123 __COHERENT_RAM_START__ = .;
Chris Kay4b7660a2022-09-29 14:36:53 +0100124
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100125 /*
Chris Kay4b7660a2022-09-29 14:36:53 +0100126 * Bakery locks are stored in coherent memory. Each lock's data is
127 * contiguous and fully allocated by the compiler.
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100128 */
Chris Kay33bfc5e2023-02-14 11:30:04 +0000129 *(.bakery_lock)
130 *(.tzfw_coherent_mem)
Chris Kay4b7660a2022-09-29 14:36:53 +0100131
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100132 __COHERENT_RAM_END_UNALIGNED__ = .;
Chris Kay4b7660a2022-09-29 14:36:53 +0100133
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100134 /*
Chris Kay4b7660a2022-09-29 14:36:53 +0100135 * Memory page(s) mapped to this section will be marked as device
136 * memory. No other unexpected data must creep in. Ensure that the rest
137 * of the current memory page is unused.
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100138 */
Roberto Vargasd93fde32018-04-11 11:53:31 +0100139 . = ALIGN(PAGE_SIZE);
Chris Kay4b7660a2022-09-29 14:36:53 +0100140
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100141 __COHERENT_RAM_END__ = .;
142 } >RAM
143
144 __COHERENT_RAM_UNALIGNED_SIZE__ =
145 __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__;
Chris Kay4b7660a2022-09-29 14:36:53 +0100146#endif /* USE_COHERENT_MEM */
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100147
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100148 __RW_END__ = .;
Yann Gautier876be652020-10-05 09:54:09 +0200149 __BL32_END__ = .;
Yann Gautier1b4d6ae2020-10-05 11:39:19 +0200150
Yann Gautier514e59c2020-10-05 11:02:54 +0200151 /DISCARD/ : {
152 *(.dynsym .dynstr .hash .gnu.hash)
153 }
154
Yann Gautier1b4d6ae2020-10-05 11:39:19 +0200155 ASSERT(. <= BL32_LIMIT, "BL32 image has exceeded its limit.")
Harrison Mutaic9f96d12023-04-19 09:30:15 +0100156 RAM_REGION_END = .;
Soby Mathewec8ac1c2016-05-05 14:32:05 +0100157}