[132f194] | 1 | /* |
---|
| 2 | * This file contains GNU linker directives for a generic MC68340/349 board. |
---|
| 3 | * Variations in hardware type and dynamic memory size can be made |
---|
| 4 | * by overriding some values with linker command-line arguments. |
---|
| 5 | * |
---|
| 6 | * ATTENTION: RAM and ROM placement must accord those in start340.S!! |
---|
| 7 | * (next time I'll use some shared variables :) ) |
---|
| 8 | * |
---|
| 9 | * Geoffroy Montel |
---|
| 10 | * France Telecom - CNET/DSM/TAM/CAT |
---|
| 11 | * 4, rue du Clos Courtel |
---|
| 12 | * 35512 CESSON-SEVIGNE |
---|
| 13 | * FRANCE |
---|
| 14 | * |
---|
| 15 | * e-mail: g_montel@yahoo.com |
---|
| 16 | * |
---|
| 17 | * $Id$ |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | /* |
---|
| 21 | * Declare some sizes. |
---|
| 22 | */ |
---|
[df49c60] | 23 | _RamBase = DEFINED(_RamBase) ? _RamBase : 0x10000000; |
---|
[b8c9883] | 24 | _RamSize = DEFINED(_RamSize) ? _RamSize : 4M; |
---|
| 25 | _HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000; |
---|
| 26 | _StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; |
---|
[132f194] | 27 | |
---|
| 28 | /* |
---|
| 29 | * Declare on-board memory. |
---|
| 30 | * It would be nice if the ram length could be given as |
---|
[b8c9883] | 31 | * LENGTH=_RamSize, but gld doesn't allow non-constant |
---|
[132f194] | 32 | * values in the LENGTH expression. |
---|
| 33 | */ |
---|
| 34 | MEMORY { |
---|
| 35 | ram : ORIGIN = 0x10000000, LENGTH = 4M |
---|
| 36 | rom : ORIGIN = 0x01000000, LENGTH = 4M |
---|
| 37 | /* dpram : ORIGIN = 0xFE000000, LENGTH = 8k */ |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | /* |
---|
| 41 | * Declare low-order three octets of Ethernet address. |
---|
| 42 | */ |
---|
| 43 | ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12; |
---|
| 44 | |
---|
| 45 | /* |
---|
| 46 | * Load objects |
---|
| 47 | */ |
---|
| 48 | SECTIONS { |
---|
| 49 | |
---|
| 50 | /* |
---|
| 51 | * Boot PROM |
---|
| 52 | */ |
---|
| 53 | rom : { |
---|
| 54 | _RomBase = .; |
---|
| 55 | __RomBase = .; |
---|
| 56 | } >rom |
---|
| 57 | |
---|
| 58 | /* |
---|
| 59 | * Dynamic RAM |
---|
| 60 | */ |
---|
| 61 | ram : { |
---|
[b8c9883] | 62 | . = .; |
---|
[132f194] | 63 | } >ram |
---|
| 64 | |
---|
| 65 | /* |
---|
| 66 | * Text, data and bss segments |
---|
| 67 | */ |
---|
| 68 | .text : { |
---|
| 69 | *(.text) |
---|
| 70 | |
---|
| 71 | /* |
---|
[b2b4835] | 72 | * C++ constructors/destructors |
---|
| 73 | */ |
---|
| 74 | *(.gnu.linkonce.t.*) |
---|
| 75 | |
---|
| 76 | /* |
---|
| 77 | * Initialization and finalization code. |
---|
| 78 | * |
---|
| 79 | * Various files can provide initialization and finalization |
---|
| 80 | * functions. crtbegin.o and crtend.o are two instances. The |
---|
| 81 | * body of these functions are in .init and .fini sections. We |
---|
| 82 | * accumulate the bodies here, and prepend function prologues |
---|
| 83 | * from crti.o and function epilogues from crtn.o. crti.o must |
---|
| 84 | * be linked first; crtn.o must be linked last. Because these |
---|
| 85 | * are wildcards, it doesn't matter if the user does not |
---|
| 86 | * actually link against crti.o and crtn.o; the linker won't |
---|
| 87 | * look for a file to match a wildcard. The wildcard also |
---|
| 88 | * means that it doesn't matter which directory crti.o and |
---|
| 89 | * crtn.o are in. |
---|
| 90 | */ |
---|
| 91 | PROVIDE (_init = .); |
---|
| 92 | *crti.o(.init) |
---|
| 93 | *(.init) |
---|
| 94 | *crtn.o(.init) |
---|
| 95 | PROVIDE (_fini = .); |
---|
| 96 | *crti.o(.fini) |
---|
| 97 | *(.fini) |
---|
| 98 | *crtn.o(.fini) |
---|
| 99 | |
---|
| 100 | /* |
---|
| 101 | * C++ constructors/destructors |
---|
| 102 | * |
---|
| 103 | * gcc uses crtbegin.o to find the start of the constructors |
---|
| 104 | * and destructors so we make sure it is first. Because this |
---|
| 105 | * is a wildcard, it doesn't matter if the user does not |
---|
| 106 | * actually link against crtbegin.o; the linker won't look for |
---|
| 107 | * a file to match a wildcard. The wildcard also means that |
---|
| 108 | * it doesn't matter which directory crtbegin.o is in. The |
---|
| 109 | * constructor and destructor list are terminated in |
---|
| 110 | * crtend.o. The same comments apply to it. |
---|
[132f194] | 111 | */ |
---|
[b2b4835] | 112 | . = ALIGN (16); |
---|
| 113 | *crtbegin.o(.ctors) |
---|
[132f194] | 114 | *(.ctors) |
---|
[b2b4835] | 115 | *crtend.o(.ctors) |
---|
| 116 | *crtbegin.o(.dtors) |
---|
[132f194] | 117 | *(.dtors) |
---|
[b2b4835] | 118 | *crtend.o(.dtors) |
---|
[132f194] | 119 | |
---|
[b2b4835] | 120 | /* |
---|
| 121 | * Exception frame info |
---|
| 122 | */ |
---|
[132f194] | 123 | . = ALIGN (16); |
---|
[b2b4835] | 124 | *(.eh_frame) |
---|
[132f194] | 125 | |
---|
[b2b4835] | 126 | /* |
---|
| 127 | * Read-only data |
---|
| 128 | */ |
---|
[132f194] | 129 | . = ALIGN (16); |
---|
[b2b4835] | 130 | _rodata_start = . ; |
---|
| 131 | *(.rodata) |
---|
| 132 | *(.gnu.linkonce.r*) |
---|
[132f194] | 133 | |
---|
[b2b4835] | 134 | . = ALIGN (16); |
---|
| 135 | PROVIDE (_etext = .); |
---|
[132f194] | 136 | } >ram |
---|
| 137 | .data : { |
---|
[b2b4835] | 138 | PROVIDE (_copy_start = .); |
---|
[132f194] | 139 | *(.data) |
---|
[b2b4835] | 140 | *(.gnu.linkonce.d*) |
---|
| 141 | *(.gcc_except_table) |
---|
[132f194] | 142 | . = ALIGN (16); |
---|
[b2b4835] | 143 | PROVIDE (_edata = .); |
---|
| 144 | PROVIDE (_copy_end = .); |
---|
[132f194] | 145 | } >ram |
---|
| 146 | .bss : { |
---|
[b8c9883] | 147 | M68Kvec = .; |
---|
| 148 | . += (256 * 4); |
---|
| 149 | _clear_start = .; |
---|
[132f194] | 150 | *(.bss) |
---|
| 151 | *(COMMON) |
---|
| 152 | . = ALIGN (16); |
---|
[b2b4835] | 153 | PROVIDE (end = .); |
---|
| 154 | |
---|
[b8c9883] | 155 | . += _StackSize; |
---|
[132f194] | 156 | . = ALIGN (16); |
---|
[b8c9883] | 157 | _stack_init = .; |
---|
| 158 | _clear_end = .; |
---|
[132f194] | 159 | |
---|
[b8c9883] | 160 | _WorkspaceBase = .; |
---|
[b2b4835] | 161 | } >ram |
---|
| 162 | |
---|
| 163 | /* |
---|
| 164 | * On-chip memory/peripherals |
---|
| 165 | * |
---|
| 166 | */ |
---|
| 167 | dpram : { |
---|
| 168 | m340 = .; |
---|
| 169 | _m340 = .; |
---|
| 170 | . += (8 * 1024); |
---|
[132f194] | 171 | } >ram |
---|
[b2b4835] | 172 | |
---|
[132f194] | 173 | } |
---|