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