1c11ba852SSoby Mathew/* 2665e71b8SMasahiro Yamada * Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved. 3c11ba852SSoby Mathew * 482cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 5c11ba852SSoby Mathew */ 6c11ba852SSoby Mathew 7665e71b8SMasahiro Yamada#include <common/bl_common.ld.h> 809d40e0eSAntonio Nino Diaz#include <lib/xlat_tables/xlat_tables_defs.h> 9c11ba852SSoby Mathew 10c11ba852SSoby MathewOUTPUT_FORMAT(elf32-littlearm) 11c11ba852SSoby MathewOUTPUT_ARCH(arm) 12c11ba852SSoby MathewENTRY(sp_min_vector_table) 13c11ba852SSoby Mathew 14c11ba852SSoby MathewMEMORY { 15c11ba852SSoby Mathew RAM (rwx): ORIGIN = BL32_BASE, LENGTH = BL32_LIMIT - BL32_BASE 16c11ba852SSoby Mathew} 17c11ba852SSoby Mathew 1814e09cc4SHeiko Stuebner#ifdef PLAT_SP_MIN_EXTRA_LD_SCRIPT 1914e09cc4SHeiko Stuebner#include <plat_sp_min.ld.S> 2014e09cc4SHeiko Stuebner#endif 21c11ba852SSoby Mathew 22c11ba852SSoby MathewSECTIONS 23c11ba852SSoby Mathew{ 24c11ba852SSoby Mathew . = BL32_BASE; 25a2aedac2SAntonio Nino Diaz ASSERT(. == ALIGN(PAGE_SIZE), 26c11ba852SSoby Mathew "BL32_BASE address is not aligned on a page boundary.") 27c11ba852SSoby Mathew 28c11ba852SSoby Mathew#if SEPARATE_CODE_AND_RODATA 29c11ba852SSoby Mathew .text . : { 30c11ba852SSoby Mathew __TEXT_START__ = .; 31c11ba852SSoby Mathew *entrypoint.o(.text*) 32c11ba852SSoby Mathew *(.text*) 333bdf0e5dSYatharth Kochar *(.vectors) 345629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 35c11ba852SSoby Mathew __TEXT_END__ = .; 36c11ba852SSoby Mathew } >RAM 37c11ba852SSoby Mathew 38ad925094SRoberto Vargas /* .ARM.extab and .ARM.exidx are only added because Clang need them */ 39ad925094SRoberto Vargas .ARM.extab . : { 40ad925094SRoberto Vargas *(.ARM.extab* .gnu.linkonce.armextab.*) 41ad925094SRoberto Vargas } >RAM 42ad925094SRoberto Vargas 43ad925094SRoberto Vargas .ARM.exidx . : { 44ad925094SRoberto Vargas *(.ARM.exidx* .gnu.linkonce.armexidx.*) 45ad925094SRoberto Vargas } >RAM 46ad925094SRoberto Vargas 47c11ba852SSoby Mathew .rodata . : { 48c11ba852SSoby Mathew __RODATA_START__ = .; 49c11ba852SSoby Mathew *(.rodata*) 50c11ba852SSoby Mathew 510a0a7a9aSMasahiro Yamada RODATA_COMMON 52c11ba852SSoby Mathew 538e743bcdSJeenu Viswambharan /* Place pubsub sections for events */ 548e743bcdSJeenu Viswambharan . = ALIGN(8); 5509d40e0eSAntonio Nino Diaz#include <lib/el3_runtime/pubsub_events.h> 568e743bcdSJeenu Viswambharan 575629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 58c11ba852SSoby Mathew __RODATA_END__ = .; 59c11ba852SSoby Mathew } >RAM 60c11ba852SSoby Mathew#else 61c11ba852SSoby Mathew ro . : { 62c11ba852SSoby Mathew __RO_START__ = .; 63c11ba852SSoby Mathew *entrypoint.o(.text*) 64c11ba852SSoby Mathew *(.text*) 65c11ba852SSoby Mathew *(.rodata*) 66c11ba852SSoby Mathew 670a0a7a9aSMasahiro Yamada RODATA_COMMON 68c11ba852SSoby Mathew 698e743bcdSJeenu Viswambharan /* Place pubsub sections for events */ 708e743bcdSJeenu Viswambharan . = ALIGN(8); 7109d40e0eSAntonio Nino Diaz#include <lib/el3_runtime/pubsub_events.h> 728e743bcdSJeenu Viswambharan 733bdf0e5dSYatharth Kochar *(.vectors) 74c11ba852SSoby Mathew __RO_END_UNALIGNED__ = .; 75c11ba852SSoby Mathew 76c11ba852SSoby Mathew /* 77c11ba852SSoby Mathew * Memory page(s) mapped to this section will be marked as 78c11ba852SSoby Mathew * read-only, executable. No RW data from the next section must 79c11ba852SSoby Mathew * creep in. Ensure the rest of the current memory block is unused. 80c11ba852SSoby Mathew */ 815629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 82c11ba852SSoby Mathew __RO_END__ = .; 83c11ba852SSoby Mathew } >RAM 84c11ba852SSoby Mathew#endif 85c11ba852SSoby Mathew 86c11ba852SSoby Mathew ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__, 87c11ba852SSoby Mathew "cpu_ops not defined for this platform.") 88c11ba852SSoby Mathew /* 89c11ba852SSoby Mathew * Define a linker symbol to mark start of the RW memory area for this 90c11ba852SSoby Mathew * image. 91c11ba852SSoby Mathew */ 92c11ba852SSoby Mathew __RW_START__ = . ; 93c11ba852SSoby Mathew 94c11ba852SSoby Mathew .data . : { 95c11ba852SSoby Mathew __DATA_START__ = .; 96c11ba852SSoby Mathew *(.data*) 97c11ba852SSoby Mathew __DATA_END__ = .; 98c11ba852SSoby Mathew } >RAM 99c11ba852SSoby Mathew 1005744e874SSoby Mathew#ifdef BL32_PROGBITS_LIMIT 1015744e874SSoby Mathew ASSERT(. <= BL32_PROGBITS_LIMIT, "BL32 progbits has exceeded its limit.") 1025744e874SSoby Mathew#endif 1035744e874SSoby Mathew 104*a926a9f6SMasahiro Yamada STACK_SECTION >RAM 105a7739bc7SMasahiro Yamada BSS_SECTION >RAM 106665e71b8SMasahiro Yamada XLAT_TABLE_SECTION >RAM 107c11ba852SSoby Mathew 108c11ba852SSoby Mathew __BSS_SIZE__ = SIZEOF(.bss); 109c11ba852SSoby Mathew 110c11ba852SSoby Mathew#if USE_COHERENT_MEM 111c11ba852SSoby Mathew /* 112c11ba852SSoby Mathew * The base address of the coherent memory section must be page-aligned (4K) 113c11ba852SSoby Mathew * to guarantee that the coherent data are stored on their own pages and 114c11ba852SSoby Mathew * are not mixed with normal data. This is required to set up the correct 115c11ba852SSoby Mathew * memory attributes for the coherent data page tables. 116c11ba852SSoby Mathew */ 117a2aedac2SAntonio Nino Diaz coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) { 118c11ba852SSoby Mathew __COHERENT_RAM_START__ = .; 119c11ba852SSoby Mathew /* 120c11ba852SSoby Mathew * Bakery locks are stored in coherent memory 121c11ba852SSoby Mathew * 122c11ba852SSoby Mathew * Each lock's data is contiguous and fully allocated by the compiler 123c11ba852SSoby Mathew */ 124c11ba852SSoby Mathew *(bakery_lock) 125c11ba852SSoby Mathew *(tzfw_coherent_mem) 126c11ba852SSoby Mathew __COHERENT_RAM_END_UNALIGNED__ = .; 127c11ba852SSoby Mathew /* 128c11ba852SSoby Mathew * Memory page(s) mapped to this section will be marked 129c11ba852SSoby Mathew * as device memory. No other unexpected data must creep in. 130c11ba852SSoby Mathew * Ensure the rest of the current memory page is unused. 131c11ba852SSoby Mathew */ 1325629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 133c11ba852SSoby Mathew __COHERENT_RAM_END__ = .; 134c11ba852SSoby Mathew } >RAM 135c11ba852SSoby Mathew 136c11ba852SSoby Mathew __COHERENT_RAM_UNALIGNED_SIZE__ = 137c11ba852SSoby Mathew __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__; 138c11ba852SSoby Mathew#endif 139c11ba852SSoby Mathew 140c11ba852SSoby Mathew /* 141c11ba852SSoby Mathew * Define a linker symbol to mark end of the RW memory area for this 142c11ba852SSoby Mathew * image. 143c11ba852SSoby Mathew */ 144c11ba852SSoby Mathew __RW_END__ = .; 145c11ba852SSoby Mathew 146c11ba852SSoby Mathew __BL32_END__ = .; 147c11ba852SSoby Mathew} 148