blob: e403af09989a9cfa77bfb5fa28eff391e56f0893 [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>
9
10OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
11OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
12ENTRY(tftf_entrypoint)
13
nabkah01002e5692022-10-10 12:36:46 +010014#ifndef TFTF_MAX_IMAGE_SIZE
15#define TFTF_MAX_IMAGE_SIZE DRAM_SIZE
16#endif
17
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020018MEMORY {
nabkah01002e5692022-10-10 12:36:46 +010019 RAM (rwx): ORIGIN = TFTF_BASE, LENGTH = TFTF_MAX_IMAGE_SIZE
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020020}
21
22
23SECTIONS
24{
25 . = TFTF_BASE;
26 __TFTF_BASE__ = .;
27
Ambroise Vincentee3e7cd2019-07-03 16:44:49 +010028 .text . : {
29 __TEXT_START__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020030 *entrypoint.o(.text*)
31 *(.text*)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020032 *(.vectors)
Ambroise Vincentee3e7cd2019-07-03 16:44:49 +010033 . = NEXT(PAGE_SIZE);
34 __TEXT_END__ = .;
35 } >RAM
36
37 .rodata . : {
38 __RODATA_START__ = .;
39 *(.rodata*)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020040 /*
41 * Memory page(s) mapped to this section will be marked as
42 * read-only, executable. No RW data from the next section must
43 * creep in. Ensure the rest of the current memory page is unused.
44 */
45 . = NEXT(PAGE_SIZE);
Ambroise Vincentee3e7cd2019-07-03 16:44:49 +010046 __RODATA_END__ = .;
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020047 } >RAM
48
49 .data : {
50 __DATA_START__ = .;
51 *(.data*)
52 __DATA_END__ = .;
53 } >RAM
54
55 stacks (NOLOAD) : {
56 __STACKS_START__ = .;
57 *(tftf_normal_stacks)
58 __STACKS_END__ = .;
59 } >RAM
60
61 /*
62 * The .bss section gets initialised to 0 at runtime.
63 * Its base address must be 16-byte aligned.
64 */
65 .bss : ALIGN(16) {
66 __BSS_START__ = .;
67 *(SORT_BY_ALIGNMENT(.bss*))
68 *(COMMON)
69 __BSS_END__ = .;
70 } >RAM
71
72 /*
73 * The xlat_table section is for full, aligned page tables (4K).
74 * Removing them from .bss avoids forcing 4K alignment on
75 * the .bss section and eliminates the unecessary zero init
76 */
77 xlat_table (NOLOAD) : {
78 *(xlat_table)
79 } >RAM
80
81 /*
Mark Dykese7810b52020-06-03 15:46:55 -050082 * The SMC fuzzing module requires alignment due to malloc
83 * constraints. Also size must be at least around 64K
84 */
85 smcfuzz (NOLOAD) : {
86 *(smcfuzz)
87 } >RAM
88
89 /*
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020090 * The base address of the coherent memory section must be page-aligned (4K)
91 * to guarantee that the coherent data are stored on their own pages and
92 * are not mixed with normal data. This is required to set up the correct
93 * memory attributes for the coherent data page tables.
94 */
95 coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
96 __COHERENT_RAM_START__ = .;
97 *(tftf_coherent_stacks)
98 *(tftf_coherent_mem)
99 __COHERENT_RAM_END_UNALIGNED__ = .;
100 /*
101 * Memory page(s) mapped to this section will be marked
102 * as device memory. No other unexpected data must creep in.
103 * Ensure the rest of the current memory page is unused.
104 */
105 . = NEXT(PAGE_SIZE);
106 __COHERENT_RAM_END__ = .;
107 } >RAM
108
109 __COHERENT_RAM_UNALIGNED_SIZE__ =
110 __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__;
111
112
113 __TFTF_END__ = .;
114
115 __BSS_SIZE__ = SIZEOF(.bss);
116
117}