17c88f3f6SAchin Gupta/* 2*da04341eSChris Kay * Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved. 37c88f3f6SAchin Gupta * 482cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 57c88f3f6SAchin Gupta */ 67c88f3f6SAchin Gupta 7665e71b8SMasahiro Yamada#include <common/bl_common.ld.h> 809d40e0eSAntonio Nino Diaz#include <lib/xlat_tables/xlat_tables_defs.h> 97c88f3f6SAchin Gupta 107c88f3f6SAchin GuptaOUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) 117c88f3f6SAchin GuptaOUTPUT_ARCH(PLATFORM_LINKER_ARCH) 129f98aa1aSJeenu ViswambharanENTRY(tsp_entrypoint) 139f98aa1aSJeenu Viswambharan 147c88f3f6SAchin GuptaMEMORY { 152467f70fSSandrine Bailleux RAM (rwx): ORIGIN = TSP_SEC_MEM_BASE, LENGTH = TSP_SEC_MEM_SIZE 167c88f3f6SAchin Gupta} 177c88f3f6SAchin Gupta 18f90fe02fSChris KaySECTIONS { 197c88f3f6SAchin Gupta . = BL32_BASE; 20f90fe02fSChris Kay 21a2aedac2SAntonio Nino Diaz ASSERT(. == ALIGN(PAGE_SIZE), 227c88f3f6SAchin Gupta "BL32_BASE address is not aligned on a page boundary.") 237c88f3f6SAchin Gupta 245d1c104fSSandrine Bailleux#if SEPARATE_CODE_AND_RODATA 255d1c104fSSandrine Bailleux .text . : { 265d1c104fSSandrine Bailleux __TEXT_START__ = .; 27f90fe02fSChris Kay 285d1c104fSSandrine Bailleux *tsp_entrypoint.o(.text*) 295d1c104fSSandrine Bailleux *(.text*) 305d1c104fSSandrine Bailleux *(.vectors) 31f90fe02fSChris Kay 325629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 33f90fe02fSChris Kay 345d1c104fSSandrine Bailleux __TEXT_END__ = .; 355d1c104fSSandrine Bailleux } >RAM 365d1c104fSSandrine Bailleux 375d1c104fSSandrine Bailleux .rodata . : { 385d1c104fSSandrine Bailleux __RODATA_START__ = .; 39f90fe02fSChris Kay 405d1c104fSSandrine Bailleux *(.rodata*) 41d974301dSMasahiro Yamada 420a0a7a9aSMasahiro Yamada RODATA_COMMON 43d974301dSMasahiro Yamada 445629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 45f90fe02fSChris Kay 465d1c104fSSandrine Bailleux __RODATA_END__ = .; 475d1c104fSSandrine Bailleux } >RAM 48f90fe02fSChris Kay#else /* SEPARATE_CODE_AND_RODATA */ 49*da04341eSChris Kay .ro . : { 507c88f3f6SAchin Gupta __RO_START__ = .; 51f90fe02fSChris Kay 52dccc537aSAndrew Thoelke *tsp_entrypoint.o(.text*) 53dccc537aSAndrew Thoelke *(.text*) 547c88f3f6SAchin Gupta *(.rodata*) 55d974301dSMasahiro Yamada 560a0a7a9aSMasahiro Yamada RODATA_COMMON 57d974301dSMasahiro Yamada 587c88f3f6SAchin Gupta *(.vectors) 59d974301dSMasahiro Yamada 607c88f3f6SAchin Gupta __RO_END_UNALIGNED__ = .; 617c88f3f6SAchin Gupta 6254dc71e7SAchin Gupta /* 63f90fe02fSChris Kay * Memory page(s) mapped to this section will be marked as read-only, 64f90fe02fSChris Kay * executable. No RW data from the next section must creep in. Ensure 65f90fe02fSChris Kay * that the rest of the current memory page is unused. 6654dc71e7SAchin Gupta */ 67f90fe02fSChris Kay . = ALIGN(PAGE_SIZE); 68f90fe02fSChris Kay 69f90fe02fSChris Kay __RO_END__ = .; 70f90fe02fSChris Kay } >RAM 71f90fe02fSChris Kay#endif /* SEPARATE_CODE_AND_RODATA */ 72f90fe02fSChris Kay 7354dc71e7SAchin Gupta __RW_START__ = .; 7454dc71e7SAchin Gupta 75caa3e7e0SMasahiro Yamada DATA_SECTION >RAM 76e8ad6168SMasahiro Yamada RELA_SECTION >RAM 77d974301dSMasahiro Yamada 785a06bb7eSDan Handley#ifdef TSP_PROGBITS_LIMIT 795a06bb7eSDan Handley ASSERT(. <= TSP_PROGBITS_LIMIT, "TSP progbits has exceeded its limit.") 80f90fe02fSChris Kay#endif /* TSP_PROGBITS_LIMIT */ 81a1b6db6cSSandrine Bailleux 82a926a9f6SMasahiro Yamada STACK_SECTION >RAM 83a7739bc7SMasahiro Yamada BSS_SECTION >RAM 84665e71b8SMasahiro Yamada XLAT_TABLE_SECTION >RAM 857c88f3f6SAchin Gupta 86ab8707e6SSoby Mathew#if USE_COHERENT_MEM 877c88f3f6SAchin Gupta /* 88f90fe02fSChris Kay * The base address of the coherent memory section must be page-aligned to 89f90fe02fSChris Kay * guarantee that the coherent data are stored on their own pages and are 90f90fe02fSChris Kay * not mixed with normal data. This is required to set up the correct memory 91f90fe02fSChris Kay * attributes for the coherent data page tables. 927c88f3f6SAchin Gupta */ 93*da04341eSChris Kay .coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) { 947c88f3f6SAchin Gupta __COHERENT_RAM_START__ = .; 95*da04341eSChris Kay *(.tzfw_coherent_mem) 967c88f3f6SAchin Gupta __COHERENT_RAM_END_UNALIGNED__ = .; 977c88f3f6SAchin Gupta 9854dc71e7SAchin Gupta /* 99f90fe02fSChris Kay * Memory page(s) mapped to this section will be marked as device 100f90fe02fSChris Kay * memory. No other unexpected data must creep in. Ensure that the rest 101f90fe02fSChris Kay * of the current memory page is unused. 10254dc71e7SAchin Gupta */ 103f90fe02fSChris Kay . = ALIGN(PAGE_SIZE); 104f90fe02fSChris Kay 105f90fe02fSChris Kay __COHERENT_RAM_END__ = .; 106f90fe02fSChris Kay } >RAM 107f90fe02fSChris Kay#endif /* USE_COHERENT_MEM */ 108f90fe02fSChris Kay 10954dc71e7SAchin Gupta __RW_END__ = .; 11053514b29SSandrine Bailleux __BL32_END__ = .; 1117c88f3f6SAchin Gupta 112d974301dSMasahiro Yamada /DISCARD/ : { 113d974301dSMasahiro Yamada *(.dynsym .dynstr .hash .gnu.hash) 114d974301dSMasahiro Yamada } 115d974301dSMasahiro Yamada 1167c88f3f6SAchin Gupta __BSS_SIZE__ = SIZEOF(.bss); 117f90fe02fSChris Kay 118ab8707e6SSoby Mathew#if USE_COHERENT_MEM 1197c88f3f6SAchin Gupta __COHERENT_RAM_UNALIGNED_SIZE__ = 1207c88f3f6SAchin Gupta __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__; 121f90fe02fSChris Kay#endif /* USE_COHERENT_MEM */ 1227c88f3f6SAchin Gupta 123d178637dSJuan Castillo ASSERT(. <= BL32_LIMIT, "BL32 image has exceeded its limit.") 1247c88f3f6SAchin Gupta} 125