Yann Gautier | 761797d | 2018-07-16 14:34:50 +0200 | [diff] [blame] | 1 | /* |
Yann Gautier | 230bf91 | 2021-09-15 11:30:25 +0200 | [diff] [blame] | 2 | * Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved. |
Yann Gautier | 761797d | 2018-07-16 14:34:50 +0200 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef STM32MP1_LD_S |
| 8 | #define STM32MP1_LD_S |
| 9 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 10 | #include <lib/xlat_tables/xlat_tables_defs.h> |
Yann Gautier | 761797d | 2018-07-16 14:34:50 +0200 | [diff] [blame] | 11 | #include <platform_def.h> |
Yann Gautier | 761797d | 2018-07-16 14:34:50 +0200 | [diff] [blame] | 12 | |
| 13 | OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) |
| 14 | OUTPUT_ARCH(PLATFORM_LINKER_ARCH) |
| 15 | |
| 16 | ENTRY(__BL2_IMAGE_START__) |
| 17 | |
| 18 | MEMORY { |
Yann Gautier | a1ee9ed | 2020-09-17 11:30:18 +0200 | [diff] [blame] | 19 | HEADER (rw) : ORIGIN = 0x00000000, LENGTH = STM32MP_HEADER_RESERVED_SIZE |
Yann Gautier | a2e2a30 | 2019-02-14 11:13:39 +0100 | [diff] [blame] | 20 | RAM (rwx) : ORIGIN = STM32MP_BINARY_BASE, LENGTH = STM32MP_BINARY_SIZE |
Yann Gautier | 761797d | 2018-07-16 14:34:50 +0200 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | SECTIONS |
| 24 | { |
| 25 | /* |
| 26 | * TF mapping must conform to ROM code specification. |
| 27 | */ |
| 28 | .header : { |
| 29 | __HEADER_START__ = .; |
| 30 | KEEP(*(.header)) |
| 31 | . = ALIGN(4); |
| 32 | __HEADER_END__ = .; |
| 33 | } >HEADER |
| 34 | |
Yann Gautier | a2e2a30 | 2019-02-14 11:13:39 +0100 | [diff] [blame] | 35 | . = STM32MP_BINARY_BASE; |
Yann Gautier | 761797d | 2018-07-16 14:34:50 +0200 | [diff] [blame] | 36 | .data . : { |
| 37 | . = ALIGN(PAGE_SIZE); |
| 38 | __DATA_START__ = .; |
| 39 | *(.data*) |
| 40 | |
| 41 | /* |
| 42 | * dtb. |
| 43 | * The strongest and only alignment contraint is MMU 4K page. |
| 44 | * Indeed as images below will be removed, 4K pages will be re-used. |
| 45 | */ |
Yann Gautier | 0ed7b2a | 2021-05-19 18:48:16 +0200 | [diff] [blame] | 46 | #if STM32MP_USE_STM32IMAGE |
Yann Gautier | a2e2a30 | 2019-02-14 11:13:39 +0100 | [diff] [blame] | 47 | . = ( STM32MP_DTB_BASE - STM32MP_BINARY_BASE ); |
Yann Gautier | 0ed7b2a | 2021-05-19 18:48:16 +0200 | [diff] [blame] | 48 | #else |
| 49 | . = ( STM32MP_BL2_DTB_BASE - STM32MP_BINARY_BASE ); |
| 50 | #endif /* STM32MP_USE_STM32IMAGE */ |
Yann Gautier | 761797d | 2018-07-16 14:34:50 +0200 | [diff] [blame] | 51 | __DTB_IMAGE_START__ = .; |
| 52 | *(.dtb_image*) |
| 53 | __DTB_IMAGE_END__ = .; |
| 54 | |
| 55 | /* |
| 56 | * bl2. |
| 57 | * The strongest and only alignment contraint is MMU 4K page. |
| 58 | * Indeed as images below will be removed, 4K pages will be re-used. |
| 59 | */ |
Yann Gautier | 230bf91 | 2021-09-15 11:30:25 +0200 | [diff] [blame] | 60 | #if SEPARATE_CODE_AND_RODATA |
| 61 | . = ( STM32MP_BL2_RO_BASE - STM32MP_BINARY_BASE ); |
| 62 | #else |
Yann Gautier | a2e2a30 | 2019-02-14 11:13:39 +0100 | [diff] [blame] | 63 | . = ( STM32MP_BL2_BASE - STM32MP_BINARY_BASE ); |
Yann Gautier | 230bf91 | 2021-09-15 11:30:25 +0200 | [diff] [blame] | 64 | #endif |
Yann Gautier | 761797d | 2018-07-16 14:34:50 +0200 | [diff] [blame] | 65 | __BL2_IMAGE_START__ = .; |
| 66 | *(.bl2_image*) |
| 67 | __BL2_IMAGE_END__ = .; |
| 68 | |
Yann Gautier | 0ed7b2a | 2021-05-19 18:48:16 +0200 | [diff] [blame] | 69 | #if STM32MP_USE_STM32IMAGE && !defined(AARCH32_SP_OPTEE) |
Yann Gautier | 761797d | 2018-07-16 14:34:50 +0200 | [diff] [blame] | 70 | /* |
| 71 | * bl32 will be settled by bl2. |
| 72 | * The strongest and only alignment constraint is 8 words to simplify |
| 73 | * memraise8 assembly code. |
| 74 | */ |
Yann Gautier | a2e2a30 | 2019-02-14 11:13:39 +0100 | [diff] [blame] | 75 | . = ( STM32MP_BL32_BASE - STM32MP_BINARY_BASE ); |
Yann Gautier | 761797d | 2018-07-16 14:34:50 +0200 | [diff] [blame] | 76 | __BL32_IMAGE_START__ = .; |
| 77 | *(.bl32_image*) |
| 78 | __BL32_IMAGE_END__ = .; |
Yann Gautier | 0ed7b2a | 2021-05-19 18:48:16 +0200 | [diff] [blame] | 79 | #endif /* STM32MP_USE_STM32IMAGE && !defined(AARCH32_SP_OPTEE) */ |
Yann Gautier | 761797d | 2018-07-16 14:34:50 +0200 | [diff] [blame] | 80 | |
| 81 | __DATA_END__ = .; |
| 82 | } >RAM |
| 83 | |
| 84 | __TF_END__ = .; |
| 85 | |
| 86 | } |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 87 | #endif /* STM32MP1_LD_S */ |