Welcome to mirror list, hosted at ThFree Co, Russian Federation.

fido.sc « m68k « libgloss - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9b80b508001f0b566acd28b954307f3cef131737 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
SRAM_ORIGIN=0x03000000
SRAM_LENGTH=0x00100000

# HEAPEND must be in the same memory region as DATA.  STACK should be
# above HEAPEND, also in the same region, for configurations which
# need __stack.

case $MODE in
    rom)
	CRT0=rom
	TEXT=rom
	DATA=sram
	DATALOAD="rom"
	STACK=0x030ffffc
	HEAPEND=0x03080000
	;;
    sram)
	CRT0=ram
	TEXT=sram
	DATA=sdram
	STACK=0x021ffffc
	HEAPEND=0x02180000
	# Leave the rest of SDRAM for manual use.
	;;
    sdram)
	CRT0=ram
	TEXT=sdram
	DATA=sdram
	STACK=0x021ffffc
	HEAPEND=0x02180000
	# Leave the rest of SDRAM for manual use.
	;;
    redboot)
	CRT0=redboot
	# We need to avoid the area used by RedBoot
	SRAM_ORIGIN=0x3080000
	SRAM_LENGTH=0x80000
	# Put code for RedBoot apps in SRAM, since the fido1100 has
	# trouble running code from SDRAM.
	TEXT=sram
	DATA=sdram
	STACK=0
	HEAPEND=0x027f0000
	;;
    *)
	ERROR
	;;
esac

cat <<EOF
/*
 * Setup the memory map of the Innovasic SBC 
 * stack grows down from high memory.
 *
 * The memory map for the ROM model looks like this:
 *
 * +--------------------+ <-address 0 in Flash
 * | .vector_table      |
 * +--------------------+ <- low memory
 * | .text              |
 * |        _etext      |
 * |        ctor list   | the ctor and dtor lists are for
 * |        dtor list   | C++ support
 * +--------------------+
 * | DCACHE_CODE        | code to be loaded into DCACHE
 * |     _dcache_start  |
 * |     _dcache_end    |
 * +--------------------+
 * | .data              | initialized data goes here
 * +--------------------+
 * .                    .
 * .                    .
 * .                    .
 * +--------------------+ <- The beginning of the SRAM area
 * | .data              | a wriable copy of data goes here.
 * |        _edata      |
 * +--------------------+
 * | .bss               |
 * |        __bss_start | start of bss, cleared by crt0
 * |        _end        | start of heap, used by sbrk()
 * |        _heapend    |    End   of heap, used by sbrk()
 * +--------------------+
 * .                    .
 * .                    .
 * .                    .
 * |        __stack     | top of stack
 * +--------------------+
 *
 *
 * The memory map for the RAM model looks like this:
 *
 * +--------------------+ <- The beginning of the SRAM or SDRAM area.
 * | .vector_table      |
 * +--------------------+ <- low memory
 * | .text              |
 * |        _etext      |
 * |        ctor list   | the ctor and dtor lists are for
 * |        dtor list   | C++ support
 * +--------------------+
 * | DCACHE_CODE        | code to be loaded into DCACHE
 * |     _dcache_start  |
 * |     _dcache_end    |
 * +--------------------+
 * | .data              | initialized data goes here
 * |        _edata      |
 * +--------------------+
 * | .bss               |
 * |        __bss_start | start of bss, cleared by crt0
 * |        _end        | start of heap, used by sbrk()
 * |        _heapend    |    End   of heap, used by sbrk()
 * +--------------------+
 * .                    .
 * .                    .
 * .                    .
 * |        __stack     | top of stack
 * +--------------------+
 */

STARTUP(fido-${CRT0}-crt0.o)
OUTPUT_ARCH(m68k)
ENTRY(_start);
GROUP(-l${IO} -lfido -lc -lgcc)

MEMORY {
  /* Flash ROM.  */
  rom (rx)      : ORIGIN = 0x0000000, LENGTH = 0x800000
  /* Internal SRAM.  */
  int_ram (rwx) : ORIGIN = 0x1000000, LENGTH = 0x6000
  /* External SDRAM.  */
  sdram (rwx)   : ORIGIN = 0x2000000, LENGTH = 0x800000
  /* External SRAM.  */
  sram (rwx)     : ORIGIN = ${SRAM_ORIGIN}, LENGTH = ${SRAM_LENGTH}
}

SECTIONS {
  /* The interrupt vector is placed at the beginning of ${TEXT},
     as required at reset.  */
  .vector_table : {
    *(.vector_table)
  } > ${TEXT}

  /* Text section.  */
  .text :
  {
    *(.text .text.*)
    *(.gnu.linkonce.t.*)

    . = ALIGN(0x4);
    /* These are for running static constructors and destructors under ELF.  */
    KEEP (*crtbegin.o(.ctors))
    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
    KEEP (*(SORT(.ctors.*)))
    KEEP (*crtend.o(.ctors))
    KEEP (*crtbegin.o(.dtors))
    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
    KEEP (*(SORT(.dtors.*)))
    KEEP (*crtend.o(.dtors))

    . = ALIGN(0x4);
    KEEP (*crtbegin.o(.jcr))
    KEEP (*(EXCLUDE_FILE (*crtend.o) .jcr))
    KEEP (*crtend.o(.jcr))

    *(.rodata .rodata.*)
    *(.gnu.linkonce.r.*)
    *(.gcc_except_table) 
    *(.eh_frame)

    . = ALIGN(0x2);
    _init = . ;
    LONG (0x4e560000)	/* linkw %fp,#0 */
    *(.init)
    SHORT (0x4e5e)	/* unlk %fp */
    SHORT (0x4e75)	/* rts */

    _fini = . ;
    LONG (0x4e560000)	/* linkw %fp,#0 */
    *(.fini)
    SHORT (0x4e5e)	/* unlk %fp */
    SHORT (0x4e75)	/* rts */
    . = ALIGN(0x800);   /* align to a 2K dcache boundary */
    _dcache_start = .;
    *(DCACHE_CODE)
    _dcache_end = .;
    _etext = .;
    *(.lit)
    . = ALIGN(0x4);
    __start_romdata = .;
  } > ${TEXT}

  /* Initialized data section.  */
  .data :
  {
    _data = .;
    *(.got.plt) *(.got)
    *(.shdata);
    *(.data .data.*)
    *(.gnu.linkonce.d.*)
    _edata_cksum = .;
    *(checksum);
    _edata = .;
  } > ${DATA} ${DATALOAD:+AT>} ${DATALOAD}

  /* Zero-initialized data.  */ 
  .bss :
  {
    . = ALIGN(0x4);
    __bss_start = . ;
    *(.shbss)
    *(.bss .bss.*)
    *(.gnu.linkonce.b.*)
    *(COMMON)
    _end =  ALIGN (0x8);
    __end = _end;
  } > ${DATA}

  /* Specially designated data is placed in the internal RAM.  */
  fast_memory :
  {
    . = ALIGN(0x4);
    __fast_start = .;
    *(FAST_RAM)
    __fast_stop = .;
  } > int_ram
}

PROVIDE (__stack = ${STACK});

PROVIDE (_heapend = ${HEAPEND});
EOF