[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 | * a.out format doesn't handle prom images very well |
---|
| 22 | */ |
---|
| 23 | OUTPUT_FORMAT(coff-m68k) |
---|
| 24 | |
---|
| 25 | /* |
---|
| 26 | * Declare some sizes. |
---|
| 27 | */ |
---|
| 28 | RamSize = DEFINED(RamSize) ? RamSize : 4M; |
---|
| 29 | HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000; |
---|
| 30 | StackSize = DEFINED(StackSize) ? StackSize : 0x1000; |
---|
| 31 | |
---|
| 32 | /* |
---|
| 33 | * Declare on-board memory. |
---|
| 34 | * It would be nice if the ram length could be given as |
---|
| 35 | * LENGTH=RamSize, but gld doesn't allow non-constant |
---|
| 36 | * values in the LENGTH expression. |
---|
| 37 | */ |
---|
| 38 | MEMORY { |
---|
| 39 | ram : ORIGIN = 0x10000000, LENGTH = 4M |
---|
| 40 | rom : ORIGIN = 0x01000000, LENGTH = 4M |
---|
| 41 | /* dpram : ORIGIN = 0xFE000000, LENGTH = 8k */ |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | /* |
---|
| 45 | * Declare low-order three octets of Ethernet address. |
---|
| 46 | */ |
---|
| 47 | ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12; |
---|
| 48 | |
---|
| 49 | /* |
---|
| 50 | * Load objects |
---|
| 51 | */ |
---|
| 52 | SECTIONS { |
---|
| 53 | /* |
---|
| 54 | * Hardware variations |
---|
| 55 | */ |
---|
| 56 | _RamSize = RamSize; |
---|
| 57 | __RamSize = RamSize; |
---|
| 58 | |
---|
| 59 | /* |
---|
| 60 | * Boot PROM |
---|
| 61 | */ |
---|
| 62 | rom : { |
---|
| 63 | _RomBase = .; |
---|
| 64 | __RomBase = .; |
---|
| 65 | } >rom |
---|
| 66 | |
---|
| 67 | /* |
---|
| 68 | * Dynamic RAM |
---|
| 69 | */ |
---|
| 70 | ram : { |
---|
| 71 | _RamBase = .; |
---|
| 72 | __RamBase = .; |
---|
| 73 | } >ram |
---|
| 74 | |
---|
| 75 | /* |
---|
| 76 | * Text, data and bss segments |
---|
| 77 | */ |
---|
| 78 | .text : { |
---|
| 79 | *(.text) |
---|
| 80 | |
---|
| 81 | /* |
---|
[b2b4835] | 82 | * C++ constructors/destructors |
---|
| 83 | */ |
---|
| 84 | *(.gnu.linkonce.t.*) |
---|
| 85 | |
---|
| 86 | /* |
---|
| 87 | * Initialization and finalization code. |
---|
| 88 | * |
---|
| 89 | * Various files can provide initialization and finalization |
---|
| 90 | * functions. crtbegin.o and crtend.o are two instances. The |
---|
| 91 | * body of these functions are in .init and .fini sections. We |
---|
| 92 | * accumulate the bodies here, and prepend function prologues |
---|
| 93 | * from crti.o and function epilogues from crtn.o. crti.o must |
---|
| 94 | * be linked first; crtn.o must be linked last. Because these |
---|
| 95 | * are wildcards, it doesn't matter if the user does not |
---|
| 96 | * actually link against crti.o and crtn.o; the linker won't |
---|
| 97 | * look for a file to match a wildcard. The wildcard also |
---|
| 98 | * means that it doesn't matter which directory crti.o and |
---|
| 99 | * crtn.o are in. |
---|
| 100 | */ |
---|
| 101 | PROVIDE (_init = .); |
---|
| 102 | *crti.o(.init) |
---|
| 103 | *(.init) |
---|
| 104 | *crtn.o(.init) |
---|
| 105 | PROVIDE (_fini = .); |
---|
| 106 | *crti.o(.fini) |
---|
| 107 | *(.fini) |
---|
| 108 | *crtn.o(.fini) |
---|
| 109 | |
---|
| 110 | /* |
---|
| 111 | * C++ constructors/destructors |
---|
| 112 | * |
---|
| 113 | * gcc uses crtbegin.o to find the start of the constructors |
---|
| 114 | * and destructors so we make sure it is first. Because this |
---|
| 115 | * is a wildcard, it doesn't matter if the user does not |
---|
| 116 | * actually link against crtbegin.o; the linker won't look for |
---|
| 117 | * a file to match a wildcard. The wildcard also means that |
---|
| 118 | * it doesn't matter which directory crtbegin.o is in. The |
---|
| 119 | * constructor and destructor list are terminated in |
---|
| 120 | * crtend.o. The same comments apply to it. |
---|
[132f194] | 121 | */ |
---|
[b2b4835] | 122 | . = ALIGN (16); |
---|
| 123 | *crtbegin.o(.ctors) |
---|
[132f194] | 124 | *(.ctors) |
---|
[b2b4835] | 125 | *crtend.o(.ctors) |
---|
| 126 | *crtbegin.o(.dtors) |
---|
[132f194] | 127 | *(.dtors) |
---|
[b2b4835] | 128 | *crtend.o(.dtors) |
---|
[132f194] | 129 | |
---|
[b2b4835] | 130 | /* |
---|
| 131 | * Exception frame info |
---|
| 132 | */ |
---|
[132f194] | 133 | . = ALIGN (16); |
---|
[b2b4835] | 134 | *(.eh_frame) |
---|
[132f194] | 135 | |
---|
[b2b4835] | 136 | /* |
---|
| 137 | * Read-only data |
---|
| 138 | */ |
---|
[132f194] | 139 | . = ALIGN (16); |
---|
[b2b4835] | 140 | _rodata_start = . ; |
---|
| 141 | *(.rodata) |
---|
| 142 | *(.gnu.linkonce.r*) |
---|
[132f194] | 143 | |
---|
[b2b4835] | 144 | . = ALIGN (16); |
---|
| 145 | PROVIDE (_etext = .); |
---|
[132f194] | 146 | } >ram |
---|
| 147 | .data : { |
---|
[b2b4835] | 148 | PROVIDE (_copy_start = .); |
---|
[132f194] | 149 | *(.data) |
---|
[b2b4835] | 150 | *(.gnu.linkonce.d*) |
---|
| 151 | *(.gcc_except_table) |
---|
[132f194] | 152 | . = ALIGN (16); |
---|
[b2b4835] | 153 | PROVIDE (_edata = .); |
---|
| 154 | PROVIDE (_copy_end = .); |
---|
[132f194] | 155 | } >ram |
---|
| 156 | .bss : { |
---|
[b2b4835] | 157 | M68Kvec = .; |
---|
| 158 | _M68Kvec = .; |
---|
| 159 | . += (256 * 4); |
---|
| 160 | PROVIDE (_bss_start = .); |
---|
| 161 | PROVIDE (_clear_start = .); |
---|
[132f194] | 162 | *(.bss) |
---|
| 163 | *(COMMON) |
---|
| 164 | . = ALIGN (16); |
---|
[b2b4835] | 165 | PROVIDE (end = .); |
---|
| 166 | |
---|
| 167 | . += StackSize; |
---|
| 168 | PROVIDE (_stack_init = .); |
---|
| 169 | |
---|
[132f194] | 170 | . = ALIGN (16); |
---|
[b2b4835] | 171 | PROVIDE (_HeapStart = .); |
---|
| 172 | . += HeapSize; |
---|
| 173 | PROVIDE (_HeapEnd = .); |
---|
| 174 | |
---|
[9b2c969] | 175 | PROVIDE (_clear_end = .); |
---|
[132f194] | 176 | |
---|
[b2b4835] | 177 | PROVIDE (_WorkspaceBase = .); |
---|
| 178 | } >ram |
---|
| 179 | |
---|
| 180 | /* |
---|
| 181 | * On-chip memory/peripherals |
---|
| 182 | * |
---|
| 183 | */ |
---|
| 184 | dpram : { |
---|
| 185 | m340 = .; |
---|
| 186 | _m340 = .; |
---|
| 187 | . += (8 * 1024); |
---|
[132f194] | 188 | } >ram |
---|
[b2b4835] | 189 | |
---|
[132f194] | 190 | } |
---|