blob: 2b672efee087511acc61c0c3dbcd3f6055382423 [file] [log] [blame]
Achin Gupta7c88f3f2014-02-18 18:09:12 +00001/*
Douglas Raillard21362a92016-12-02 13:51:54 +00002 * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
Achin Gupta7c88f3f2014-02-18 18:09:12 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Achin Gupta7c88f3f2014-02-18 18:09:12 +00005 */
6
Dan Handleyed6ff952014-05-14 17:44:19 +01007#include <platform_def.h>
Achin Gupta7c88f3f2014-02-18 18:09:12 +00008
9OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
10OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
Jeenu Viswambharan2a30a752014-03-11 11:06:45 +000011ENTRY(tsp_entrypoint)
12
Achin Gupta7c88f3f2014-02-18 18:09:12 +000013
14MEMORY {
Sandrine Bailleux5ac3cc92014-05-20 17:22:24 +010015 RAM (rwx): ORIGIN = TSP_SEC_MEM_BASE, LENGTH = TSP_SEC_MEM_SIZE
Achin Gupta7c88f3f2014-02-18 18:09:12 +000016}
17
18
19SECTIONS
20{
21 . = BL32_BASE;
22 ASSERT(. == ALIGN(4096),
23 "BL32_BASE address is not aligned on a page boundary.")
24
Sandrine Bailleuxf91f1442016-07-08 14:37:40 +010025#if SEPARATE_CODE_AND_RODATA
26 .text . : {
27 __TEXT_START__ = .;
28 *tsp_entrypoint.o(.text*)
29 *(.text*)
30 *(.vectors)
31 . = NEXT(4096);
32 __TEXT_END__ = .;
33 } >RAM
34
35 .rodata . : {
36 __RODATA_START__ = .;
37 *(.rodata*)
38 . = NEXT(4096);
39 __RODATA_END__ = .;
40 } >RAM
41#else
Achin Gupta7c88f3f2014-02-18 18:09:12 +000042 ro . : {
43 __RO_START__ = .;
Andrew Thoelkee01ea342014-03-18 07:13:52 +000044 *tsp_entrypoint.o(.text*)
45 *(.text*)
Achin Gupta7c88f3f2014-02-18 18:09:12 +000046 *(.rodata*)
47 *(.vectors)
48 __RO_END_UNALIGNED__ = .;
49 /*
50 * Memory page(s) mapped to this section will be marked as
51 * read-only, executable. No RW data from the next section must
52 * creep in. Ensure the rest of the current memory page is unused.
53 */
54 . = NEXT(4096);
55 __RO_END__ = .;
56 } >RAM
Sandrine Bailleuxf91f1442016-07-08 14:37:40 +010057#endif
Achin Gupta7c88f3f2014-02-18 18:09:12 +000058
Achin Guptae9c4a642015-09-11 16:03:13 +010059 /*
60 * Define a linker symbol to mark start of the RW memory area for this
61 * image.
62 */
63 __RW_START__ = . ;
64
Achin Gupta7c88f3f2014-02-18 18:09:12 +000065 .data . : {
66 __DATA_START__ = .;
Andrew Thoelkee01ea342014-03-18 07:13:52 +000067 *(.data*)
Achin Gupta7c88f3f2014-02-18 18:09:12 +000068 __DATA_END__ = .;
69 } >RAM
70
Dan Handley4fd2f5c2014-08-04 11:41:20 +010071#ifdef TSP_PROGBITS_LIMIT
72 ASSERT(. <= TSP_PROGBITS_LIMIT, "TSP progbits has exceeded its limit.")
Sandrine Bailleuxe2e0c652014-06-16 16:12:27 +010073#endif
74
Achin Gupta7c88f3f2014-02-18 18:09:12 +000075 stacks (NOLOAD) : {
76 __STACKS_START__ = .;
77 *(tzfw_normal_stacks)
78 __STACKS_END__ = .;
79 } >RAM
80
81 /*
82 * The .bss section gets initialised to 0 at runtime.
Douglas Raillard21362a92016-12-02 13:51:54 +000083 * Its base address should be 16-byte aligned for better performance of the
84 * zero-initialization code.
Achin Gupta7c88f3f2014-02-18 18:09:12 +000085 */
86 .bss : ALIGN(16) {
87 __BSS_START__ = .;
Andrew Thoelkee01ea342014-03-18 07:13:52 +000088 *(SORT_BY_ALIGNMENT(.bss*))
Achin Gupta7c88f3f2014-02-18 18:09:12 +000089 *(COMMON)
90 __BSS_END__ = .;
91 } >RAM
92
93 /*
94 * The xlat_table section is for full, aligned page tables (4K).
95 * Removing them from .bss avoids forcing 4K alignment on
96 * the .bss section and eliminates the unecessary zero init
97 */
98 xlat_table (NOLOAD) : {
99 *(xlat_table)
100 } >RAM
101
Soby Mathew2ae20432015-01-08 18:02:44 +0000102#if USE_COHERENT_MEM
Achin Gupta7c88f3f2014-02-18 18:09:12 +0000103 /*
104 * The base address of the coherent memory section must be page-aligned (4K)
105 * to guarantee that the coherent data are stored on their own pages and
106 * are not mixed with normal data. This is required to set up the correct
107 * memory attributes for the coherent data page tables.
108 */
109 coherent_ram (NOLOAD) : ALIGN(4096) {
110 __COHERENT_RAM_START__ = .;
111 *(tzfw_coherent_mem)
112 __COHERENT_RAM_END_UNALIGNED__ = .;
113 /*
114 * Memory page(s) mapped to this section will be marked
115 * as device memory. No other unexpected data must creep in.
116 * Ensure the rest of the current memory page is unused.
117 */
118 . = NEXT(4096);
119 __COHERENT_RAM_END__ = .;
120 } >RAM
Soby Mathew2ae20432015-01-08 18:02:44 +0000121#endif
Achin Gupta7c88f3f2014-02-18 18:09:12 +0000122
Achin Guptae9c4a642015-09-11 16:03:13 +0100123 /*
124 * Define a linker symbol to mark the end of the RW memory area for this
125 * image.
126 */
127 __RW_END__ = .;
Sandrine Bailleuxe701e302014-05-20 17:28:25 +0100128 __BL32_END__ = .;
Achin Gupta7c88f3f2014-02-18 18:09:12 +0000129
130 __BSS_SIZE__ = SIZEOF(.bss);
Soby Mathew2ae20432015-01-08 18:02:44 +0000131#if USE_COHERENT_MEM
Achin Gupta7c88f3f2014-02-18 18:09:12 +0000132 __COHERENT_RAM_UNALIGNED_SIZE__ =
133 __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__;
Soby Mathew2ae20432015-01-08 18:02:44 +0000134#endif
Achin Gupta7c88f3f2014-02-18 18:09:12 +0000135
Juan Castillo7d199412015-12-14 09:35:25 +0000136 ASSERT(. <= BL32_LIMIT, "BL32 image has exceeded its limit.")
Achin Gupta7c88f3f2014-02-18 18:09:12 +0000137}