blob: 945de99e59bd10cf0111644c6fb3b968c07087e4 [file] [log] [blame]
Yann Gautier761797d2018-07-16 14:34:50 +02001/*
Yann Gautier0ed7b2a2021-05-19 18:48:16 +02002 * Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved.
Yann Gautier761797d2018-07-16 14:34:50 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef STM32MP1_LD_S
8#define STM32MP1_LD_S
9
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <lib/xlat_tables/xlat_tables_defs.h>
Yann Gautier761797d2018-07-16 14:34:50 +020011#include <platform_def.h>
Yann Gautier761797d2018-07-16 14:34:50 +020012
13OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
14OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
15
16ENTRY(__BL2_IMAGE_START__)
17
18MEMORY {
19 HEADER (rw) : ORIGIN = 0x00000000, LENGTH = 0x3000
Yann Gautiera2e2a302019-02-14 11:13:39 +010020 RAM (rwx) : ORIGIN = STM32MP_BINARY_BASE, LENGTH = STM32MP_BINARY_SIZE
Yann Gautier761797d2018-07-16 14:34:50 +020021}
22
23SECTIONS
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 Gautiera2e2a302019-02-14 11:13:39 +010035 . = STM32MP_BINARY_BASE;
Yann Gautier761797d2018-07-16 14:34:50 +020036 .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 Gautier0ed7b2a2021-05-19 18:48:16 +020046#if STM32MP_USE_STM32IMAGE
Yann Gautiera2e2a302019-02-14 11:13:39 +010047 . = ( STM32MP_DTB_BASE - STM32MP_BINARY_BASE );
Yann Gautier0ed7b2a2021-05-19 18:48:16 +020048#else
49 . = ( STM32MP_BL2_DTB_BASE - STM32MP_BINARY_BASE );
50#endif /* STM32MP_USE_STM32IMAGE */
Yann Gautier761797d2018-07-16 14:34:50 +020051 __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 Gautiera2e2a302019-02-14 11:13:39 +010060 . = ( STM32MP_BL2_BASE - STM32MP_BINARY_BASE );
Yann Gautier761797d2018-07-16 14:34:50 +020061 __BL2_IMAGE_START__ = .;
62 *(.bl2_image*)
63 __BL2_IMAGE_END__ = .;
64
Yann Gautier0ed7b2a2021-05-19 18:48:16 +020065#if STM32MP_USE_STM32IMAGE && !defined(AARCH32_SP_OPTEE)
Yann Gautier761797d2018-07-16 14:34:50 +020066 /*
67 * bl32 will be settled by bl2.
68 * The strongest and only alignment constraint is 8 words to simplify
69 * memraise8 assembly code.
70 */
Yann Gautiera2e2a302019-02-14 11:13:39 +010071 . = ( STM32MP_BL32_BASE - STM32MP_BINARY_BASE );
Yann Gautier761797d2018-07-16 14:34:50 +020072 __BL32_IMAGE_START__ = .;
73 *(.bl32_image*)
74 __BL32_IMAGE_END__ = .;
Yann Gautier0ed7b2a2021-05-19 18:48:16 +020075#endif /* STM32MP_USE_STM32IMAGE && !defined(AARCH32_SP_OPTEE) */
Yann Gautier761797d2018-07-16 14:34:50 +020076
77 __DATA_END__ = .;
78 } >RAM
79
80 __TF_END__ = .;
81
82}
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000083#endif /* STM32MP1_LD_S */