|
1 | 1 | /*
|
2 |
| -***************************************************************************** |
| 2 | +****************************************************************************** |
3 | 3 | **
|
4 |
| -** File : ldscript.ld |
| 4 | +** File : LinkerScript.ld |
5 | 5 | **
|
6 |
| -** Abstract : Linker script for STM32 Device |
| 6 | +** Abstract : Linker script for STM32MP1 series |
7 | 7 | **
|
8 | 8 | ** Set heap size, stack size and stack location according
|
9 | 9 | ** to application requirements.
|
|
12 | 12 | **
|
13 | 13 | ** Target : STMicroelectronics STM32
|
14 | 14 | **
|
| 15 | +** Distribution: The file is distributed “as is,” without any warranty |
| 16 | +** of any kind. |
| 17 | +** |
| 18 | +***************************************************************************** |
| 19 | +** @attention |
| 20 | +** |
| 21 | +** <h2><center>© Copyright (c) 2019 STMicroelectronics. |
| 22 | +** All rights reserved.</center></h2> |
| 23 | +** |
| 24 | +** This software component is licensed by ST under BSD 3-Clause license, |
| 25 | +** the License; You may not use this file except in compliance with the |
| 26 | +** License. You may obtain a copy of the License at: |
| 27 | +** opensource.org/licenses/BSD-3-Clause |
15 | 28 | **
|
16 | 29 | *****************************************************************************
|
17 | 30 | */
|
18 |
| -/* Copy here linker script for the new STM32 Device |
19 |
| - * or |
20 |
| - * replace this file by the new one with the same file name |
21 |
| - * It could be get thanks STM32CubeMX after code generation for Toolchain/IDE: 'SW4STM32', |
22 |
| - * ldscript will be availabe in the root folder (STM32YYxxxxxx_FLASH.ld) |
23 |
| - * or |
24 |
| - * copied from a STM32CubeYY project examples |
25 |
| - * where 'YY' could be F0, F1, F2, F3, F4, F7, G0, H7, L0, L1, L4, WB) |
26 |
| - */ |
| 31 | + |
| 32 | +/* Entry Point */ |
| 33 | +ENTRY(Reset_Handler) |
| 34 | + |
| 35 | +/* Highest address of the user mode stack */ |
| 36 | +_estack = 0x10040000; /* end of RAM */ |
| 37 | + |
| 38 | +_Min_Heap_Size = 0x200; /* required amount of heap */ |
| 39 | +_Min_Stack_Size = 0x400; /* required amount of stack */ |
| 40 | + |
| 41 | +/* Memories definition */ |
| 42 | +MEMORY |
| 43 | +{ |
| 44 | + m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000298 |
| 45 | + m_text (RX) : ORIGIN = 0x10000000, LENGTH = 0x00020000 |
| 46 | + m_data (RW) : ORIGIN = 0x10020000, LENGTH = 0x00020000 |
| 47 | + m_ipc_shm (RW) : ORIGIN = 0x10040000, LENGTH = 0x00008000 |
| 48 | +} |
| 49 | + |
| 50 | + /* Symbols needed for OpenAMP to enable rpmsg */ |
| 51 | +__OPENAMP_region_start__ = ORIGIN(m_ipc_shm); |
| 52 | +__OPENAMP_region_end__ = ORIGIN(m_ipc_shm)+LENGTH(m_ipc_shm); |
| 53 | + |
| 54 | +/* Sections */ |
| 55 | +SECTIONS |
| 56 | +{ |
| 57 | + /* The startup code into ROM memory */ |
| 58 | + .isr_vector : |
| 59 | + { |
| 60 | + . = ALIGN(4); |
| 61 | + KEEP(*(.isr_vector)) /* Startup code */ |
| 62 | + . = ALIGN(4); |
| 63 | + } > m_interrupts |
| 64 | + |
| 65 | + |
| 66 | + /* The program code and other data into ROM memory */ |
| 67 | + .text : |
| 68 | + { |
| 69 | + . = ALIGN(4); |
| 70 | + *(.text) /* .text sections (code) */ |
| 71 | + *(.text*) /* .text* sections (code) */ |
| 72 | + *(.glue_7) /* glue arm to thumb code */ |
| 73 | + *(.glue_7t) /* glue thumb to arm code */ |
| 74 | + *(.eh_frame) |
| 75 | + |
| 76 | + KEEP (*(.init)) |
| 77 | + KEEP (*(.fini)) |
| 78 | + |
| 79 | + . = ALIGN(4); |
| 80 | + _etext = .; /* define a global symbols at end of code */ |
| 81 | + } > m_text |
| 82 | + |
| 83 | + /* Constant data into ROM memory*/ |
| 84 | + .rodata : |
| 85 | + { |
| 86 | + . = ALIGN(4); |
| 87 | + *(.rodata) /* .rodata sections (constants, strings, etc.) */ |
| 88 | + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ |
| 89 | + . = ALIGN(4); |
| 90 | + } > m_text |
| 91 | + |
| 92 | + .ARM.extab : { |
| 93 | + . = ALIGN(4); |
| 94 | + *(.ARM.extab* .gnu.linkonce.armextab.*) |
| 95 | + . = ALIGN(4); |
| 96 | + } > m_text |
| 97 | + |
| 98 | + .ARM : { |
| 99 | + . = ALIGN(4); |
| 100 | + __exidx_start = .; |
| 101 | + *(.ARM.exidx*) |
| 102 | + __exidx_end = .; |
| 103 | + . = ALIGN(4); |
| 104 | + } > m_text |
| 105 | + |
| 106 | + .preinit_array : |
| 107 | + { |
| 108 | + . = ALIGN(4); |
| 109 | + PROVIDE_HIDDEN (__preinit_array_start = .); |
| 110 | + KEEP (*(.preinit_array*)) |
| 111 | + PROVIDE_HIDDEN (__preinit_array_end = .); |
| 112 | + . = ALIGN(4); |
| 113 | + } > m_text |
| 114 | + |
| 115 | + .init_array : |
| 116 | + { |
| 117 | + . = ALIGN(4); |
| 118 | + PROVIDE_HIDDEN (__init_array_start = .); |
| 119 | + KEEP (*(SORT(.init_array.*))) |
| 120 | + KEEP (*(.init_array*)) |
| 121 | + PROVIDE_HIDDEN (__init_array_end = .); |
| 122 | + . = ALIGN(4); |
| 123 | + } > m_text |
| 124 | + |
| 125 | + .fini_array : |
| 126 | + { |
| 127 | + . = ALIGN(4); |
| 128 | + PROVIDE_HIDDEN (__fini_array_start = .); |
| 129 | + KEEP (*(SORT(.fini_array.*))) |
| 130 | + KEEP (*(.fini_array*)) |
| 131 | + PROVIDE_HIDDEN (__fini_array_end = .); |
| 132 | + . = ALIGN(4); |
| 133 | + } > m_text |
| 134 | + |
| 135 | + /* Used by the startup to initialize data */ |
| 136 | + __DATA_ROM = .; |
| 137 | + _sidata = LOADADDR(.data); |
| 138 | + |
| 139 | + /* Initialized data sections */ |
| 140 | + .data : AT(__DATA_ROM) |
| 141 | + { |
| 142 | + . = ALIGN(4); |
| 143 | + _sdata = .; /* create a global symbol at data start */ |
| 144 | + *(.data) /* .data sections */ |
| 145 | + *(.data*) /* .data* sections */ |
| 146 | + |
| 147 | + . = ALIGN(4); |
| 148 | + _edata = .; /* define a global symbol at data end */ |
| 149 | + } > m_data |
| 150 | + |
| 151 | + __DATA_END = __DATA_ROM + (_edata - _sdata); |
| 152 | + text_end = ORIGIN(m_text) + LENGTH(m_text); |
| 153 | + ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data") |
| 154 | + |
| 155 | + .resource_table : |
| 156 | + { |
| 157 | + . = ALIGN(4); |
| 158 | + KEEP (*(.resource_table*)) |
| 159 | + . = ALIGN(4); |
| 160 | + } > m_data |
| 161 | + |
| 162 | + |
| 163 | + /* Uninitialized data section into RAM memory */ |
| 164 | + . = ALIGN(4); |
| 165 | + .bss : |
| 166 | + { |
| 167 | + /* This is used by the startup in order to initialize the .bss secion */ |
| 168 | + _sbss = .; /* define a global symbol at bss start */ |
| 169 | + __bss_start__ = _sbss; |
| 170 | + *(.bss) |
| 171 | + *(.bss*) |
| 172 | + *(COMMON) |
| 173 | + |
| 174 | + . = ALIGN(4); |
| 175 | + _ebss = .; /* define a global symbol at bss end */ |
| 176 | + __bss_end__ = _ebss; |
| 177 | + } > m_data |
| 178 | + |
| 179 | + /* User_heap_stack section, used to check that there is enough RAM left */ |
| 180 | + ._user_heap_stack : |
| 181 | + { |
| 182 | + . = ALIGN(8); |
| 183 | + PROVIDE ( end = . ); |
| 184 | + PROVIDE ( _end = . ); |
| 185 | + . = . + _Min_Heap_Size; |
| 186 | + . = . + _Min_Stack_Size; |
| 187 | + . = ALIGN(8); |
| 188 | + } > m_data |
| 189 | + |
| 190 | + |
| 191 | + |
| 192 | + /* Remove information from the compiler libraries */ |
| 193 | + /DISCARD/ : |
| 194 | + { |
| 195 | + libc.a ( * ) |
| 196 | + libm.a ( * ) |
| 197 | + libgcc.a ( * ) |
| 198 | + } |
| 199 | + |
| 200 | + .ARM.attributes 0 : { *(.ARM.attributes) } |
| 201 | + |
| 202 | +} |
0 commit comments