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 OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
lharoon 0:22612ae617a0 2 OUTPUT_ARCH(arm)
lharoon 0:22612ae617a0 3 ENTRY(vectors)
lharoon 0:22612ae617a0 4
lharoon 0:22612ae617a0 5 GROUP(-lsupc++ -lm -lc -lgcc)
lharoon 0:22612ae617a0 6
lharoon 0:22612ae617a0 7 /* Memory Definitions: */
lharoon 0:22612ae617a0 8 MEMORY
lharoon 0:22612ae617a0 9 {
lharoon 0:22612ae617a0 10 Flash (rx) : ORIGIN = 0x00000000, LENGTH = 512k
lharoon 0:22612ae617a0 11 Ram (rwx) : ORIGIN = 0x40000000, LENGTH = 32k
lharoon 0:22612ae617a0 12 UsbRam (rw) : ORIGIN = 0x7FD00000, LENGTH = 8k
lharoon 0:22612ae617a0 13 EthRam (rw) : ORIGIN = 0x7FE00000, LENGTH = 16k
lharoon 0:22612ae617a0 14 CanRam (rw) : ORIGIN = 0xE0038000, LENGTH = 2k
lharoon 0:22612ae617a0 15 BatRam (rw) : ORIGIN = 0xE0084000, LENGTH = 2k
lharoon 0:22612ae617a0 16 }
lharoon 0:22612ae617a0 17
lharoon 0:22612ae617a0 18 /* Stack sizes: */
lharoon 0:22612ae617a0 19 UND_Stack_Size = 16;
lharoon 0:22612ae617a0 20 SVC_Stack_Size = 512;
lharoon 0:22612ae617a0 21 ABT_Stack_Size = 16;
lharoon 0:22612ae617a0 22 FIQ_Stack_Size = 16;
lharoon 0:22612ae617a0 23 IRQ_Stack_Size = 256;
lharoon 0:22612ae617a0 24 Stack_Size_Total = UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + FIQ_Stack_Size + IRQ_Stack_Size;
lharoon 0:22612ae617a0 25
lharoon 0:22612ae617a0 26 /* Stack tops for each mode: */
lharoon 0:22612ae617a0 27 __und_stack_top__ = __stacks_top__;
lharoon 0:22612ae617a0 28 __abt_stack_top__ = __und_stack_top__ - UND_Stack_Size ;
lharoon 0:22612ae617a0 29 __fiq_stack_top__ = __abt_stack_top__ - ABT_Stack_Size ;
lharoon 0:22612ae617a0 30 __irq_stack_top__ = __fiq_stack_top__ - FIQ_Stack_Size ;
lharoon 0:22612ae617a0 31 __svc_stack_top__ = __irq_stack_top__ - IRQ_Stack_Size ;
lharoon 0:22612ae617a0 32
lharoon 0:22612ae617a0 33 /* C-accessible symbols for memory address ranges: */
lharoon 0:22612ae617a0 34 __FLASH_segment_start__ = ORIGIN( Flash );
lharoon 0:22612ae617a0 35 __FLASH_segment_end__ = ORIGIN( Flash ) + LENGTH( Flash );
lharoon 0:22612ae617a0 36 __SRAM_segment_start__ = ORIGIN( Ram );
lharoon 0:22612ae617a0 37 __SRAM_segment_end__ = ORIGIN( Ram ) + LENGTH( Ram );
lharoon 0:22612ae617a0 38
lharoon 0:22612ae617a0 39 /* Stacks (full descending) at top of RAM, grows downward:
lharoon 0:22612ae617a0 40 *
lharoon 0:22612ae617a0 41 * __stack_min__ is used by the malloc implementation to ensure heap never collides
lharoon 0:22612ae617a0 42 * with stack (assuming stack never grows beyond Stack_Size_Total in length) */
lharoon 0:22612ae617a0 43 __stacks_top__ = __SRAM_segment_end__;
lharoon 0:22612ae617a0 44 __stacks_min__ = __SRAM_segment_end__ - Stack_Size_Total;
lharoon 0:22612ae617a0 45
lharoon 0:22612ae617a0 46 SECTIONS
lharoon 0:22612ae617a0 47 {
lharoon 0:22612ae617a0 48 /* first section is .text which is used for code */
lharoon 0:22612ae617a0 49 __text_start__ = . ;
lharoon 0:22612ae617a0 50 .text : {
lharoon 0:22612ae617a0 51 __privileged_code_start__ = . ;
lharoon 0:22612ae617a0 52 KEEP( *( .vectors ) )
lharoon 0:22612ae617a0 53 *( .privileged_code )
lharoon 0:22612ae617a0 54
lharoon 0:22612ae617a0 55 __privileged_code_end__ = .;
lharoon 0:22612ae617a0 56
lharoon 0:22612ae617a0 57 *( .text .text.* .gnu.linkonce.t.* )
lharoon 0:22612ae617a0 58 *( .plt )
lharoon 0:22612ae617a0 59 *( .gnu.warning )
lharoon 0:22612ae617a0 60 *( .glue_7t ) *( .glue_7 ) *( .vfp11_veneer )
lharoon 0:22612ae617a0 61
lharoon 0:22612ae617a0 62 *( .rodata .rodata.* .gnu.linkonce.r.* )
lharoon 0:22612ae617a0 63
lharoon 0:22612ae617a0 64 *(.ARM.extab* .gnu.linkonce.armextab.*)
lharoon 0:22612ae617a0 65 *(.gcc_except_table)
lharoon 0:22612ae617a0 66 *(.eh_frame_hdr)
lharoon 0:22612ae617a0 67 *(.eh_frame)
lharoon 0:22612ae617a0 68
lharoon 0:22612ae617a0 69 . = ALIGN( 4 ) ;
lharoon 0:22612ae617a0 70 KEEP( *( .init ) )
lharoon 0:22612ae617a0 71 . = ALIGN( 4 ) ;
lharoon 0:22612ae617a0 72 __preinit_array_start = . ;
lharoon 0:22612ae617a0 73 KEEP( *( .preinit_array ) )
lharoon 0:22612ae617a0 74 __preinit_array_end = . ;
lharoon 0:22612ae617a0 75 . = ALIGN( 4 ) ;
lharoon 0:22612ae617a0 76 __init_array_start = . ;
lharoon 0:22612ae617a0 77 KEEP( *( SORT( .init_array.* ) ) )
lharoon 0:22612ae617a0 78 KEEP( *( .init_array ) )
lharoon 0:22612ae617a0 79 __init_array_end = . ;
lharoon 0:22612ae617a0 80
lharoon 0:22612ae617a0 81 . = ALIGN( 4 ) ;
lharoon 0:22612ae617a0 82 KEEP( *crtbegin.o( .ctors ) )
lharoon 0:22612ae617a0 83 KEEP( *( EXCLUDE_FILE( *crtend.o ) .ctors ) )
lharoon 0:22612ae617a0 84 KEEP( *( SORT( .ctors.* ) ) )
lharoon 0:22612ae617a0 85 KEEP( *crtend.o( .ctors ) )
lharoon 0:22612ae617a0 86
lharoon 0:22612ae617a0 87 . = ALIGN( 4 ) ;
lharoon 0:22612ae617a0 88 KEEP( *( .fini ) )
lharoon 0:22612ae617a0 89 . = ALIGN( 4 ) ;
lharoon 0:22612ae617a0 90 __fini_array_start = . ;
lharoon 0:22612ae617a0 91 KEEP( *( .fini_array ) )
lharoon 0:22612ae617a0 92 KEEP( *( SORT( .fini_array.* ) ) )
lharoon 0:22612ae617a0 93 __fini_array_end = . ;
lharoon 0:22612ae617a0 94
lharoon 0:22612ae617a0 95 KEEP( *crtbegin.o( .dtors ) )
lharoon 0:22612ae617a0 96 KEEP( *( EXCLUDE_FILE( *crtend.o ) .dtors ) )
lharoon 0:22612ae617a0 97 KEEP( *( SORT( .dtors.* ) ) )
lharoon 0:22612ae617a0 98 KEEP( *crtend.o( .dtors ) )
lharoon 0:22612ae617a0 99
lharoon 0:22612ae617a0 100 } >Flash
lharoon 0:22612ae617a0 101
lharoon 0:22612ae617a0 102 __exidx_start = . ;
lharoon 0:22612ae617a0 103 .ARM.exidx : {
lharoon 0:22612ae617a0 104 *( .ARM.exidx* .gnu.linkonce.armexidx.* )
lharoon 0:22612ae617a0 105 } >Flash
lharoon 0:22612ae617a0 106 __exidx_end = . ;
lharoon 0:22612ae617a0 107
lharoon 0:22612ae617a0 108 .text.align : { . = ALIGN( 8 ) ; } >Flash /* Alignment schenanigans */
lharoon 0:22612ae617a0 109 __text_end__ = . ;
lharoon 0:22612ae617a0 110
lharoon 0:22612ae617a0 111 /* .bss section -- used for uninitialized data */
lharoon 0:22612ae617a0 112 /* Located at the start of RAM */
lharoon 0:22612ae617a0 113 .bss (NOLOAD) : {
lharoon 0:22612ae617a0 114 __bss_start__ = . ;
lharoon 0:22612ae617a0 115 *crt0.o( .ram_vectors )
lharoon 0:22612ae617a0 116
lharoon 0:22612ae617a0 117 __user_bss_start__ = . ;
lharoon 0:22612ae617a0 118 *( .user_bss )
lharoon 0:22612ae617a0 119 __user_bss_end__ = . ;
lharoon 0:22612ae617a0 120
lharoon 0:22612ae617a0 121 *( .shbss )
lharoon 0:22612ae617a0 122 *( .bss .bss.* .gnu.linkonce.b.* )
lharoon 0:22612ae617a0 123 *( COMMON )
lharoon 0:22612ae617a0 124 *( .ram.b )
lharoon 0:22612ae617a0 125 . = ALIGN( 8 ) ;
lharoon 0:22612ae617a0 126
lharoon 0:22612ae617a0 127 __bss_end__ = . ;
lharoon 0:22612ae617a0 128 } >Ram AT>Flash
lharoon 0:22612ae617a0 129
lharoon 0:22612ae617a0 130 /* .data section -- used for initialized data */
lharoon 0:22612ae617a0 131 .data : {
lharoon 0:22612ae617a0 132 __data_start__ = . ;
lharoon 0:22612ae617a0 133 KEEP( *( .jcr ) )
lharoon 0:22612ae617a0 134 *( .got.plt ) *( .got )
lharoon 0:22612ae617a0 135 *( .shdata )
lharoon 0:22612ae617a0 136 *( .data .data.* .gnu.linkonce.d.* )
lharoon 0:22612ae617a0 137 *( .ram )
lharoon 0:22612ae617a0 138 . = ALIGN( 8 ) ;
lharoon 0:22612ae617a0 139 __data_end__ = . ;
lharoon 0:22612ae617a0 140 } >Ram AT>Flash
lharoon 0:22612ae617a0 141
lharoon 0:22612ae617a0 142 __data_init_start__ = LOADADDR( .data ) ;
lharoon 0:22612ae617a0 143
lharoon 0:22612ae617a0 144 /* Heap starts here and grows up in memory */
lharoon 0:22612ae617a0 145 . = ALIGN( 8 ) ;
lharoon 0:22612ae617a0 146 __heap_start__ = . ;
lharoon 0:22612ae617a0 147
lharoon 0:22612ae617a0 148 .stab 0 (NOLOAD) : { *(.stab) }
lharoon 0:22612ae617a0 149 .stabstr 0 (NOLOAD) : { *(.stabstr) }
lharoon 0:22612ae617a0 150 /* DWARF debug sections. */
lharoon 0:22612ae617a0 151 /* Symbols in the DWARF debugging sections are relative to the */
lharoon 0:22612ae617a0 152 /* beginning of the section so we begin them at 0. */
lharoon 0:22612ae617a0 153 /* DWARF 1 */
lharoon 0:22612ae617a0 154 .debug 0 : { *(.debug) }
lharoon 0:22612ae617a0 155 .line 0 : { *(.line) }
lharoon 0:22612ae617a0 156 /* GNU DWARF 1 extensions */
lharoon 0:22612ae617a0 157 .debug_srcinfo 0 : { *(.debug_srcinfo) }
lharoon 0:22612ae617a0 158 .debug_sfnames 0 : { *(.debug_sfnames) }
lharoon 0:22612ae617a0 159 /* DWARF 1.1 and DWARF 2 */
lharoon 0:22612ae617a0 160 .debug_aranges 0 : { *(.debug_aranges) }
lharoon 0:22612ae617a0 161 .debug_pubnames 0 : { *(.debug_pubnames) }
lharoon 0:22612ae617a0 162 /* DWARF 2 */
lharoon 0:22612ae617a0 163 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
lharoon 0:22612ae617a0 164 .debug_abbrev 0 : { *(.debug_abbrev) }
lharoon 0:22612ae617a0 165 .debug_line 0 : { *(.debug_line) }
lharoon 0:22612ae617a0 166 .debug_frame 0 : { *(.debug_frame) }
lharoon 0:22612ae617a0 167 .debug_str 0 : { *(.debug_str) }
lharoon 0:22612ae617a0 168 .debug_loc 0 : { *(.debug_loc) }
lharoon 0:22612ae617a0 169 .debug_macinfo 0 : { *(.debug_macinfo) }
lharoon 0:22612ae617a0 170 /* SGI/MIPS DWARF 2 extensions */
lharoon 0:22612ae617a0 171 .debug_weaknames 0 : { *(.debug_weaknames) }
lharoon 0:22612ae617a0 172 .debug_funcnames 0 : { *(.debug_funcnames) }
lharoon 0:22612ae617a0 173 .debug_typenames 0 : { *(.debug_typenames) }
lharoon 0:22612ae617a0 174 .debug_varnames 0 : { *(.debug_varnames) }
lharoon 0:22612ae617a0 175 /* DWARF 3 */
lharoon 0:22612ae617a0 176 .debug_pubtypes 0 : { *(.debug_pubtypes) }
lharoon 0:22612ae617a0 177 .debug_ranges 0 : { *(.debug_ranges) }
lharoon 0:22612ae617a0 178
lharoon 0:22612ae617a0 179 .note.gnu.arm.ident 0 : { KEEP( *( .note.gnu.arm.ident ) ) }
lharoon 0:22612ae617a0 180 .ARM.attributes 0 : {
lharoon 0:22612ae617a0 181 KEEP( *( .ARM.attributes ) )
lharoon 0:22612ae617a0 182 KEEP( *( .gnu.attributes ) )
lharoon 0:22612ae617a0 183 }
lharoon 0:22612ae617a0 184 /DISCARD/ : { *( .note.GNU-stack ) }
lharoon 0:22612ae617a0 185
lharoon 0:22612ae617a0 186 /* C data can be defined as being in special purpose RAMs using
lharoon 0:22612ae617a0 187 * __attribute__ ((section ("ethram"))) for example. */
lharoon 0:22612ae617a0 188 .usbram (NOLOAD):
lharoon 0:22612ae617a0 189 {
lharoon 0:22612ae617a0 190 *( .usbram )
lharoon 0:22612ae617a0 191 *( .usbram.* )
lharoon 0:22612ae617a0 192 } > UsbRam
lharoon 0:22612ae617a0 193 .ethram (NOLOAD):
lharoon 0:22612ae617a0 194 {
lharoon 0:22612ae617a0 195 *( .ethram )
lharoon 0:22612ae617a0 196 *( .ethram.* )
lharoon 0:22612ae617a0 197 } > EthRam
lharoon 0:22612ae617a0 198 .canram (NOLOAD):
lharoon 0:22612ae617a0 199 {
lharoon 0:22612ae617a0 200 *( .canram )
lharoon 0:22612ae617a0 201 *( .canram.* )
lharoon 0:22612ae617a0 202 } > CanRam
lharoon 0:22612ae617a0 203 .batram (NOLOAD):
lharoon 0:22612ae617a0 204 {
lharoon 0:22612ae617a0 205 *( .batram )
lharoon 0:22612ae617a0 206 *( .batram.* )
lharoon 0:22612ae617a0 207 } > BatRam
lharoon 0:22612ae617a0 208 }