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