blob: 3621d97177a4b4c3edf07454c2cba0ad58fe721f [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
nabkah01002e5692022-10-10 12:36:46 +01002 * Copyright (c) 2020-2022, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <platform_def.h>
8#include <xlat_tables_defs.h>
Soby Mathew6e5c9962023-10-06 16:38:13 +01009#include <host_realm_mem_layout.h>
10
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020011
12OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
13OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
14ENTRY(tftf_entrypoint)
15
16MEMORY {
Soby Mathew6e5c9962023-10-06 16:38:13 +010017 RAM (rwx): ORIGIN = TFTF_BASE, LENGTH = DRAM_SIZE
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020018}
19
20
21SECTIONS
22{
23 . = TFTF_BASE;
24 __TFTF_BASE__ = .;
25
Ambroise Vincentee3e7cd2019-07-03 16:44:49 +010026 .text . : {
27 __TEXT_START__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020028 *entrypoint.o(.text*)
29 *(.text*)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020030 *(.vectors)
Ambroise Vincentee3e7cd2019-07-03 16:44:49 +010031 . = NEXT(PAGE_SIZE);
32 __TEXT_END__ = .;
33 } >RAM
34
35 .rodata . : {
36 __RODATA_START__ = .;
37 *(.rodata*)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020038 /*
39 * Memory page(s) mapped to this section will be marked as
40 * read-only, executable. No RW data from the next section must
41 * creep in. Ensure the rest of the current memory page is unused.
42 */
43 . = NEXT(PAGE_SIZE);
Ambroise Vincentee3e7cd2019-07-03 16:44:49 +010044 __RODATA_END__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020045 } >RAM
46
47 .data : {
48 __DATA_START__ = .;
49 *(.data*)
Soby Mathew6e5c9962023-10-06 16:38:13 +010050 . = NEXT(PAGE_SIZE); /* This ensures tftf.bin is aligned to page size. */
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020051 __DATA_END__ = .;
52 } >RAM
53
Soby Mathew6e5c9962023-10-06 16:38:13 +010054 /* End of LOAD Sections. NOLOAD sections begin here. */
55 /*
56 * Memory for Realm Image has to follow next as it will appended to end
57 * of tftf.bin.
58 */
59 realm_payload (NOLOAD) : {
60 __REALM_PAYLOAD_START__ = .;
61 . = __REALM_PAYLOAD_START__ + REALM_MAX_LOAD_IMG_SIZE;
62 __REALM_PAYLOAD_END__ = .;
63 } >RAM
64
65 /* Memory pool for Realm payload tests. */
66 realm_pool (NOLOAD) : ALIGN(PAGE_SIZE) {
67 __REALM_POOL_START__ = .;
Shruti Guptae5929622023-11-21 10:50:22 +000068 . = __REALM_POOL_START__ + (NS_REALM_SHARED_MEM_SIZE * MAX_REALM_COUNT) +
69 (PAGE_POOL_MAX_SIZE * MAX_REALM_COUNT);
Soby Mathew6e5c9962023-10-06 16:38:13 +010070 __REALM_POOL_END__ = .;
71 } >RAM
72
73 stacks (NOLOAD) : ALIGN(16) {
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020074 __STACKS_START__ = .;
75 *(tftf_normal_stacks)
76 __STACKS_END__ = .;
77 } >RAM
78
79 /*
80 * The .bss section gets initialised to 0 at runtime.
Soby Mathew6e5c9962023-10-06 16:38:13 +010081 * Its base address is always PAGE_SIZE aligned.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020082 */
Soby Mathew6e5c9962023-10-06 16:38:13 +010083 .bss : {
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020084 __BSS_START__ = .;
85 *(SORT_BY_ALIGNMENT(.bss*))
86 *(COMMON)
87 __BSS_END__ = .;
88 } >RAM
89
90 /*
91 * The xlat_table section is for full, aligned page tables (4K).
Soby Mathew6e5c9962023-10-06 16:38:13 +010092 * Removing them from .bss eliminates the unecessary zero init
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020093 */
Soby Mathew6e5c9962023-10-06 16:38:13 +010094 xlat_table (NOLOAD) : ALIGN(PAGE_SIZE) {
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020095 *(xlat_table)
96 } >RAM
97
98 /*
Mark Dykese7810b52020-06-03 15:46:55 -050099 * The SMC fuzzing module requires alignment due to malloc
100 * constraints. Also size must be at least around 64K
101 */
102 smcfuzz (NOLOAD) : {
103 *(smcfuzz)
104 } >RAM
105
106 /*
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200107 * The base address of the coherent memory section must be page-aligned (4K)
108 * to guarantee that the coherent data are stored on their own pages and
109 * are not mixed with normal data. This is required to set up the correct
110 * memory attributes for the coherent data page tables.
111 */
112 coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
113 __COHERENT_RAM_START__ = .;
114 *(tftf_coherent_stacks)
115 *(tftf_coherent_mem)
116 __COHERENT_RAM_END_UNALIGNED__ = .;
117 /*
118 * Memory page(s) mapped to this section will be marked
119 * as device memory. No other unexpected data must creep in.
120 * Ensure the rest of the current memory page is unused.
121 */
122 . = NEXT(PAGE_SIZE);
123 __COHERENT_RAM_END__ = .;
124 } >RAM
125
126 __COHERENT_RAM_UNALIGNED_SIZE__ =
127 __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__;
128
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200129 __TFTF_END__ = .;
130
131 __BSS_SIZE__ = SIZEOF(.bss);
132
133}