Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <platform_def.h> |
| 8 | #include <xlat_tables_defs.h> |
| 9 | |
| 10 | OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) |
| 11 | OUTPUT_ARCH(PLATFORM_LINKER_ARCH) |
| 12 | ENTRY(tftf_entrypoint) |
| 13 | |
| 14 | MEMORY { |
| 15 | RAM (rwx): ORIGIN = DRAM_BASE, LENGTH = DRAM_SIZE |
| 16 | } |
| 17 | |
| 18 | |
| 19 | SECTIONS |
| 20 | { |
| 21 | . = TFTF_BASE; |
| 22 | __TFTF_BASE__ = .; |
| 23 | |
Ambroise Vincent | 014cbae | 2019-07-03 16:44:49 +0100 | [diff] [blame] | 24 | .text . : { |
| 25 | __TEXT_START__ = .; |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 26 | *entrypoint.o(.text*) |
| 27 | *(.text*) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 28 | *(.vectors) |
Ambroise Vincent | 014cbae | 2019-07-03 16:44:49 +0100 | [diff] [blame] | 29 | . = NEXT(PAGE_SIZE); |
| 30 | __TEXT_END__ = .; |
| 31 | } >RAM |
| 32 | |
| 33 | .rodata . : { |
| 34 | __RODATA_START__ = .; |
| 35 | *(.rodata*) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 36 | /* |
| 37 | * Memory page(s) mapped to this section will be marked as |
| 38 | * read-only, executable. No RW data from the next section must |
| 39 | * creep in. Ensure the rest of the current memory page is unused. |
| 40 | */ |
| 41 | . = NEXT(PAGE_SIZE); |
Ambroise Vincent | 014cbae | 2019-07-03 16:44:49 +0100 | [diff] [blame] | 42 | __RODATA_END__ = .; |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 43 | } >RAM |
| 44 | |
| 45 | .data : { |
| 46 | __DATA_START__ = .; |
| 47 | *(.data*) |
| 48 | __DATA_END__ = .; |
| 49 | } >RAM |
| 50 | |
| 51 | stacks (NOLOAD) : { |
| 52 | __STACKS_START__ = .; |
| 53 | *(tftf_normal_stacks) |
| 54 | __STACKS_END__ = .; |
| 55 | } >RAM |
| 56 | |
| 57 | /* |
| 58 | * The .bss section gets initialised to 0 at runtime. |
| 59 | * Its base address must be 16-byte aligned. |
| 60 | */ |
| 61 | .bss : ALIGN(16) { |
| 62 | __BSS_START__ = .; |
| 63 | *(SORT_BY_ALIGNMENT(.bss*)) |
| 64 | *(COMMON) |
| 65 | __BSS_END__ = .; |
| 66 | } >RAM |
| 67 | |
| 68 | /* |
| 69 | * The xlat_table section is for full, aligned page tables (4K). |
| 70 | * Removing them from .bss avoids forcing 4K alignment on |
| 71 | * the .bss section and eliminates the unecessary zero init |
| 72 | */ |
| 73 | xlat_table (NOLOAD) : { |
| 74 | *(xlat_table) |
| 75 | } >RAM |
| 76 | |
| 77 | /* |
| 78 | * The base address of the coherent memory section must be page-aligned (4K) |
| 79 | * to guarantee that the coherent data are stored on their own pages and |
| 80 | * are not mixed with normal data. This is required to set up the correct |
| 81 | * memory attributes for the coherent data page tables. |
| 82 | */ |
| 83 | coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) { |
| 84 | __COHERENT_RAM_START__ = .; |
| 85 | *(tftf_coherent_stacks) |
| 86 | *(tftf_coherent_mem) |
| 87 | __COHERENT_RAM_END_UNALIGNED__ = .; |
| 88 | /* |
| 89 | * Memory page(s) mapped to this section will be marked |
| 90 | * as device memory. No other unexpected data must creep in. |
| 91 | * Ensure the rest of the current memory page is unused. |
| 92 | */ |
| 93 | . = NEXT(PAGE_SIZE); |
| 94 | __COHERENT_RAM_END__ = .; |
| 95 | } >RAM |
| 96 | |
| 97 | __COHERENT_RAM_UNALIGNED_SIZE__ = |
| 98 | __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__; |
| 99 | |
| 100 | |
| 101 | __TFTF_END__ = .; |
| 102 | |
| 103 | __BSS_SIZE__ = SIZEOF(.bss); |
| 104 | |
| 105 | } |