1/* 2 * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7#include <common/bl_common.ld.h> 8#include <lib/xlat_tables/xlat_tables_defs.h> 9 10OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) 11OUTPUT_ARCH(PLATFORM_LINKER_ARCH) 12ENTRY(tsp_entrypoint) 13 14 15MEMORY { 16 RAM (rwx): ORIGIN = TSP_SEC_MEM_BASE, LENGTH = TSP_SEC_MEM_SIZE 17} 18 19 20SECTIONS 21{ 22 . = BL32_BASE; 23 ASSERT(. == ALIGN(PAGE_SIZE), 24 "BL32_BASE address is not aligned on a page boundary.") 25 26#if SEPARATE_CODE_AND_RODATA 27 .text . : { 28 __TEXT_START__ = .; 29 *tsp_entrypoint.o(.text*) 30 *(.text*) 31 *(.vectors) 32 . = ALIGN(PAGE_SIZE); 33 __TEXT_END__ = .; 34 } >RAM 35 36 .rodata . : { 37 __RODATA_START__ = .; 38 *(.rodata*) 39 40 RODATA_COMMON 41 42 . = ALIGN(PAGE_SIZE); 43 __RODATA_END__ = .; 44 } >RAM 45#else 46 ro . : { 47 __RO_START__ = .; 48 *tsp_entrypoint.o(.text*) 49 *(.text*) 50 *(.rodata*) 51 52 RODATA_COMMON 53 54 *(.vectors) 55 56 __RO_END_UNALIGNED__ = .; 57 /* 58 * Memory page(s) mapped to this section will be marked as 59 * read-only, executable. No RW data from the next section must 60 * creep in. Ensure the rest of the current memory page is unused. 61 */ 62 . = ALIGN(PAGE_SIZE); 63 __RO_END__ = .; 64 } >RAM 65#endif 66 67 /* 68 * Define a linker symbol to mark start of the RW memory area for this 69 * image. 70 */ 71 __RW_START__ = . ; 72 73 .data . : { 74 __DATA_START__ = .; 75 *(.data*) 76 __DATA_END__ = .; 77 } >RAM 78 79 /* 80 * .rela.dyn needs to come after .data for the read-elf utility to parse 81 * this section correctly. Ensure 8-byte alignment so that the fields of 82 * RELA data structure are aligned. 83 */ 84 . = ALIGN(8); 85 __RELA_START__ = .; 86 .rela.dyn . : { 87 } >RAM 88 __RELA_END__ = .; 89 90#ifdef TSP_PROGBITS_LIMIT 91 ASSERT(. <= TSP_PROGBITS_LIMIT, "TSP progbits has exceeded its limit.") 92#endif 93 94 STACK_SECTION >RAM 95 BSS_SECTION >RAM 96 XLAT_TABLE_SECTION >RAM 97 98#if USE_COHERENT_MEM 99 /* 100 * The base address of the coherent memory section must be page-aligned (4K) 101 * to guarantee that the coherent data are stored on their own pages and 102 * are not mixed with normal data. This is required to set up the correct 103 * memory attributes for the coherent data page tables. 104 */ 105 coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) { 106 __COHERENT_RAM_START__ = .; 107 *(tzfw_coherent_mem) 108 __COHERENT_RAM_END_UNALIGNED__ = .; 109 /* 110 * Memory page(s) mapped to this section will be marked 111 * as device memory. No other unexpected data must creep in. 112 * Ensure the rest of the current memory page is unused. 113 */ 114 . = ALIGN(PAGE_SIZE); 115 __COHERENT_RAM_END__ = .; 116 } >RAM 117#endif 118 119 /* 120 * Define a linker symbol to mark the end of the RW memory area for this 121 * image. 122 */ 123 __RW_END__ = .; 124 __BL32_END__ = .; 125 126 /DISCARD/ : { 127 *(.dynsym .dynstr .hash .gnu.hash) 128 } 129 130 __BSS_SIZE__ = SIZEOF(.bss); 131#if USE_COHERENT_MEM 132 __COHERENT_RAM_UNALIGNED_SIZE__ = 133 __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__; 134#endif 135 136 ASSERT(. <= BL32_LIMIT, "BL32 image has exceeded its limit.") 137} 138