Mercurial > ecos
comparison packages/hal/cortexm/arch/current/src/cortexm.ld @ 2580:07fc475e1c28
Add Cortex-M architecture HAL, STM32 variant and STM3210E platform HALs.
Add STM32 serial driver and on-chip flash driver.
Fix some compile problems with dlmalloc.
See the various ChangeLogs for details.
| author | nickg |
|---|---|
| date | Mon, 03 Nov 2008 14:53:50 +0000 |
| parents | |
| children | 74dbf4c3f2e1 |
comparison
equal
deleted
inserted
replaced
| 2579:23e894d966a8 | 2580:07fc475e1c28 |
|---|---|
| 1 //============================================================================= | |
| 2 // | |
| 3 // MLT linker script for Cortex-M | |
| 4 // | |
| 5 //============================================================================= | |
| 6 //####ECOSGPLCOPYRIGHTBEGIN#### | |
| 7 // ------------------------------------------- | |
| 8 // This file is part of eCos, the Embedded Configurable Operating System. | |
| 9 // Copyright (C) 2008 eCosCentric Limited. | |
| 10 // | |
| 11 // eCos is free software; you can redistribute it and/or modify it under | |
| 12 // the terms of the GNU General Public License as published by the Free | |
| 13 // Software Foundation; either version 2 or (at your option) any later version. | |
| 14 // | |
| 15 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY | |
| 16 // WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 17 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 18 // for more details. | |
| 19 // | |
| 20 // You should have received a copy of the GNU General Public License along | |
| 21 // with eCos; if not, write to the Free Software Foundation, Inc., | |
| 22 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
| 23 // | |
| 24 // As a special exception, if other files instantiate templates or use macros | |
| 25 // or inline functions from this file, or you compile this file and link it | |
| 26 // with other works to produce a work based on this file, this file does not | |
| 27 // by itself cause the resulting work to be covered by the GNU General Public | |
| 28 // License. However the source code for this file must still be made available | |
| 29 // in accordance with section (3) of the GNU General Public License. | |
| 30 // | |
| 31 // This exception does not invalidate any other reasons why a work based on | |
| 32 // this file might be covered by the GNU General Public License. | |
| 33 // ------------------------------------------- | |
| 34 //####ECOSGPLCOPYRIGHTEND#### | |
| 35 //============================================================================= | |
| 36 | |
| 37 #include <pkgconf/system.h> | |
| 38 #include <pkgconf/hal.h> | |
| 39 | |
| 40 STARTUP(vectors.o) | |
| 41 ENTRY(reset_vector) | |
| 42 INPUT(extras.o) | |
| 43 GROUP(libtarget.a libgcc.a libsupc++.a) | |
| 44 | |
| 45 #if defined(__ARMEB__) | |
| 46 OUTPUT_FORMAT(elf32-bigarm) | |
| 47 #endif | |
| 48 | |
| 49 // ALIGN_LMA is 4, but the AAPCS now requires that double word types | |
| 50 // be aligned to 8, which means some input sections can be marked as needing | |
| 51 // 8-byte alignment, even text ones (consider literal data). | |
| 52 | |
| 53 #define ALIGN_LMA 4 | |
| 54 #define AAPCS_ALIGN 8 | |
| 55 #define FOLLOWING_ALIGNED(_section_, _align_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + (_align_) - 1) & ~ ((_align_) - 1)) | |
| 56 #define FOLLOWING(_section_) FOLLOWING_ALIGNED(_section_, ALIGN_LMA) | |
| 57 | |
| 58 #define LMA_EQ_VMA | |
| 59 #define FORCE_OUTPUT . = . | |
| 60 | |
| 61 // Some versions of gcc define "arm" which causes problems with .note.arm.ident | |
| 62 #undef arm | |
| 63 #define SECTIONS_BEGIN \ | |
| 64 /* Debug information */ \ | |
| 65 .debug_aranges 0 : { *(.debug_aranges) } \ | |
| 66 .debug_pubnames 0 : { *(.debug_pubnames) } \ | |
| 67 .debug_info 0 : { *(.debug_info) } \ | |
| 68 .debug_abbrev 0 : { *(.debug_abbrev) } \ | |
| 69 .debug_line 0 : { *(.debug_line) } \ | |
| 70 .debug_frame 0 : { *(.debug_frame) } \ | |
| 71 .debug_str 0 : { *(.debug_str) } \ | |
| 72 .debug_loc 0 : { *(.debug_loc) } \ | |
| 73 .debug_macinfo 0 : { *(.debug_macinfo) } \ | |
| 74 .note.arm.ident 0 : { KEEP (*(.note.arm.ident)) } \ | |
| 75 /DISCARD/ 0 : { *(.fini_array*) } | |
| 76 | |
| 77 | |
| 78 // Following not used unless CYGHWR_HAL_ARM_SEPARATE_VSR_TABLE | |
| 79 // defined in hal_platform_setup.h. Otherwise vsr table | |
| 80 // goes in .fixed_vectors. | |
| 81 #define SECTION_hal_vsr_table(_region_, _vma_, _lma_) \ | |
| 82 .hal_vsr_table _vma_ : _lma_ \ | |
| 83 { FORCE_OUTPUT; KEEP (*(.hal_vsr_table)) } \ | |
| 84 > _region_ | |
| 85 | |
| 86 #define SECTION_fixed_vectors(_region_, _vma_, _lma_) \ | |
| 87 .fixed_vectors _vma_ : _lma_ \ | |
| 88 { FORCE_OUTPUT; KEEP (*(.fixed_vectors)) } \ | |
| 89 > _region_ | |
| 90 | |
| 91 #define SECTION_rom_vectors(_region_, _vma_, _lma_) \ | |
| 92 .rom_vectors _vma_ : _lma_ \ | |
| 93 { __rom_vectors_vma = ABSOLUTE(.); \ | |
| 94 FORCE_OUTPUT; KEEP (*(.vectors)) } \ | |
| 95 > _region_ \ | |
| 96 __rom_vectors_lma = LOADADDR(.rom_vectors); | |
| 97 | |
| 98 // We slot in the .ARM.extab and .ARM.exidx sections first. They | |
| 99 // need to be close to .text due to their relocations which may | |
| 100 // want small offsets - .rodata may be somewhere very different. | |
| 101 // This approach also allows forward compatibility with targets | |
| 102 // which haven't used the EABI before (no new SECTION_xxx definition | |
| 103 // to use). | |
| 104 // One glitch is that the AAPCS can require up to 8-byte alignment | |
| 105 // for double word types. For sections after the first (for which we | |
| 106 // "trust" the MLT files (probably a mistake)), we need to | |
| 107 // ensure the subsequent sections' VMA and LMA move in sync, which | |
| 108 // means keeping the same alignment, and thus since for example literal | |
| 109 // data in .text can require up to 8 byte alignment, the LMA must also | |
| 110 // be 8 byte aligned. | |
| 111 #define SECTION_text(_region_, _vma_, _lma_) \ | |
| 112 .ARM.extab _vma_ : _lma_ \ | |
| 113 { PROVIDE (__stext = ABSOLUTE(.));_stext = ABSOLUTE(.) ; \ | |
| 114 FORCE_OUTPUT; \ | |
| 115 *(.ARM.extab* .gnu.linkonce.armextab.*) } > _region_ \ | |
| 116 . = ALIGN(AAPCS_ALIGN); \ | |
| 117 __exidx_start = ABSOLUTE(.); \ | |
| 118 .ARM.exidx ALIGN(AAPCS_ALIGN) : FOLLOWING_ALIGNED(.ARM.extab, AAPCS_ALIGN) { \ | |
| 119 *(.ARM.exidx* .gnu.linkonce.armexidx.*) \ | |
| 120 FORCE_OUTPUT; \ | |
| 121 } > _region_ \ | |
| 122 __exidx_end = ABSOLUTE(.);\ | |
| 123 .text ALIGN(AAPCS_ALIGN) : FOLLOWING_ALIGNED(.ARM.exidx, AAPCS_ALIGN) \ | |
| 124 { \ | |
| 125 *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) \ | |
| 126 *(.glue_7) *(.glue_7t) \ | |
| 127 __CTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.ctors*))) __CTOR_END__ = ABSOLUTE (.); \ | |
| 128 __DTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.dtors*))) __DTOR_END__ = ABSOLUTE (.); \ | |
| 129 } > _region_ \ | |
| 130 _etext = .; PROVIDE (__etext = .); | |
| 131 | |
| 132 #define SECTION_fini(_region_, _vma_, _lma_) \ | |
| 133 .fini _vma_ : _lma_ \ | |
| 134 { FORCE_OUTPUT; *(.fini) } \ | |
| 135 > _region_ | |
| 136 | |
| 137 #define SECTION_rodata(_region_, _vma_, _lma_) \ | |
| 138 .rodata _vma_ : _lma_ \ | |
| 139 { FORCE_OUTPUT; *(.rodata*) *(.gnu.linkonce.r.*) } \ | |
| 140 > _region_ | |
| 141 | |
| 142 #define SECTION_rodata1(_region_, _vma_, _lma_) \ | |
| 143 .rodata1 _vma_ : _lma_ \ | |
| 144 { FORCE_OUTPUT; *(.rodata1) } \ | |
| 145 > _region_ | |
| 146 | |
| 147 #define SECTION_fixup(_region_, _vma_, _lma_) \ | |
| 148 .fixup _vma_ : _lma_ \ | |
| 149 { FORCE_OUTPUT; *(.fixup) } \ | |
| 150 > _region_ | |
| 151 | |
| 152 #define SECTION_gcc_except_table(_region_, _vma_, _lma_) \ | |
| 153 .gcc_except_table _vma_ : _lma_ \ | |
| 154 { FORCE_OUTPUT; \ | |
| 155 KEEP(*(.gcc_except_table)) \ | |
| 156 *(.gcc_except_table.*) \ | |
| 157 } > _region_ | |
| 158 | |
| 159 #define SECTION_eh_frame(_region_, _vma_, _lma_) \ | |
| 160 .eh_frame _vma_ : _lma_ \ | |
| 161 { \ | |
| 162 FORCE_OUTPUT; __EH_FRAME_BEGIN__ = .; \ | |
| 163 KEEP(*(.eh_frame)) \ | |
| 164 __FRAME_END__ = .; \ | |
| 165 . = . + 8; \ | |
| 166 } > _region_ = 0 | |
| 167 | |
| 168 #define SECTION_RELOCS(_region_, _vma_, _lma_) \ | |
| 169 .rel.text : \ | |
| 170 { \ | |
| 171 *(.rel.text) \ | |
| 172 *(.rel.text.*) \ | |
| 173 *(.rel.gnu.linkonce.t*) \ | |
| 174 } > _region_ \ | |
| 175 .rela.text : \ | |
| 176 { \ | |
| 177 *(.rela.text) \ | |
| 178 *(.rela.text.*) \ | |
| 179 *(.rela.gnu.linkonce.t*) \ | |
| 180 } > _region_ \ | |
| 181 .rel.data : \ | |
| 182 { \ | |
| 183 *(.rel.data) \ | |
| 184 *(.rel.data.*) \ | |
| 185 *(.rel.gnu.linkonce.d*) \ | |
| 186 } > _region_ \ | |
| 187 .rela.data : \ | |
| 188 { \ | |
| 189 *(.rela.data) \ | |
| 190 *(.rela.data.*) \ | |
| 191 *(.rela.gnu.linkonce.d*) \ | |
| 192 } > _region_ \ | |
| 193 .rel.rodata : \ | |
| 194 { \ | |
| 195 *(.rel.rodata) \ | |
| 196 *(.rel.rodata.*) \ | |
| 197 *(.rel.gnu.linkonce.r*) \ | |
| 198 } > _region_ \ | |
| 199 .rela.rodata : \ | |
| 200 { \ | |
| 201 *(.rela.rodata) \ | |
| 202 *(.rela.rodata.*) \ | |
| 203 *(.rela.gnu.linkonce.r*) \ | |
| 204 } > _region_ \ | |
| 205 .rel.got : { *(.rel.got) } > _region_ \ | |
| 206 .rela.got : { *(.rela.got) } > _region_ \ | |
| 207 .rel.ctors : { *(.rel.ctors) } > _region_ \ | |
| 208 .rela.ctors : { *(.rela.ctors) } > _region_ \ | |
| 209 .rel.dtors : { *(.rel.dtors) } > _region_ \ | |
| 210 .rela.dtors : { *(.rela.dtors) } > _region_ \ | |
| 211 .rel.init : { *(.rel.init) } > _region_ \ | |
| 212 .rela.init : { *(.rela.init) } > _region_ \ | |
| 213 .rel.fini : { *(.rel.fini) } > _region_ \ | |
| 214 .rela.fini : { *(.rela.fini) } > _region_ \ | |
| 215 .rel.bss : { *(.rel.bss) } > _region_ \ | |
| 216 .rela.bss : { *(.rela.bss) } > _region_ \ | |
| 217 .rel.plt : { *(.rel.plt) } > _region_ \ | |
| 218 .rela.plt : { *(.rela.plt) } > _region_ \ | |
| 219 .rel.dyn : { *(.rel.dyn) } > _region_ | |
| 220 | |
| 221 #define SECTION_got(_region_, _vma_, _lma_) \ | |
| 222 .got _vma_ : _lma_ \ | |
| 223 { \ | |
| 224 FORCE_OUTPUT; *(.got.plt) *(.got) \ | |
| 225 _GOT1_START_ = ABSOLUTE (.); *(.got1) _GOT1_END_ = ABSOLUTE (.); \ | |
| 226 _GOT2_START_ = ABSOLUTE (.); *(.got2) _GOT2_END_ = ABSOLUTE (.); \ | |
| 227 } > _region_ | |
| 228 | |
| 229 #define SECTION_mmu_tables(_region_, _vma_, _lma_) \ | |
| 230 .mmu_tables _vma_ : _lma_ \ | |
| 231 { FORCE_OUTPUT; *(.mmu_tables) } \ | |
| 232 > _region_ | |
| 233 | |
| 234 #define SECTION_sram(_region_, _vma_, _lma_) \ | |
| 235 .sram _vma_ : _lma_ \ | |
| 236 { FORCE_OUTPUT; *(.sram*) } \ | |
| 237 > _region_ | |
| 238 | |
| 239 #define SECTION_data(_region_, _vma_, _lma_) \ | |
| 240 .data _vma_ : _lma_ \ | |
| 241 { __ram_data_start = ABSOLUTE (.); \ | |
| 242 *(.data*) *(.data1) *(.gnu.linkonce.d.*) \ | |
| 243 . = ALIGN (4); \ | |
| 244 KEEP(*( SORT (.ecos.table.*))) ; \ | |
| 245 . = ALIGN (4); \ | |
| 246 __init_array_start__ = ABSOLUTE (.); KEEP (*(SORT (.init_array.*))) \ | |
| 247 KEEP (*(SORT (.init_array))) __init_array_end__ = ABSOLUTE (.); \ | |
| 248 *(.dynamic) *(.sdata*) *(.gnu.linkonce.s.*) \ | |
| 249 . = ALIGN (4); *(.2ram.*) } \ | |
| 250 > _region_ \ | |
| 251 __rom_data_start = LOADADDR (.data); \ | |
| 252 __ram_data_end = .; PROVIDE (__ram_data_end = .); _edata = .; PROVIDE (edata = .); \ | |
| 253 PROVIDE (__rom_data_end = LOADADDR (.data) + SIZEOF(.data)); | |
| 254 | |
| 255 #define SECTION_bss(_region_, _vma_, _lma_) \ | |
| 256 .bss _vma_ : _lma_ \ | |
| 257 { __bss_start = ABSOLUTE (.); \ | |
| 258 *(.scommon) *(.dynsbss) *(.sbss*) *(.gnu.linkonce.sb.*) \ | |
| 259 *(.dynbss) *(.bss*) *(.gnu.linkonce.b.*) *(COMMON) \ | |
| 260 __bss_end = ABSOLUTE (.); } \ | |
| 261 > _region_ | |
| 262 | |
| 263 #define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); | |
| 264 | |
| 265 #include <pkgconf/hal_cortexm.h> | |
| 266 #include CYGHWR_MEMORY_LAYOUT_LDI |
