[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 | * XXX: The assignment of ". += XyzSize;" fails in older gld's if the |
---|
| 28 | * number used there is not constant. If this happens to you, edit |
---|
| 29 | * the lines marked XXX below to use a constant value. |
---|
| 30 | */ |
---|
| 31 | RamSize = DEFINED(RamSize) ? RamSize : 4M; |
---|
| 32 | HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000; |
---|
| 33 | StackSize = DEFINED(StackSize) ? StackSize : 0x1000; |
---|
| 34 | |
---|
| 35 | /* |
---|
| 36 | * Declare on-board memory. |
---|
| 37 | * It would be nice if the ram length could be given as |
---|
| 38 | * LENGTH=RamSize, but gld doesn't allow non-constant |
---|
| 39 | * values in the LENGTH expression. |
---|
| 40 | */ |
---|
| 41 | MEMORY { |
---|
| 42 | ram : ORIGIN = 0x10000000, LENGTH = 4M |
---|
| 43 | rom : ORIGIN = 0x01000000, LENGTH = 4M |
---|
| 44 | /* dpram : ORIGIN = 0xFE000000, LENGTH = 8k */ |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | /* |
---|
| 48 | * Declare low-order three octets of Ethernet address. |
---|
| 49 | */ |
---|
| 50 | ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12; |
---|
| 51 | |
---|
| 52 | /* |
---|
| 53 | * Load objects |
---|
| 54 | */ |
---|
| 55 | SECTIONS { |
---|
| 56 | /* |
---|
| 57 | * Hardware variations |
---|
| 58 | */ |
---|
| 59 | _RamSize = RamSize; |
---|
| 60 | __RamSize = RamSize; |
---|
| 61 | |
---|
| 62 | /* |
---|
| 63 | * Boot PROM |
---|
| 64 | */ |
---|
| 65 | rom : { |
---|
| 66 | _RomBase = .; |
---|
| 67 | __RomBase = .; |
---|
| 68 | } >rom |
---|
| 69 | |
---|
| 70 | /* |
---|
| 71 | * Dynamic RAM |
---|
| 72 | */ |
---|
| 73 | ram : { |
---|
| 74 | _RamBase = .; |
---|
| 75 | __RamBase = .; |
---|
| 76 | } >ram |
---|
| 77 | |
---|
| 78 | /* |
---|
| 79 | * Text, data and bss segments |
---|
| 80 | */ |
---|
| 81 | .text : { |
---|
| 82 | CREATE_OBJECT_SYMBOLS |
---|
| 83 | *(.text) |
---|
| 84 | . = ALIGN (16); |
---|
| 85 | |
---|
| 86 | /* |
---|
| 87 | * C++ constructors |
---|
| 88 | */ |
---|
| 89 | __CTOR_LIST__ = .; |
---|
| 90 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) |
---|
| 91 | *(.ctors) |
---|
| 92 | LONG(0) |
---|
| 93 | __CTOR_END__ = .; |
---|
| 94 | __DTOR_LIST__ = .; |
---|
| 95 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) |
---|
| 96 | *(.dtors) |
---|
| 97 | LONG(0) |
---|
| 98 | __DTOR_END__ = .; |
---|
| 99 | |
---|
| 100 | etext = .; |
---|
| 101 | _etext = .; |
---|
| 102 | } >rom |
---|
| 103 | |
---|
| 104 | .eh_fram : { |
---|
| 105 | . = ALIGN (16); |
---|
| 106 | *(.eh_fram) |
---|
| 107 | } >ram |
---|
| 108 | |
---|
| 109 | .gcc_exc : { |
---|
| 110 | . = ALIGN (16); |
---|
| 111 | *(.gcc_exc) |
---|
| 112 | } >ram |
---|
| 113 | |
---|
| 114 | /* |
---|
| 115 | * On-chip memory/peripherals |
---|
| 116 | * |
---|
| 117 | */ |
---|
| 118 | dpram : { |
---|
| 119 | m340 = .; |
---|
| 120 | _m340 = .; |
---|
| 121 | . += (8 * 1024); |
---|
| 122 | } >ram |
---|
| 123 | |
---|
| 124 | .data : { |
---|
| 125 | copy_start = .; |
---|
| 126 | *(.data) |
---|
| 127 | . = ALIGN (16); |
---|
| 128 | _edata = .; |
---|
| 129 | copy_end = .; |
---|
| 130 | } >ram |
---|
| 131 | |
---|
| 132 | .bss : { |
---|
| 133 | M68Kvec = .; |
---|
| 134 | _M68Kvec = .; |
---|
| 135 | . += (256 * 4); |
---|
| 136 | clear_start = .; |
---|
| 137 | *(.bss) |
---|
| 138 | *(COMMON) |
---|
| 139 | . = ALIGN (16); |
---|
| 140 | _end = .; |
---|
| 141 | |
---|
| 142 | _HeapStart = .; |
---|
| 143 | __HeapStart = .; |
---|
| 144 | . += HeapSize; /* XXX -- Old gld can't handle this */ |
---|
| 145 | . += StackSize; /* XXX -- Old gld can't handle this */ |
---|
| 146 | /* . += 0x10000; */ /* HeapSize for old gld */ |
---|
| 147 | /* . += 0x1000; */ /* StackSize for old gld */ |
---|
| 148 | . = ALIGN (16); |
---|
| 149 | stack_init = .; |
---|
| 150 | clear_end = .; |
---|
| 151 | |
---|
| 152 | _WorkspaceBase = .; |
---|
| 153 | __WorkspaceBase = .; |
---|
| 154 | } >ram |
---|
| 155 | } |
---|