SD card interface

Committer:
lharoon
Date:
Mon Oct 08 11:14:07 2012 +0000
Revision:
0:22612ae617a0
1st edition

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lharoon 0:22612ae617a0 1 /* Linker script for mbed LPC1768
lharoon 0:22612ae617a0 2 *
lharoon 0:22612ae617a0 3 * Version:CodeSourcery Sourcery G++ Lite 2007q3-53
lharoon 0:22612ae617a0 4 * BugURL:https://support.codesourcery.com/GNUToolchain/
lharoon 0:22612ae617a0 5 *
lharoon 0:22612ae617a0 6 * Copyright 2007 CodeSourcery.
lharoon 0:22612ae617a0 7 *
lharoon 0:22612ae617a0 8 * The authors hereby grant permission to use, copy, modify, distribute,
lharoon 0:22612ae617a0 9 * and license this software and its documentation for any purpose, provided
lharoon 0:22612ae617a0 10 * that existing copyright notices are retained in all copies and that this
lharoon 0:22612ae617a0 11 * notice is included verbatim in any distributions. No written agreement,
lharoon 0:22612ae617a0 12 * license, or royalty fee is required for any of the authorized uses.
lharoon 0:22612ae617a0 13 * Modifications to this software may be copyrighted by their authors
lharoon 0:22612ae617a0 14 * and need not follow the licensing terms described here, provided that
lharoon 0:22612ae617a0 15 * the new terms are clearly indicated on the first page of each file where
lharoon 0:22612ae617a0 16 * they apply. */
lharoon 0:22612ae617a0 17
lharoon 0:22612ae617a0 18 OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
lharoon 0:22612ae617a0 19 ENTRY(__cs3_reset_cortex_m)
lharoon 0:22612ae617a0 20 SEARCH_DIR(.)
lharoon 0:22612ae617a0 21
lharoon 0:22612ae617a0 22 /*
lharoon 0:22612ae617a0 23 ram ORIGIN: 8_byte_aligned(48 vect * 4 bytes) = 8_byte_aligned(0xC0) = 0xC0
lharoon 0:22612ae617a0 24 ram LENGTH: 8KB - 0xC0 = 0xF40
lharoon 0:22612ae617a0 25 */
lharoon 0:22612ae617a0 26 MEMORY
lharoon 0:22612ae617a0 27 {
lharoon 0:22612ae617a0 28 rom (rx) : ORIGIN = 0x00000000, LENGTH = 32K
lharoon 0:22612ae617a0 29
lharoon 0:22612ae617a0 30 ram (rwx) : ORIGIN = 0x100000C0, LENGTH = 0xF40
lharoon 0:22612ae617a0 31 }
lharoon 0:22612ae617a0 32
lharoon 0:22612ae617a0 33 /* These force the linker to search for particular symbols from
lharoon 0:22612ae617a0 34 * the start of the link process and thus ensure the user's
lharoon 0:22612ae617a0 35 * overrides are picked up
lharoon 0:22612ae617a0 36 */
lharoon 0:22612ae617a0 37 EXTERN(__cs3_reset_cortex_m)
lharoon 0:22612ae617a0 38 EXTERN(__cs3_interrupt_vector_cortex_m)
lharoon 0:22612ae617a0 39 EXTERN(__cs3_start_c main __cs3_stack __cs3_stack_size __cs3_heap_end)
lharoon 0:22612ae617a0 40
lharoon 0:22612ae617a0 41 PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram);
lharoon 0:22612ae617a0 42 PROVIDE(__cs3_stack_size = __cs3_region_start_ram + __cs3_region_size_ram - _end);
lharoon 0:22612ae617a0 43 PROVIDE(__cs3_heap_start = _end);
lharoon 0:22612ae617a0 44 PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram);
lharoon 0:22612ae617a0 45
lharoon 0:22612ae617a0 46 SECTIONS
lharoon 0:22612ae617a0 47 {
lharoon 0:22612ae617a0 48 .text :
lharoon 0:22612ae617a0 49 {
lharoon 0:22612ae617a0 50 CREATE_OBJECT_SYMBOLS
lharoon 0:22612ae617a0 51 __cs3_region_start_rom = .;
lharoon 0:22612ae617a0 52 *(.cs3.region-head.rom)
lharoon 0:22612ae617a0 53 __cs3_interrupt_vector = __cs3_interrupt_vector_cortex_m;
lharoon 0:22612ae617a0 54 *(.cs3.interrupt_vector)
lharoon 0:22612ae617a0 55 /* Make sure we pulled in an interrupt vector. */
lharoon 0:22612ae617a0 56 ASSERT (. != __cs3_interrupt_vector_cortex_m, "No interrupt vector");
lharoon 0:22612ae617a0 57 *(.rom)
lharoon 0:22612ae617a0 58 *(.rom.b)
lharoon 0:22612ae617a0 59
lharoon 0:22612ae617a0 60 __cs3_reset = __cs3_reset_cortex_m;
lharoon 0:22612ae617a0 61 *(.cs3.reset)
lharoon 0:22612ae617a0 62 /* Make sure we pulled in some reset code. */
lharoon 0:22612ae617a0 63 ASSERT (. != __cs3_reset, "No reset code");
lharoon 0:22612ae617a0 64
lharoon 0:22612ae617a0 65 *(.text .text.* .gnu.linkonce.t.*)
lharoon 0:22612ae617a0 66 *(.plt)
lharoon 0:22612ae617a0 67 *(.gnu.warning)
lharoon 0:22612ae617a0 68 *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
lharoon 0:22612ae617a0 69
lharoon 0:22612ae617a0 70 *(.rodata .rodata.* .gnu.linkonce.r.*)
lharoon 0:22612ae617a0 71
lharoon 0:22612ae617a0 72 *(.ARM.extab* .gnu.linkonce.armextab.*)
lharoon 0:22612ae617a0 73 *(.gcc_except_table)
lharoon 0:22612ae617a0 74 *(.eh_frame_hdr)
lharoon 0:22612ae617a0 75 *(.eh_frame)
lharoon 0:22612ae617a0 76
lharoon 0:22612ae617a0 77 . = ALIGN(4);
lharoon 0:22612ae617a0 78 KEEP(*(.init))
lharoon 0:22612ae617a0 79
lharoon 0:22612ae617a0 80 . = ALIGN(4);
lharoon 0:22612ae617a0 81 __preinit_array_start = .;
lharoon 0:22612ae617a0 82 KEEP (*(.preinit_array))
lharoon 0:22612ae617a0 83 __preinit_array_end = .;
lharoon 0:22612ae617a0 84
lharoon 0:22612ae617a0 85 . = ALIGN(4);
lharoon 0:22612ae617a0 86 __init_array_start = .;
lharoon 0:22612ae617a0 87 KEEP (*(SORT(.init_array.*)))
lharoon 0:22612ae617a0 88 KEEP (*(.init_array))
lharoon 0:22612ae617a0 89 __init_array_end = .;
lharoon 0:22612ae617a0 90
lharoon 0:22612ae617a0 91 . = ALIGN(0x4);
lharoon 0:22612ae617a0 92 KEEP (*crtbegin.o(.ctors))
lharoon 0:22612ae617a0 93 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
lharoon 0:22612ae617a0 94 KEEP (*(SORT(.ctors.*)))
lharoon 0:22612ae617a0 95 KEEP (*crtend.o(.ctors))
lharoon 0:22612ae617a0 96
lharoon 0:22612ae617a0 97 . = ALIGN(4);
lharoon 0:22612ae617a0 98 KEEP(*(.fini))
lharoon 0:22612ae617a0 99
lharoon 0:22612ae617a0 100 . = ALIGN(4);
lharoon 0:22612ae617a0 101 __fini_array_start = .;
lharoon 0:22612ae617a0 102 KEEP (*(.fini_array))
lharoon 0:22612ae617a0 103 KEEP (*(SORT(.fini_array.*)))
lharoon 0:22612ae617a0 104 __fini_array_end = .;
lharoon 0:22612ae617a0 105
lharoon 0:22612ae617a0 106 KEEP (*crtbegin.o(.dtors))
lharoon 0:22612ae617a0 107 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
lharoon 0:22612ae617a0 108 KEEP (*(SORT(.dtors.*)))
lharoon 0:22612ae617a0 109 KEEP (*crtend.o(.dtors))
lharoon 0:22612ae617a0 110
lharoon 0:22612ae617a0 111 . = ALIGN(4);
lharoon 0:22612ae617a0 112 __cs3_regions = .;
lharoon 0:22612ae617a0 113 LONG (0)
lharoon 0:22612ae617a0 114 LONG (__cs3_region_init_ram)
lharoon 0:22612ae617a0 115 LONG (__cs3_region_start_ram)
lharoon 0:22612ae617a0 116 LONG (__cs3_region_init_size_ram)
lharoon 0:22612ae617a0 117 LONG (__cs3_region_zero_size_ram)
lharoon 0:22612ae617a0 118 }
lharoon 0:22612ae617a0 119
lharoon 0:22612ae617a0 120 /* .ARM.exidx is sorted, so has to go in its own output section. */
lharoon 0:22612ae617a0 121 __exidx_start = .;
lharoon 0:22612ae617a0 122 .ARM.exidx :
lharoon 0:22612ae617a0 123 {
lharoon 0:22612ae617a0 124 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
lharoon 0:22612ae617a0 125 } >rom
lharoon 0:22612ae617a0 126 __exidx_end = .;
lharoon 0:22612ae617a0 127 .text.align :
lharoon 0:22612ae617a0 128 {
lharoon 0:22612ae617a0 129 . = ALIGN(8);
lharoon 0:22612ae617a0 130 _etext = .;
lharoon 0:22612ae617a0 131 } >rom
lharoon 0:22612ae617a0 132 __cs3_region_size_rom = LENGTH(rom);
lharoon 0:22612ae617a0 133 __cs3_region_num = 1;
lharoon 0:22612ae617a0 134
lharoon 0:22612ae617a0 135 .data :
lharoon 0:22612ae617a0 136 {
lharoon 0:22612ae617a0 137 __cs3_region_start_ram = .;
lharoon 0:22612ae617a0 138 *(.cs3.region-head.ram)
lharoon 0:22612ae617a0 139 KEEP(*(.jcr))
lharoon 0:22612ae617a0 140 *(.got.plt) *(.got)
lharoon 0:22612ae617a0 141 *(.shdata)
lharoon 0:22612ae617a0 142 *(.data .data.* .gnu.linkonce.d.*)
lharoon 0:22612ae617a0 143 *(.ram)
lharoon 0:22612ae617a0 144 . = ALIGN (8);
lharoon 0:22612ae617a0 145 _edata = .;
lharoon 0:22612ae617a0 146 } >ram AT>rom
lharoon 0:22612ae617a0 147 .bss :
lharoon 0:22612ae617a0 148 {
lharoon 0:22612ae617a0 149 *(.shbss)
lharoon 0:22612ae617a0 150 *(.bss .bss.* .gnu.linkonce.b.*)
lharoon 0:22612ae617a0 151 *(COMMON)
lharoon 0:22612ae617a0 152 *(.ram.b)
lharoon 0:22612ae617a0 153 . = ALIGN (8);
lharoon 0:22612ae617a0 154 _end = .;
lharoon 0:22612ae617a0 155 __end = .;
lharoon 0:22612ae617a0 156 } >ram AT>rom
lharoon 0:22612ae617a0 157
lharoon 0:22612ae617a0 158 .heap (NOLOAD) :
lharoon 0:22612ae617a0 159 {
lharoon 0:22612ae617a0 160 *(.heap)
lharoon 0:22612ae617a0 161 } >ram
lharoon 0:22612ae617a0 162 .stack (__cs3_stack - __cs3_stack_size) (NOLOAD):
lharoon 0:22612ae617a0 163 {
lharoon 0:22612ae617a0 164 *(.stack)
lharoon 0:22612ae617a0 165 _estack = .;
lharoon 0:22612ae617a0 166 PROVIDE(estack = .);
lharoon 0:22612ae617a0 167 } >ram
lharoon 0:22612ae617a0 168
lharoon 0:22612ae617a0 169 __cs3_region_init_ram = LOADADDR (.data);
lharoon 0:22612ae617a0 170 __cs3_region_init_size_ram = _edata - __cs3_region_start_ram;
lharoon 0:22612ae617a0 171 __cs3_region_zero_size_ram = _end - _edata;
lharoon 0:22612ae617a0 172 __cs3_region_size_ram = LENGTH(ram);
lharoon 0:22612ae617a0 173 __cs3_region_num = 1;
lharoon 0:22612ae617a0 174
lharoon 0:22612ae617a0 175 .stab 0 (NOLOAD) : { *(.stab) }
lharoon 0:22612ae617a0 176 .stabstr 0 (NOLOAD) : { *(.stabstr) }
lharoon 0:22612ae617a0 177 /* DWARF debug sections.
lharoon 0:22612ae617a0 178 * Symbols in the DWARF debugging sections are relative to the beginning
lharoon 0:22612ae617a0 179 * of the section so we begin them at 0. */
lharoon 0:22612ae617a0 180 /* DWARF 1 */
lharoon 0:22612ae617a0 181 .debug 0 : { *(.debug) }
lharoon 0:22612ae617a0 182 .line 0 : { *(.line) }
lharoon 0:22612ae617a0 183 /* GNU DWARF 1 extensions */
lharoon 0:22612ae617a0 184 .debug_srcinfo 0 : { *(.debug_srcinfo) }
lharoon 0:22612ae617a0 185 .debug_sfnames 0 : { *(.debug_sfnames) }
lharoon 0:22612ae617a0 186 /* DWARF 1.1 and DWARF 2 */
lharoon 0:22612ae617a0 187 .debug_aranges 0 : { *(.debug_aranges) }
lharoon 0:22612ae617a0 188 .debug_pubnames 0 : { *(.debug_pubnames) }
lharoon 0:22612ae617a0 189 /* DWARF 2 */
lharoon 0:22612ae617a0 190 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
lharoon 0:22612ae617a0 191 .debug_abbrev 0 : { *(.debug_abbrev) }
lharoon 0:22612ae617a0 192 .debug_line 0 : { *(.debug_line) }
lharoon 0:22612ae617a0 193 .debug_frame 0 : { *(.debug_frame) }
lharoon 0:22612ae617a0 194 .debug_str 0 : { *(.debug_str) }
lharoon 0:22612ae617a0 195 .debug_loc 0 : { *(.debug_loc) }
lharoon 0:22612ae617a0 196 .debug_macinfo 0 : { *(.debug_macinfo) }
lharoon 0:22612ae617a0 197 /* SGI/MIPS DWARF 2 extensions */
lharoon 0:22612ae617a0 198 .debug_weaknames 0 : { *(.debug_weaknames) }
lharoon 0:22612ae617a0 199 .debug_funcnames 0 : { *(.debug_funcnames) }
lharoon 0:22612ae617a0 200 .debug_typenames 0 : { *(.debug_typenames) }
lharoon 0:22612ae617a0 201 .debug_varnames 0 : { *(.debug_varnames) }
lharoon 0:22612ae617a0 202
lharoon 0:22612ae617a0 203 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
lharoon 0:22612ae617a0 204 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
lharoon 0:22612ae617a0 205 /DISCARD/ : { *(.note.GNU-stack) }
lharoon 0:22612ae617a0 206 }