14f6ad66aSAchin Gupta/* 2e83b0cadSDan Handley * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. 34f6ad66aSAchin Gupta * 44f6ad66aSAchin Gupta * Redistribution and use in source and binary forms, with or without 54f6ad66aSAchin Gupta * modification, are permitted provided that the following conditions are met: 64f6ad66aSAchin Gupta * 74f6ad66aSAchin Gupta * Redistributions of source code must retain the above copyright notice, this 84f6ad66aSAchin Gupta * list of conditions and the following disclaimer. 94f6ad66aSAchin Gupta * 104f6ad66aSAchin Gupta * Redistributions in binary form must reproduce the above copyright notice, 114f6ad66aSAchin Gupta * this list of conditions and the following disclaimer in the documentation 124f6ad66aSAchin Gupta * and/or other materials provided with the distribution. 134f6ad66aSAchin Gupta * 144f6ad66aSAchin Gupta * Neither the name of ARM nor the names of its contributors may be used 154f6ad66aSAchin Gupta * to endorse or promote products derived from this software without specific 164f6ad66aSAchin Gupta * prior written permission. 174f6ad66aSAchin Gupta * 184f6ad66aSAchin Gupta * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 194f6ad66aSAchin Gupta * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 204f6ad66aSAchin Gupta * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 214f6ad66aSAchin Gupta * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 224f6ad66aSAchin Gupta * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 234f6ad66aSAchin Gupta * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 244f6ad66aSAchin Gupta * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 254f6ad66aSAchin Gupta * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 264f6ad66aSAchin Gupta * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 274f6ad66aSAchin Gupta * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 284f6ad66aSAchin Gupta * POSSIBILITY OF SUCH DAMAGE. 294f6ad66aSAchin Gupta */ 304f6ad66aSAchin Gupta 315f0cdb05SDan Handley#include <platform_def.h> 324f6ad66aSAchin Gupta 334f6ad66aSAchin GuptaOUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) 344f6ad66aSAchin GuptaOUTPUT_ARCH(PLATFORM_LINKER_ARCH) 359f98aa1aSJeenu ViswambharanENTRY(bl1_entrypoint) 364f6ad66aSAchin Gupta 374f6ad66aSAchin GuptaMEMORY { 38d7fbf132SJuan Castillo ROM (rx): ORIGIN = BL1_RO_BASE, LENGTH = BL1_RO_LIMIT - BL1_RO_BASE 39d7fbf132SJuan Castillo RAM (rwx): ORIGIN = BL1_RW_BASE, LENGTH = BL1_RW_LIMIT - BL1_RW_BASE 404f6ad66aSAchin Gupta} 414f6ad66aSAchin Gupta 424f6ad66aSAchin GuptaSECTIONS 434f6ad66aSAchin Gupta{ 444f59d835SSandrine Bailleux . = BL1_RO_BASE; 454f59d835SSandrine Bailleux ASSERT(. == ALIGN(4096), 464f59d835SSandrine Bailleux "BL1_RO_BASE address is not aligned on a page boundary.") 474f59d835SSandrine Bailleux 484f59d835SSandrine Bailleux ro . : { 498d69a03fSSandrine Bailleux __RO_START__ = .; 50dccc537aSAndrew Thoelke *bl1_entrypoint.o(.text*) 51dccc537aSAndrew Thoelke *(.text*) 528d69a03fSSandrine Bailleux *(.rodata*) 539b476841SSoby Mathew 549b476841SSoby Mathew /* 559b476841SSoby Mathew * Ensure 8-byte alignment for cpu_ops so that its fields are also 569b476841SSoby Mathew * aligned. Also ensure cpu_ops inclusion. 579b476841SSoby Mathew */ 589b476841SSoby Mathew . = ALIGN(8); 599b476841SSoby Mathew __CPU_OPS_START__ = .; 609b476841SSoby Mathew KEEP(*(cpu_ops)) 619b476841SSoby Mathew __CPU_OPS_END__ = .; 629b476841SSoby Mathew 63b739f22aSAchin Gupta *(.vectors) 648d69a03fSSandrine Bailleux __RO_END__ = .; 654f6ad66aSAchin Gupta } >ROM 664f6ad66aSAchin Gupta 679b476841SSoby Mathew ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__, 689b476841SSoby Mathew "cpu_ops not defined for this platform.") 699b476841SSoby Mathew 708d69a03fSSandrine Bailleux /* 718d69a03fSSandrine Bailleux * The .data section gets copied from ROM to RAM at runtime. 724f59d835SSandrine Bailleux * Its LMA must be 16-byte aligned. 734f59d835SSandrine Bailleux * Its VMA must be page-aligned as it marks the first read/write page. 748d69a03fSSandrine Bailleux */ 754f59d835SSandrine Bailleux . = BL1_RW_BASE; 764f59d835SSandrine Bailleux ASSERT(. == ALIGN(4096), 774f59d835SSandrine Bailleux "BL1_RW_BASE address is not aligned on a page boundary.") 784f59d835SSandrine Bailleux .data . : ALIGN(16) { 794f6ad66aSAchin Gupta __DATA_RAM_START__ = .; 80dccc537aSAndrew Thoelke *(.data*) 818d69a03fSSandrine Bailleux __DATA_RAM_END__ = .; 824f6ad66aSAchin Gupta } >RAM AT>ROM 834f6ad66aSAchin Gupta 844f59d835SSandrine Bailleux stacks . (NOLOAD) : { 858d69a03fSSandrine Bailleux __STACKS_START__ = .; 864f6ad66aSAchin Gupta *(tzfw_normal_stacks) 878d69a03fSSandrine Bailleux __STACKS_END__ = .; 884f6ad66aSAchin Gupta } >RAM 894f6ad66aSAchin Gupta 908d69a03fSSandrine Bailleux /* 918d69a03fSSandrine Bailleux * The .bss section gets initialised to 0 at runtime. 928d69a03fSSandrine Bailleux * Its base address must be 16-byte aligned. 938d69a03fSSandrine Bailleux */ 948d69a03fSSandrine Bailleux .bss : ALIGN(16) { 958d69a03fSSandrine Bailleux __BSS_START__ = .; 96dccc537aSAndrew Thoelke *(.bss*) 978d69a03fSSandrine Bailleux *(COMMON) 988d69a03fSSandrine Bailleux __BSS_END__ = .; 998d69a03fSSandrine Bailleux } >RAM 1004f6ad66aSAchin Gupta 1018d69a03fSSandrine Bailleux /* 102a0cd989dSAchin Gupta * The xlat_table section is for full, aligned page tables (4K). 10374cbb839SJeenu Viswambharan * Removing them from .bss avoids forcing 4K alignment on 10474cbb839SJeenu Viswambharan * the .bss section and eliminates the unecessary zero init 10574cbb839SJeenu Viswambharan */ 10674cbb839SJeenu Viswambharan xlat_table (NOLOAD) : { 10774cbb839SJeenu Viswambharan *(xlat_table) 10874cbb839SJeenu Viswambharan } >RAM 10974cbb839SJeenu Viswambharan 110*ab8707e6SSoby Mathew#if USE_COHERENT_MEM 11174cbb839SJeenu Viswambharan /* 1128d69a03fSSandrine Bailleux * The base address of the coherent memory section must be page-aligned (4K) 1138d69a03fSSandrine Bailleux * to guarantee that the coherent data are stored on their own pages and 1148d69a03fSSandrine Bailleux * are not mixed with normal data. This is required to set up the correct 1158d69a03fSSandrine Bailleux * memory attributes for the coherent data page tables. 1168d69a03fSSandrine Bailleux */ 1178d69a03fSSandrine Bailleux coherent_ram (NOLOAD) : ALIGN(4096) { 1188d69a03fSSandrine Bailleux __COHERENT_RAM_START__ = .; 1198d69a03fSSandrine Bailleux *(tzfw_coherent_mem) 1208d69a03fSSandrine Bailleux __COHERENT_RAM_END_UNALIGNED__ = .; 1218d69a03fSSandrine Bailleux /* 1228d69a03fSSandrine Bailleux * Memory page(s) mapped to this section will be marked 1238d69a03fSSandrine Bailleux * as device memory. No other unexpected data must creep in. 1248d69a03fSSandrine Bailleux * Ensure the rest of the current memory page is unused. 1258d69a03fSSandrine Bailleux */ 1268d69a03fSSandrine Bailleux . = NEXT(4096); 1278d69a03fSSandrine Bailleux __COHERENT_RAM_END__ = .; 1288d69a03fSSandrine Bailleux } >RAM 129*ab8707e6SSoby Mathew#endif 1304f6ad66aSAchin Gupta 1318d69a03fSSandrine Bailleux __BL1_RAM_START__ = ADDR(.data); 1328d69a03fSSandrine Bailleux __BL1_RAM_END__ = .; 1334f6ad66aSAchin Gupta 1348d69a03fSSandrine Bailleux __DATA_ROM_START__ = LOADADDR(.data); 1358d69a03fSSandrine Bailleux __DATA_SIZE__ = SIZEOF(.data); 136a37255a2SSandrine Bailleux /* 137a37255a2SSandrine Bailleux * The .data section is the last PROGBITS section so its end marks the end 138a37255a2SSandrine Bailleux * of the read-only part of BL1's binary. 139a37255a2SSandrine Bailleux */ 140a37255a2SSandrine Bailleux ASSERT(__DATA_ROM_START__ + __DATA_SIZE__ <= BL1_RO_LIMIT, 141a37255a2SSandrine Bailleux "BL1's RO section has exceeded its limit.") 1428d69a03fSSandrine Bailleux 1438d69a03fSSandrine Bailleux __BSS_SIZE__ = SIZEOF(.bss); 1448d69a03fSSandrine Bailleux 145*ab8707e6SSoby Mathew#if USE_COHERENT_MEM 1468d69a03fSSandrine Bailleux __COHERENT_RAM_UNALIGNED_SIZE__ = 1478d69a03fSSandrine Bailleux __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__; 148*ab8707e6SSoby Mathew#endif 1498d69a03fSSandrine Bailleux 150a37255a2SSandrine Bailleux ASSERT(. <= BL1_RW_LIMIT, "BL1's RW section has exceeded its limit.") 1514f6ad66aSAchin Gupta} 152