17c88f3f6SAchin Gupta/* 27c88f3f6SAchin Gupta * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. 37c88f3f6SAchin Gupta * 47c88f3f6SAchin Gupta * Redistribution and use in source and binary forms, with or without 57c88f3f6SAchin Gupta * modification, are permitted provided that the following conditions are met: 67c88f3f6SAchin Gupta * 77c88f3f6SAchin Gupta * Redistributions of source code must retain the above copyright notice, this 87c88f3f6SAchin Gupta * list of conditions and the following disclaimer. 97c88f3f6SAchin Gupta * 107c88f3f6SAchin Gupta * Redistributions in binary form must reproduce the above copyright notice, 117c88f3f6SAchin Gupta * this list of conditions and the following disclaimer in the documentation 127c88f3f6SAchin Gupta * and/or other materials provided with the distribution. 137c88f3f6SAchin Gupta * 147c88f3f6SAchin Gupta * Neither the name of ARM nor the names of its contributors may be used 157c88f3f6SAchin Gupta * to endorse or promote products derived from this software without specific 167c88f3f6SAchin Gupta * prior written permission. 177c88f3f6SAchin Gupta * 187c88f3f6SAchin Gupta * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 197c88f3f6SAchin Gupta * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 207c88f3f6SAchin Gupta * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 217c88f3f6SAchin Gupta * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 227c88f3f6SAchin Gupta * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 237c88f3f6SAchin Gupta * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 247c88f3f6SAchin Gupta * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 257c88f3f6SAchin Gupta * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 267c88f3f6SAchin Gupta * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 277c88f3f6SAchin Gupta * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 287c88f3f6SAchin Gupta * POSSIBILITY OF SUCH DAMAGE. 297c88f3f6SAchin Gupta */ 307c88f3f6SAchin Gupta 317c88f3f6SAchin Gupta#include <platform.h> 327c88f3f6SAchin Gupta 337c88f3f6SAchin GuptaOUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) 347c88f3f6SAchin GuptaOUTPUT_ARCH(PLATFORM_LINKER_ARCH) 35*9f98aa1aSJeenu ViswambharanENTRY(tsp_entrypoint) 36*9f98aa1aSJeenu Viswambharan 377c88f3f6SAchin Gupta 387c88f3f6SAchin GuptaMEMORY { 397c88f3f6SAchin Gupta RAM (rwx): ORIGIN = TZDRAM_BASE, LENGTH = TZDRAM_SIZE 407c88f3f6SAchin Gupta} 417c88f3f6SAchin Gupta 427c88f3f6SAchin Gupta 437c88f3f6SAchin GuptaSECTIONS 447c88f3f6SAchin Gupta{ 457c88f3f6SAchin Gupta . = BL32_BASE; 467c88f3f6SAchin Gupta ASSERT(. == ALIGN(4096), 477c88f3f6SAchin Gupta "BL32_BASE address is not aligned on a page boundary.") 487c88f3f6SAchin Gupta 497c88f3f6SAchin Gupta ro . : { 507c88f3f6SAchin Gupta __RO_START__ = .; 517c88f3f6SAchin Gupta *tsp_entrypoint.o(.text) 527c88f3f6SAchin Gupta *(.text) 537c88f3f6SAchin Gupta *(.rodata*) 547c88f3f6SAchin Gupta *(.vectors) 557c88f3f6SAchin Gupta __RO_END_UNALIGNED__ = .; 567c88f3f6SAchin Gupta /* 577c88f3f6SAchin Gupta * Memory page(s) mapped to this section will be marked as 587c88f3f6SAchin Gupta * read-only, executable. No RW data from the next section must 597c88f3f6SAchin Gupta * creep in. Ensure the rest of the current memory page is unused. 607c88f3f6SAchin Gupta */ 617c88f3f6SAchin Gupta . = NEXT(4096); 627c88f3f6SAchin Gupta __RO_END__ = .; 637c88f3f6SAchin Gupta } >RAM 647c88f3f6SAchin Gupta 657c88f3f6SAchin Gupta .data . : { 667c88f3f6SAchin Gupta __DATA_START__ = .; 677c88f3f6SAchin Gupta *(.data) 687c88f3f6SAchin Gupta __DATA_END__ = .; 697c88f3f6SAchin Gupta } >RAM 707c88f3f6SAchin Gupta 717c88f3f6SAchin Gupta stacks (NOLOAD) : { 727c88f3f6SAchin Gupta __STACKS_START__ = .; 737c88f3f6SAchin Gupta *(tzfw_normal_stacks) 747c88f3f6SAchin Gupta __STACKS_END__ = .; 757c88f3f6SAchin Gupta } >RAM 767c88f3f6SAchin Gupta 777c88f3f6SAchin Gupta /* 787c88f3f6SAchin Gupta * The .bss section gets initialised to 0 at runtime. 797c88f3f6SAchin Gupta * Its base address must be 16-byte aligned. 807c88f3f6SAchin Gupta */ 817c88f3f6SAchin Gupta .bss : ALIGN(16) { 827c88f3f6SAchin Gupta __BSS_START__ = .; 837c88f3f6SAchin Gupta *(SORT_BY_ALIGNMENT(.bss)) 847c88f3f6SAchin Gupta *(COMMON) 857c88f3f6SAchin Gupta __BSS_END__ = .; 867c88f3f6SAchin Gupta } >RAM 877c88f3f6SAchin Gupta 887c88f3f6SAchin Gupta /* 897c88f3f6SAchin Gupta * The xlat_table section is for full, aligned page tables (4K). 907c88f3f6SAchin Gupta * Removing them from .bss avoids forcing 4K alignment on 917c88f3f6SAchin Gupta * the .bss section and eliminates the unecessary zero init 927c88f3f6SAchin Gupta */ 937c88f3f6SAchin Gupta xlat_table (NOLOAD) : { 947c88f3f6SAchin Gupta *(xlat_table) 957c88f3f6SAchin Gupta } >RAM 967c88f3f6SAchin Gupta 977c88f3f6SAchin Gupta /* 987c88f3f6SAchin Gupta * The base address of the coherent memory section must be page-aligned (4K) 997c88f3f6SAchin Gupta * to guarantee that the coherent data are stored on their own pages and 1007c88f3f6SAchin Gupta * are not mixed with normal data. This is required to set up the correct 1017c88f3f6SAchin Gupta * memory attributes for the coherent data page tables. 1027c88f3f6SAchin Gupta */ 1037c88f3f6SAchin Gupta coherent_ram (NOLOAD) : ALIGN(4096) { 1047c88f3f6SAchin Gupta __COHERENT_RAM_START__ = .; 1057c88f3f6SAchin Gupta *(tzfw_coherent_mem) 1067c88f3f6SAchin Gupta __COHERENT_RAM_END_UNALIGNED__ = .; 1077c88f3f6SAchin Gupta /* 1087c88f3f6SAchin Gupta * Memory page(s) mapped to this section will be marked 1097c88f3f6SAchin Gupta * as device memory. No other unexpected data must creep in. 1107c88f3f6SAchin Gupta * Ensure the rest of the current memory page is unused. 1117c88f3f6SAchin Gupta */ 1127c88f3f6SAchin Gupta . = NEXT(4096); 1137c88f3f6SAchin Gupta __COHERENT_RAM_END__ = .; 1147c88f3f6SAchin Gupta } >RAM 1157c88f3f6SAchin Gupta 1167c88f3f6SAchin Gupta __BL2_END__ = .; 1177c88f3f6SAchin Gupta 1187c88f3f6SAchin Gupta __BSS_SIZE__ = SIZEOF(.bss); 1197c88f3f6SAchin Gupta __COHERENT_RAM_UNALIGNED_SIZE__ = 1207c88f3f6SAchin Gupta __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__; 1217c88f3f6SAchin Gupta 1227c88f3f6SAchin Gupta ASSERT(. <= TZDRAM_BASE + (1 << 21), "BL32 image does not fit in the first 2MB of Trusted DRAM.") 1237c88f3f6SAchin Gupta} 124