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 GROUP(-lstdc++ -lsupc++ -lm -lc -lnosys -lgcc)
lharoon 0:22612ae617a0 3
lharoon 0:22612ae617a0 4 /* Linker script to configure memory regions. */
lharoon 0:22612ae617a0 5 MEMORY
lharoon 0:22612ae617a0 6 {
lharoon 0:22612ae617a0 7 FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K
lharoon 0:22612ae617a0 8 RAM (rwx) : ORIGIN = 0x100000C8, LENGTH = 0x7F38
lharoon 0:22612ae617a0 9
lharoon 0:22612ae617a0 10 USB_RAM(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K
lharoon 0:22612ae617a0 11 ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K
lharoon 0:22612ae617a0 12 }
lharoon 0:22612ae617a0 13
lharoon 0:22612ae617a0 14 /* Linker script to place sections and symbol values. Should be used together
lharoon 0:22612ae617a0 15 * with other linker script that defines memory regions FLASH and RAM.
lharoon 0:22612ae617a0 16 * It references following symbols, which must be defined in code:
lharoon 0:22612ae617a0 17 * Reset_Handler : Entry of reset handler
lharoon 0:22612ae617a0 18 *
lharoon 0:22612ae617a0 19 * It defines following symbols, which code can use without definition:
lharoon 0:22612ae617a0 20 * __exidx_start
lharoon 0:22612ae617a0 21 * __exidx_end
lharoon 0:22612ae617a0 22 * __etext
lharoon 0:22612ae617a0 23 * __data_start__
lharoon 0:22612ae617a0 24 * __preinit_array_start
lharoon 0:22612ae617a0 25 * __preinit_array_end
lharoon 0:22612ae617a0 26 * __init_array_start
lharoon 0:22612ae617a0 27 * __init_array_end
lharoon 0:22612ae617a0 28 * __fini_array_start
lharoon 0:22612ae617a0 29 * __fini_array_end
lharoon 0:22612ae617a0 30 * __data_end__
lharoon 0:22612ae617a0 31 * __bss_start__
lharoon 0:22612ae617a0 32 * __bss_end__
lharoon 0:22612ae617a0 33 * __end__
lharoon 0:22612ae617a0 34 * end
lharoon 0:22612ae617a0 35 * __HeapLimit
lharoon 0:22612ae617a0 36 * __StackLimit
lharoon 0:22612ae617a0 37 * __StackTop
lharoon 0:22612ae617a0 38 * __stack
lharoon 0:22612ae617a0 39 */
lharoon 0:22612ae617a0 40 ENTRY(Reset_Handler)
lharoon 0:22612ae617a0 41
lharoon 0:22612ae617a0 42 SECTIONS
lharoon 0:22612ae617a0 43 {
lharoon 0:22612ae617a0 44 .text :
lharoon 0:22612ae617a0 45 {
lharoon 0:22612ae617a0 46 KEEP(*(.isr_vector))
lharoon 0:22612ae617a0 47 *(.text*)
lharoon 0:22612ae617a0 48
lharoon 0:22612ae617a0 49 KEEP(*(.init))
lharoon 0:22612ae617a0 50 KEEP(*(.fini))
lharoon 0:22612ae617a0 51
lharoon 0:22612ae617a0 52 /* .ctors */
lharoon 0:22612ae617a0 53 *crtbegin.o(.ctors)
lharoon 0:22612ae617a0 54 *crtbegin?.o(.ctors)
lharoon 0:22612ae617a0 55 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
lharoon 0:22612ae617a0 56 *(SORT(.ctors.*))
lharoon 0:22612ae617a0 57 *(.ctors)
lharoon 0:22612ae617a0 58
lharoon 0:22612ae617a0 59 /* .dtors */
lharoon 0:22612ae617a0 60 *crtbegin.o(.dtors)
lharoon 0:22612ae617a0 61 *crtbegin?.o(.dtors)
lharoon 0:22612ae617a0 62 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
lharoon 0:22612ae617a0 63 *(SORT(.dtors.*))
lharoon 0:22612ae617a0 64 *(.dtors)
lharoon 0:22612ae617a0 65
lharoon 0:22612ae617a0 66 *(.rodata*)
lharoon 0:22612ae617a0 67
lharoon 0:22612ae617a0 68 KEEP(*(.eh_frame*))
lharoon 0:22612ae617a0 69 } > FLASH
lharoon 0:22612ae617a0 70
lharoon 0:22612ae617a0 71 .ARM.extab :
lharoon 0:22612ae617a0 72 {
lharoon 0:22612ae617a0 73 *(.ARM.extab* .gnu.linkonce.armextab.*)
lharoon 0:22612ae617a0 74 } > FLASH
lharoon 0:22612ae617a0 75
lharoon 0:22612ae617a0 76 __exidx_start = .;
lharoon 0:22612ae617a0 77 .ARM.exidx :
lharoon 0:22612ae617a0 78 {
lharoon 0:22612ae617a0 79 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
lharoon 0:22612ae617a0 80 } > FLASH
lharoon 0:22612ae617a0 81 __exidx_end = .;
lharoon 0:22612ae617a0 82
lharoon 0:22612ae617a0 83 __etext = .;
lharoon 0:22612ae617a0 84
lharoon 0:22612ae617a0 85 .data : AT (__etext)
lharoon 0:22612ae617a0 86 {
lharoon 0:22612ae617a0 87 __data_start__ = .;
lharoon 0:22612ae617a0 88 *(vtable)
lharoon 0:22612ae617a0 89 *(.data*)
lharoon 0:22612ae617a0 90
lharoon 0:22612ae617a0 91 . = ALIGN(4);
lharoon 0:22612ae617a0 92 /* preinit data */
lharoon 0:22612ae617a0 93 PROVIDE (__preinit_array_start = .);
lharoon 0:22612ae617a0 94 KEEP(*(.preinit_array))
lharoon 0:22612ae617a0 95 PROVIDE (__preinit_array_end = .);
lharoon 0:22612ae617a0 96
lharoon 0:22612ae617a0 97 . = ALIGN(4);
lharoon 0:22612ae617a0 98 /* init data */
lharoon 0:22612ae617a0 99 PROVIDE (__init_array_start = .);
lharoon 0:22612ae617a0 100 KEEP(*(SORT(.init_array.*)))
lharoon 0:22612ae617a0 101 KEEP(*(.init_array))
lharoon 0:22612ae617a0 102 PROVIDE (__init_array_end = .);
lharoon 0:22612ae617a0 103
lharoon 0:22612ae617a0 104
lharoon 0:22612ae617a0 105 . = ALIGN(4);
lharoon 0:22612ae617a0 106 /* finit data */
lharoon 0:22612ae617a0 107 PROVIDE (__fini_array_start = .);
lharoon 0:22612ae617a0 108 KEEP(*(SORT(.fini_array.*)))
lharoon 0:22612ae617a0 109 KEEP(*(.fini_array))
lharoon 0:22612ae617a0 110 PROVIDE (__fini_array_end = .);
lharoon 0:22612ae617a0 111
lharoon 0:22612ae617a0 112 . = ALIGN(4);
lharoon 0:22612ae617a0 113 /* All data end */
lharoon 0:22612ae617a0 114 __data_end__ = .;
lharoon 0:22612ae617a0 115
lharoon 0:22612ae617a0 116 } > RAM
lharoon 0:22612ae617a0 117
lharoon 0:22612ae617a0 118 .bss :
lharoon 0:22612ae617a0 119 {
lharoon 0:22612ae617a0 120 __bss_start__ = .;
lharoon 0:22612ae617a0 121 *(.bss*)
lharoon 0:22612ae617a0 122 *(COMMON)
lharoon 0:22612ae617a0 123 __bss_end__ = .;
lharoon 0:22612ae617a0 124 } > RAM
lharoon 0:22612ae617a0 125
lharoon 0:22612ae617a0 126 .heap :
lharoon 0:22612ae617a0 127 {
lharoon 0:22612ae617a0 128 __end__ = .;
lharoon 0:22612ae617a0 129 end = __end__;
lharoon 0:22612ae617a0 130 *(.heap*)
lharoon 0:22612ae617a0 131 __HeapLimit = .;
lharoon 0:22612ae617a0 132 } > RAM
lharoon 0:22612ae617a0 133
lharoon 0:22612ae617a0 134 /* .stack_dummy section doesn't contains any symbols. It is only
lharoon 0:22612ae617a0 135 * used for linker to calculate size of stack sections, and assign
lharoon 0:22612ae617a0 136 * values to stack symbols later */
lharoon 0:22612ae617a0 137 .stack_dummy :
lharoon 0:22612ae617a0 138 {
lharoon 0:22612ae617a0 139 *(.stack)
lharoon 0:22612ae617a0 140 } > RAM
lharoon 0:22612ae617a0 141
lharoon 0:22612ae617a0 142 /* Set stack top to end of RAM, and stack limit move down by
lharoon 0:22612ae617a0 143 * size of stack_dummy section */
lharoon 0:22612ae617a0 144 __StackTop = ORIGIN(RAM) + LENGTH(RAM);
lharoon 0:22612ae617a0 145 __StackLimit = __StackTop - SIZEOF(.stack_dummy);
lharoon 0:22612ae617a0 146 PROVIDE(__stack = __StackTop);
lharoon 0:22612ae617a0 147
lharoon 0:22612ae617a0 148 /* Check if data + heap + stack exceeds RAM limit */
lharoon 0:22612ae617a0 149 ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
lharoon 0:22612ae617a0 150 }