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 OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
lharoon 0:22612ae617a0 18 ENTRY(__cs3_reset_cortex_m)
lharoon 0:22612ae617a0 19 SEARCH_DIR(.)
lharoon 0:22612ae617a0 20
lharoon 0:22612ae617a0 21 /*
lharoon 0:22612ae617a0 22 ram ORIGIN: 8_byte_aligned(49 vect * 4 bytes) = 8_byte_aligned(0xC4) = 0xC8
lharoon 0:22612ae617a0 23 ram LENGTH: 32KB - 0xC8 = 0x7F38
lharoon 0:22612ae617a0 24 */
lharoon 0:22612ae617a0 25 MEMORY
lharoon 0:22612ae617a0 26 {
lharoon 0:22612ae617a0 27 rom (rx) : ORIGIN = 0x00000000, LENGTH = 512K
lharoon 0:22612ae617a0 28
lharoon 0:22612ae617a0 29 ram (rwx) : ORIGIN = 0x100000C8, LENGTH = 0x7F38
lharoon 0:22612ae617a0 30
lharoon 0:22612ae617a0 31 ram1(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K
lharoon 0:22612ae617a0 32 ram2(rwx) : ORIGIN = 0x20080000, LENGTH = 16K
lharoon 0:22612ae617a0 33 }
lharoon 0:22612ae617a0 34
lharoon 0:22612ae617a0 35 /* These force the linker to search for particular symbols from
lharoon 0:22612ae617a0 36 * the start of the link process and thus ensure the user's
lharoon 0:22612ae617a0 37 * overrides are picked up
lharoon 0:22612ae617a0 38 */
lharoon 0:22612ae617a0 39 EXTERN(__cs3_reset_cortex_m)
lharoon 0:22612ae617a0 40 EXTERN(__cs3_interrupt_vector_cortex_m)
lharoon 0:22612ae617a0 41 EXTERN(__cs3_start_c main __cs3_stack __cs3_stack_size __cs3_heap_end)
lharoon 0:22612ae617a0 42
lharoon 0:22612ae617a0 43 PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram);
lharoon 0:22612ae617a0 44 PROVIDE(__cs3_stack_size = __cs3_region_start_ram + __cs3_region_size_ram - _end);
lharoon 0:22612ae617a0 45 PROVIDE(__cs3_heap_start = _end);
lharoon 0:22612ae617a0 46 PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram);
lharoon 0:22612ae617a0 47
lharoon 0:22612ae617a0 48 SECTIONS
lharoon 0:22612ae617a0 49 {
lharoon 0:22612ae617a0 50 .text :
lharoon 0:22612ae617a0 51 {
lharoon 0:22612ae617a0 52 CREATE_OBJECT_SYMBOLS
lharoon 0:22612ae617a0 53 __cs3_region_start_rom = .;
lharoon 0:22612ae617a0 54 *(.cs3.region-head.rom)
lharoon 0:22612ae617a0 55 __cs3_interrupt_vector = __cs3_interrupt_vector_cortex_m;
lharoon 0:22612ae617a0 56 *(.cs3.interrupt_vector)
lharoon 0:22612ae617a0 57 /* Make sure we pulled in an interrupt vector. */
lharoon 0:22612ae617a0 58 ASSERT (. != __cs3_interrupt_vector_cortex_m, "No interrupt vector");
lharoon 0:22612ae617a0 59 *(.rom)
lharoon 0:22612ae617a0 60 *(.rom.b)
lharoon 0:22612ae617a0 61
lharoon 0:22612ae617a0 62 __cs3_reset = __cs3_reset_cortex_m;
lharoon 0:22612ae617a0 63 *(.cs3.reset)
lharoon 0:22612ae617a0 64 /* Make sure we pulled in some reset code. */
lharoon 0:22612ae617a0 65 ASSERT (. != __cs3_reset, "No reset code");
lharoon 0:22612ae617a0 66
lharoon 0:22612ae617a0 67 *(.text .text.* .gnu.linkonce.t.*)
lharoon 0:22612ae617a0 68 *(.plt)
lharoon 0:22612ae617a0 69 *(.gnu.warning)
lharoon 0:22612ae617a0 70 *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
lharoon 0:22612ae617a0 71
lharoon 0:22612ae617a0 72 *(.rodata .rodata.* .gnu.linkonce.r.*)
lharoon 0:22612ae617a0 73
lharoon 0:22612ae617a0 74 *(.ARM.extab* .gnu.linkonce.armextab.*)
lharoon 0:22612ae617a0 75 *(.gcc_except_table)
lharoon 0:22612ae617a0 76 *(.eh_frame_hdr)
lharoon 0:22612ae617a0 77 *(.eh_frame)
lharoon 0:22612ae617a0 78
lharoon 0:22612ae617a0 79 . = ALIGN(4);
lharoon 0:22612ae617a0 80 KEEP(*(.init))
lharoon 0:22612ae617a0 81
lharoon 0:22612ae617a0 82 . = ALIGN(4);
lharoon 0:22612ae617a0 83 __preinit_array_start = .;
lharoon 0:22612ae617a0 84 KEEP (*(.preinit_array))
lharoon 0:22612ae617a0 85 __preinit_array_end = .;
lharoon 0:22612ae617a0 86
lharoon 0:22612ae617a0 87 . = ALIGN(4);
lharoon 0:22612ae617a0 88 __init_array_start = .;
lharoon 0:22612ae617a0 89 KEEP (*(SORT(.init_array.*)))
lharoon 0:22612ae617a0 90 KEEP (*(.init_array))
lharoon 0:22612ae617a0 91 __init_array_end = .;
lharoon 0:22612ae617a0 92
lharoon 0:22612ae617a0 93 . = ALIGN(0x4);
lharoon 0:22612ae617a0 94 KEEP (*crtbegin.o(.ctors))
lharoon 0:22612ae617a0 95 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
lharoon 0:22612ae617a0 96 KEEP (*(SORT(.ctors.*)))
lharoon 0:22612ae617a0 97 KEEP (*crtend.o(.ctors))
lharoon 0:22612ae617a0 98
lharoon 0:22612ae617a0 99 . = ALIGN(4);
lharoon 0:22612ae617a0 100 KEEP(*(.fini))
lharoon 0:22612ae617a0 101
lharoon 0:22612ae617a0 102 . = ALIGN(4);
lharoon 0:22612ae617a0 103 __fini_array_start = .;
lharoon 0:22612ae617a0 104 KEEP (*(.fini_array))
lharoon 0:22612ae617a0 105 KEEP (*(SORT(.fini_array.*)))
lharoon 0:22612ae617a0 106 __fini_array_end = .;
lharoon 0:22612ae617a0 107
lharoon 0:22612ae617a0 108 KEEP (*crtbegin.o(.dtors))
lharoon 0:22612ae617a0 109 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
lharoon 0:22612ae617a0 110 KEEP (*(SORT(.dtors.*)))
lharoon 0:22612ae617a0 111 KEEP (*crtend.o(.dtors))
lharoon 0:22612ae617a0 112
lharoon 0:22612ae617a0 113 . = ALIGN(4);
lharoon 0:22612ae617a0 114 __cs3_regions = .;
lharoon 0:22612ae617a0 115 LONG (0)
lharoon 0:22612ae617a0 116 LONG (__cs3_region_init_ram)
lharoon 0:22612ae617a0 117 LONG (__cs3_region_start_ram)
lharoon 0:22612ae617a0 118 LONG (__cs3_region_init_size_ram)
lharoon 0:22612ae617a0 119 LONG (__cs3_region_zero_size_ram)
lharoon 0:22612ae617a0 120 }
lharoon 0:22612ae617a0 121
lharoon 0:22612ae617a0 122 /* .ARM.exidx is sorted, so has to go in its own output section. */
lharoon 0:22612ae617a0 123 __exidx_start = .;
lharoon 0:22612ae617a0 124 .ARM.exidx :
lharoon 0:22612ae617a0 125 {
lharoon 0:22612ae617a0 126 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
lharoon 0:22612ae617a0 127 } >rom
lharoon 0:22612ae617a0 128 __exidx_end = .;
lharoon 0:22612ae617a0 129 .text.align :
lharoon 0:22612ae617a0 130 {
lharoon 0:22612ae617a0 131 . = ALIGN(8);
lharoon 0:22612ae617a0 132 _etext = .;
lharoon 0:22612ae617a0 133 } >rom
lharoon 0:22612ae617a0 134 __cs3_region_size_rom = LENGTH(rom);
lharoon 0:22612ae617a0 135 __cs3_region_num = 1;
lharoon 0:22612ae617a0 136
lharoon 0:22612ae617a0 137 .data :
lharoon 0:22612ae617a0 138 {
lharoon 0:22612ae617a0 139 __cs3_region_start_ram = .;
lharoon 0:22612ae617a0 140 *(.cs3.region-head.ram)
lharoon 0:22612ae617a0 141 KEEP(*(.jcr))
lharoon 0:22612ae617a0 142 *(.got.plt) *(.got)
lharoon 0:22612ae617a0 143 *(.shdata)
lharoon 0:22612ae617a0 144 *(.data .data.* .gnu.linkonce.d.*)
lharoon 0:22612ae617a0 145 *(.ram)
lharoon 0:22612ae617a0 146 . = ALIGN (8);
lharoon 0:22612ae617a0 147 _edata = .;
lharoon 0:22612ae617a0 148 } >ram AT>rom
lharoon 0:22612ae617a0 149 .bss :
lharoon 0:22612ae617a0 150 {
lharoon 0:22612ae617a0 151 *(.shbss)
lharoon 0:22612ae617a0 152 *(.bss .bss.* .gnu.linkonce.b.*)
lharoon 0:22612ae617a0 153 *(COMMON)
lharoon 0:22612ae617a0 154 *(.ram.b)
lharoon 0:22612ae617a0 155 . = ALIGN (8);
lharoon 0:22612ae617a0 156 _end = .;
lharoon 0:22612ae617a0 157 __end = .;
lharoon 0:22612ae617a0 158 } >ram AT>rom
lharoon 0:22612ae617a0 159 /* This used for USB RAM section */
lharoon 0:22612ae617a0 160 .usb_ram (NOLOAD):
lharoon 0:22612ae617a0 161 {
lharoon 0:22612ae617a0 162 *.o (USB_RAM)
lharoon 0:22612ae617a0 163 } > ram2
lharoon 0:22612ae617a0 164 .heap (NOLOAD) :
lharoon 0:22612ae617a0 165 {
lharoon 0:22612ae617a0 166 *(.heap)
lharoon 0:22612ae617a0 167 } >ram
lharoon 0:22612ae617a0 168 .stack (__cs3_stack - __cs3_stack_size) (NOLOAD):
lharoon 0:22612ae617a0 169 {
lharoon 0:22612ae617a0 170 *(.stack)
lharoon 0:22612ae617a0 171 _estack = .;
lharoon 0:22612ae617a0 172 PROVIDE(estack = .);
lharoon 0:22612ae617a0 173 } >ram
lharoon 0:22612ae617a0 174
lharoon 0:22612ae617a0 175 __cs3_region_init_ram = LOADADDR (.data);
lharoon 0:22612ae617a0 176 __cs3_region_init_size_ram = _edata - __cs3_region_start_ram;
lharoon 0:22612ae617a0 177 __cs3_region_zero_size_ram = _end - _edata;
lharoon 0:22612ae617a0 178 __cs3_region_size_ram = LENGTH(ram);
lharoon 0:22612ae617a0 179 __cs3_region_num = 1;
lharoon 0:22612ae617a0 180
lharoon 0:22612ae617a0 181 .stab 0 (NOLOAD) : { *(.stab) }
lharoon 0:22612ae617a0 182 .stabstr 0 (NOLOAD) : { *(.stabstr) }
lharoon 0:22612ae617a0 183 /* DWARF debug sections.
lharoon 0:22612ae617a0 184 * Symbols in the DWARF debugging sections are relative to the beginning
lharoon 0:22612ae617a0 185 * of the section so we begin them at 0. */
lharoon 0:22612ae617a0 186 /* DWARF 1 */
lharoon 0:22612ae617a0 187 .debug 0 : { *(.debug) }
lharoon 0:22612ae617a0 188 .line 0 : { *(.line) }
lharoon 0:22612ae617a0 189 /* GNU DWARF 1 extensions */
lharoon 0:22612ae617a0 190 .debug_srcinfo 0 : { *(.debug_srcinfo) }
lharoon 0:22612ae617a0 191 .debug_sfnames 0 : { *(.debug_sfnames) }
lharoon 0:22612ae617a0 192 /* DWARF 1.1 and DWARF 2 */
lharoon 0:22612ae617a0 193 .debug_aranges 0 : { *(.debug_aranges) }
lharoon 0:22612ae617a0 194 .debug_pubnames 0 : { *(.debug_pubnames) }
lharoon 0:22612ae617a0 195 /* DWARF 2 */
lharoon 0:22612ae617a0 196 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
lharoon 0:22612ae617a0 197 .debug_abbrev 0 : { *(.debug_abbrev) }
lharoon 0:22612ae617a0 198 .debug_line 0 : { *(.debug_line) }
lharoon 0:22612ae617a0 199 .debug_frame 0 : { *(.debug_frame) }
lharoon 0:22612ae617a0 200 .debug_str 0 : { *(.debug_str) }
lharoon 0:22612ae617a0 201 .debug_loc 0 : { *(.debug_loc) }
lharoon 0:22612ae617a0 202 .debug_macinfo 0 : { *(.debug_macinfo) }
lharoon 0:22612ae617a0 203 /* SGI/MIPS DWARF 2 extensions */
lharoon 0:22612ae617a0 204 .debug_weaknames 0 : { *(.debug_weaknames) }
lharoon 0:22612ae617a0 205 .debug_funcnames 0 : { *(.debug_funcnames) }
lharoon 0:22612ae617a0 206 .debug_typenames 0 : { *(.debug_typenames) }
lharoon 0:22612ae617a0 207 .debug_varnames 0 : { *(.debug_varnames) }
lharoon 0:22612ae617a0 208
lharoon 0:22612ae617a0 209 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
lharoon 0:22612ae617a0 210 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
lharoon 0:22612ae617a0 211 /DISCARD/ : { *(.note.GNU-stack) }
lharoon 0:22612ae617a0 212 }