| 1 | OUTPUT_ARCH(sh) |
| 2 | EXTERN (_start) |
| 3 | ENTRY (_start) |
| 4 | __DYNAMIC = 0; |
| 5 | |
| 6 | /* |
| 7 | * The memory map look like this: |
| 8 | * +--------------------+ <- 0x06000000 |
| 9 | * | .text | |
| 10 | * | | |
| 11 | * | __text_end | |
| 12 | * +--------------------+ |
| 13 | * . . |
| 14 | * . . |
| 15 | * . . |
| 16 | * +--------------------+ |
| 17 | * | .data | initialized data goes here |
| 18 | * | | |
| 19 | * | __data_end | |
| 20 | * +--------------------+ |
| 21 | * | .bss | |
| 22 | * | __bss_start | start of bss, cleared by crt0 |
| 23 | * | | |
| 24 | * | __bss__end | start of heap, used by sbrk() |
| 25 | * +--------------------+ |
| 26 | * . . |
| 27 | * . . |
| 28 | * . . |
| 29 | * | __stack | top of stack (for Master SH2) |
| 30 | * +--------------------+ <- 0x0603FC00 |
| 31 | */ |
| 32 | |
| 33 | MEMORY |
| 34 | { |
| 35 | rom (rx) : ORIGIN = 0x02000000, LENGTH = 0x00400000 |
| 36 | ram (wx) : ORIGIN = 0x06000000, LENGTH = 0x0003FC00 |
| 37 | } |
| 38 | |
| 39 | /* |
| 40 | * Allocate the stack to be at the top of memory, since the stack |
| 41 | * grows down |
| 42 | */ |
| 43 | |
| 44 | PROVIDE (__stack = 0x0603FC00); |
| 45 | |
| 46 | SECTIONS |
| 47 | { |
| 48 | /* .text 0x02000000 : */ |
| 49 | .text 0x06000000 : |
| 50 | AT ( 0x00000000 ) |
| 51 | { |
| 52 | __text_start = .; |
| 53 | *(.text) |
| 54 | *(.text.*) |
| 55 | *(.gnu.linkonce.t.*) |
| 56 | |
| 57 | . = ALIGN(16); |
| 58 | __INIT_SECTION__ = .; |
| 59 | KEEP (*(.init)) |
| 60 | SHORT (0x000B) /* rts */ |
| 61 | SHORT (0x0009) /* nop */ |
| 62 | . = ALIGN(16); |
| 63 | __FINI_SECTION__ = .; |
| 64 | KEEP (*(.fini)) |
| 65 | SHORT (0x000B) /* rts */ |
| 66 | SHORT (0x0009) /* nop */ |
| 67 | |
| 68 | *(.eh_frame_hdr) |
| 69 | KEEP (*(.eh_frame)) |
| 70 | *(.gcc_except_table) |
| 71 | KEEP (*(.jcr)) |
| 72 | |
| 73 | . = ALIGN(16); |
| 74 | __CTOR_LIST__ = .; |
| 75 | ___CTOR_LIST__ = .; |
| 76 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) |
| 77 | KEEP (*(SORT(.ctors.*))) |
| 78 | KEEP (*(.ctors)) |
| 79 | LONG(0) |
| 80 | __CTOR_END__ = .; |
| 81 | |
| 82 | . = ALIGN(16); |
| 83 | __DTOR_LIST__ = .; |
| 84 | ___DTOR_LIST__ = .; |
| 85 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) |
| 86 | KEEP (*(SORT(.dtors.*))) |
| 87 | KEEP (*(.dtors)) |
| 88 | LONG(0) |
| 89 | __DTOR_END__ = .; |
| 90 | |
| 91 | *(.rdata) |
| 92 | *(.rodata) |
| 93 | *(.rodata.*) |
| 94 | *(.gnu.linkonce.r.*) |
| 95 | . = ALIGN(16); |
| 96 | __text_end = .; |
| 97 | /* |
| 98 | } > rom |
| 99 | __text_size = __text_end - __text_start; |
| 100 | |
| 101 | .data 0x06000000 : |
| 102 | AT ( LOADADDR (.text) + SIZEOF (.text) ) |
| 103 | { |
| 104 | */ |
| 105 | __data_start = .; |
| 106 | *(.data) |
| 107 | *(.data.*) |
| 108 | *(.gnu.linkonce.d.*) |
| 109 | CONSTRUCTORS |
| 110 | |
| 111 | *(.lit8) |
| 112 | *(.lit4) |
| 113 | *(.sdata) |
| 114 | *(.sdata.*) |
| 115 | *(.gnu.linkonce.s.*) |
| 116 | . = ALIGN(16); |
| 117 | __data_end = .; |
| 118 | } > ram |
| 119 | __data_size = __data_end - __data_start; |
| 120 | |
| 121 | .bss : |
| 122 | { |
| 123 | __bss_start = .; |
| 124 | *(.bss) |
| 125 | *(.bss.*) |
| 126 | *(.gnu.linkonce.b.*) |
| 127 | *(.sbss) |
| 128 | *(.sbss.*) |
| 129 | *(.gnu.linkonce.sb.*) |
| 130 | *(.scommon) |
| 131 | *(COMMON) |
| 132 | . = ALIGN(16); |
| 133 | end = .; |
| 134 | _end = end; |
| 135 | __end = _end; |
| 136 | __bss_end = .; |
| 137 | } > ram |
| 138 | __bss_size = __bss_end - __bss_start; |
| 139 | |
| 140 | } |