|
| 1 | +/* Entry Point */ |
| 2 | +ENTRY(Reset_Handler) |
| 3 | + |
| 4 | +/* Generate a link error if heap and stack don't fit into RAM */ |
| 5 | +_Min_Heap_Size = 0x000; /* required amount of heap */ |
| 6 | +_Min_Stack_Size = 0x800; /* required amount of stack */ |
| 7 | + |
| 8 | +/* Specify the memory areas */ |
| 9 | +MEMORY |
| 10 | +{ |
| 11 | + CCMHEAP (rw) : ORIGIN = 0x10004000, LENGTH = 32K |
| 12 | + PATCHRAM (rwx) : ORIGIN = 0x2000c000, LENGTH = 64K /* total RAM is 112kb */ |
| 13 | + EXTRAM (rx) : ORIGIN = 0x68000000, LENGTH = 1M |
| 14 | +} |
| 15 | + |
| 16 | +/* Define output sections */ |
| 17 | +SECTIONS |
| 18 | +{ |
| 19 | + /* The startup code goes first into FLASH */ |
| 20 | + .program_header : |
| 21 | + { |
| 22 | + . = ALIGN(8); |
| 23 | + _startprog = ABSOLUTE(.); /* define a global symbol at program start */ |
| 24 | + KEEP(*(.program_header)) /* Startup code */ |
| 25 | + . = ALIGN(8); |
| 26 | + } >PATCHRAM /* AT>PATCHFLASH */ |
| 27 | + |
| 28 | + /* The program code and other data goes into FLASH */ |
| 29 | + .text : |
| 30 | + { |
| 31 | + . = ALIGN(8); |
| 32 | + _text_start = .; |
| 33 | + *(.text.Reset_Handler) |
| 34 | + *(.text.startup) |
| 35 | + *(.main*) |
| 36 | + *(.text) /* .text sections (code) */ |
| 37 | + *(.text*) /* .text* sections (code) */ |
| 38 | + *(.rodata) /* .rodata sections (constants, strings, etc.) */ |
| 39 | + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ |
| 40 | + *(.glue_7) /* glue arm to thumb code */ |
| 41 | + *(.glue_7t) /* glue thumb to arm code */ |
| 42 | + *(.eh_frame) |
| 43 | + . = ALIGN(8); |
| 44 | + /* These are for static constructors and destructors under ELF */ |
| 45 | + KEEP (*crtbegin.o(.ctors)) |
| 46 | + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) |
| 47 | + KEEP (*(SORT(.ctors.*))) |
| 48 | + KEEP (*crtend.o(.ctors)) |
| 49 | + KEEP (*crtbegin.o(.dtors)) |
| 50 | + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) |
| 51 | + KEEP (*(SORT(.dtors.*))) |
| 52 | + KEEP (*crtend.o(.dtors)) |
| 53 | + KEEP (*(.init)) |
| 54 | + KEEP (*(.fini)) |
| 55 | + . = ALIGN(8); |
| 56 | + _etext = .; /* define a global symbol at end of code */ |
| 57 | + _text_end = .; |
| 58 | + } >PATCHRAM /* AT>PATCHFLASH */ |
| 59 | + |
| 60 | + _text_load = LOADADDR (.text); |
| 61 | + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >PATCHRAM /* AT>PATCHFLASH */ |
| 62 | + .ARM : { |
| 63 | + __exidx_start = .; |
| 64 | + *(.ARM.exidx*) |
| 65 | + __exidx_end = .; |
| 66 | + } >PATCHRAM /* AT>PATCHFLASH */ |
| 67 | + |
| 68 | + .preinit_array : |
| 69 | + { |
| 70 | + PROVIDE_HIDDEN (__preinit_array_start = .); |
| 71 | + KEEP (*(.preinit_array*)) |
| 72 | + PROVIDE_HIDDEN (__preinit_array_end = .); |
| 73 | + } >PATCHRAM /* AT>PATCHFLASH */ |
| 74 | + .init_array : |
| 75 | + { |
| 76 | + PROVIDE_HIDDEN (__init_array_start = .); |
| 77 | + KEEP (*(SORT(.init_array.*))) |
| 78 | + KEEP (*(.init_array*)) |
| 79 | + PROVIDE_HIDDEN (__init_array_end = .); |
| 80 | + } >PATCHRAM /* AT>PATCHFLASH */ |
| 81 | + .fini_array : |
| 82 | + { |
| 83 | + PROVIDE_HIDDEN (__fini_array_start = .); |
| 84 | + KEEP (*(.fini_array*)) |
| 85 | + KEEP (*(SORT(.fini_array.*))) |
| 86 | + PROVIDE_HIDDEN (__fini_array_end = .); |
| 87 | + } >PATCHRAM /* AT>PATCHFLASH */ |
| 88 | + |
| 89 | + /* used by the startup to initialize data */ |
| 90 | + _sidata = .; |
| 91 | + |
| 92 | + /* Initialized data sections goes into RAM, load LMA copy after code */ |
| 93 | + .data : AT ( _sidata ) |
| 94 | + { |
| 95 | + . = ALIGN(8); |
| 96 | + _sdata = .; /* create a global symbol at data start */ |
| 97 | + *(.data) /* .data sections */ |
| 98 | + *(.data*) /* .data* sections */ |
| 99 | + . = ALIGN(8); |
| 100 | + _edata = .; /* define a global symbol at data end */ |
| 101 | + } >PATCHRAM |
| 102 | + |
| 103 | + /* Uninitialized data section */ |
| 104 | + . = ALIGN(8); |
| 105 | + .bss : |
| 106 | + { |
| 107 | + _endprog = ABSOLUTE(.); /* define a global symbol at program end */ |
| 108 | + /* This is used by the startup in order to initialize the .bss secion */ |
| 109 | + _sbss = .; /* define a global symbol at bss start */ |
| 110 | + __bss_start__ = _sbss; |
| 111 | + *(.bss) |
| 112 | + *(.bss*) |
| 113 | + *(COMMON) |
| 114 | + . = ALIGN(8); |
| 115 | + _ebss = .; /* define a global symbol at bss end */ |
| 116 | + __bss_end__ = _ebss; |
| 117 | + } >PATCHRAM |
| 118 | + |
| 119 | + .pv (NOLOAD) : |
| 120 | + { |
| 121 | + . = ALIGN(8); |
| 122 | + _programvector = ABSOLUTE(.); |
| 123 | + *(.pv) |
| 124 | + . = ALIGN(8); |
| 125 | + PROVIDE ( _eprogram = . ); |
| 126 | + PROVIDE ( _stack = . ); |
| 127 | + } >PATCHRAM |
| 128 | + _eram = ORIGIN(PATCHRAM) + 80k; /* Limit to 80k for OwlWare compatiblity */ |
| 129 | + _estack = ORIGIN(PATCHRAM) + 80k; |
| 130 | + |
| 131 | + .fastheap (NOLOAD) : |
| 132 | + { |
| 133 | + . = ALIGN(8); |
| 134 | + PROVIDE ( _fastheap = . ); |
| 135 | + . = ALIGN(8); |
| 136 | + } >CCMHEAP |
| 137 | + _fasteheap = ORIGIN(CCMHEAP) + LENGTH(CCMHEAP); |
| 138 | + |
| 139 | + /* External SRAM, used for heap memory */ |
| 140 | + .extdata (NOLOAD) : |
| 141 | + { |
| 142 | + . = ALIGN(8); |
| 143 | + *(.extdata) |
| 144 | + . = ALIGN(8); |
| 145 | + PROVIDE ( _heap = . ); |
| 146 | + . = . + _Min_Heap_Size; |
| 147 | + } >EXTRAM |
| 148 | + _eheap = ORIGIN(EXTRAM) + LENGTH(EXTRAM); |
| 149 | + |
| 150 | + |
| 151 | + /* Remove information from the standard libraries */ |
| 152 | + /DISCARD/ : |
| 153 | + { |
| 154 | + libc.a ( * ) |
| 155 | + libm.a ( * ) |
| 156 | + libgcc.a ( * ) |
| 157 | + } |
| 158 | + |
| 159 | + .ARM.attributes 0 : { *(.ARM.attributes) } |
| 160 | +} |
0 commit comments