blob: 4559b039dfd25f965cdf1f512199ec1b6333859b [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__ = .;
68 . = __REALM_POOL_START__ + NS_REALM_SHARED_MEM_SIZE + PAGE_POOL_MAX_SIZE;
69 __REALM_POOL_END__ = .;
70 } >RAM
71
72 stacks (NOLOAD) : ALIGN(16) {
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020073 __STACKS_START__ = .;
74 *(tftf_normal_stacks)
75 __STACKS_END__ = .;
76 } >RAM
77
78 /*
79 * The .bss section gets initialised to 0 at runtime.
Soby Mathew6e5c9962023-10-06 16:38:13 +010080 * Its base address is always PAGE_SIZE aligned.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020081 */
Soby Mathew6e5c9962023-10-06 16:38:13 +010082 .bss : {
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020083 __BSS_START__ = .;
84 *(SORT_BY_ALIGNMENT(.bss*))
85 *(COMMON)
86 __BSS_END__ = .;
87 } >RAM
88
89 /*
90 * The xlat_table section is for full, aligned page tables (4K).
Soby Mathew6e5c9962023-10-06 16:38:13 +010091 * Removing them from .bss eliminates the unecessary zero init
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020092 */
Soby Mathew6e5c9962023-10-06 16:38:13 +010093 xlat_table (NOLOAD) : ALIGN(PAGE_SIZE) {
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020094 *(xlat_table)
95 } >RAM
96
97 /*
Mark Dykese7810b52020-06-03 15:46:55 -050098 * The SMC fuzzing module requires alignment due to malloc
99 * constraints. Also size must be at least around 64K
100 */
101 smcfuzz (NOLOAD) : {
102 *(smcfuzz)
103 } >RAM
104
105 /*
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200106 * The base address of the coherent memory section must be page-aligned (4K)
107 * to guarantee that the coherent data are stored on their own pages and
108 * are not mixed with normal data. This is required to set up the correct
109 * memory attributes for the coherent data page tables.
110 */
111 coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
112 __COHERENT_RAM_START__ = .;
113 *(tftf_coherent_stacks)
114 *(tftf_coherent_mem)
115 __COHERENT_RAM_END_UNALIGNED__ = .;
116 /*
117 * Memory page(s) mapped to this section will be marked
118 * as device memory. No other unexpected data must creep in.
119 * Ensure the rest of the current memory page is unused.
120 */
121 . = NEXT(PAGE_SIZE);
122 __COHERENT_RAM_END__ = .;
123 } >RAM
124
125 __COHERENT_RAM_UNALIGNED_SIZE__ =
126 __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__;
127
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200128 __TFTF_END__ = .;
129
130 __BSS_SIZE__ = SIZEOF(.bss);
131
132}