-
Notifications
You must be signed in to change notification settings - Fork 2
/
Heterodyning ECscan DSP Firmware - Copy.ldf
454 lines (400 loc) · 15.7 KB
/
Heterodyning ECscan DSP Firmware - Copy.ldf
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
/*
** Default LDF for C applications targeting ADSP-21489.
**
** There are a number of configuration macros that may be specified as a
** result of use of certain compiler switches or by linker flags directly.
** The options are:
** CRT_HDR
** Specifies a custom startup object to use instead of the default files.
** __ADI_LIBEH__
** Link against C++ libraries with exception handling enabled.
** _ADI_THREADS
** Link against thread-safe variants of the run-time libraries.
** __NORMAL_WORD_CODE__
** Indicates that the application should link against runtime libraries
** build with normal word encoding (-nwc).
** __SHORT_WORD_CODE__
** Indicates that the application should link against runtime libraries
** build with short word encoding (-swc).
** __LIBIO_LITE
** The I/O library provides support for printing hexadecimal constants
** using the "%a" conversion specifier, and for registering alternatives to
** the default device driver that is supported by the VisualDSP++ simulator
** and EZ-KIT Lite systems. Those applications that do not require this
** functionality may define the macro __LIBIO_LITE which will select an
** alternative I/O library and lead to reduced code occupancy.
** __LIBIO_FX
** Defining this macro causes use of a variant of the I/O library which
** contains full support for the fixed-point format specifiers, %r and %R.
** In contrast, the standard I/O library will print fixed-point constants
** with these specifiers as hexadecimal, in order to provide reduced code
** occupancy.
** __NO_STD_LIB
** Defined by the compiler when switch -no-std-lib is used and causes
** the LDF to avoid using the standard VisualDSP++ library search path.
** __MEMINIT__
** Macro defined by the linker when -meminit is used to enable runtime
** initialization.
** USE_SDRAM
** Makes SDRAM available as standard program and data memory.
** USE_SDRAM_HEAP
** Use SDRAM for dynamic heap allocation rather than L1 default. Should
** result in a much larger heap being available but can have a significant
** performance impact.
** USE_SDRAM_STACK
** Use SDRAM for system stack rather than L1 default. Should allow for
** much larger stack but likely to have a significant performance impact.
*/
ARCHITECTURE(ADSP-21489)
#if defined(__NORMAL_WORD_CODE__) && defined(__SHORT_WORD_CODE__)
# error Both "__NORMAL_WORD_CODE__" and "__SHORT_WORD_CODE__" have been defined. These macros are mutually exclusive.
#endif
#ifndef __NO_STD_LIB
SEARCH_DIR( $ADI_DSP/214xx/lib )
#endif
#ifdef __NORMAL_WORD_CODE__
# define RT_LIB_NAME(n) lib ## n ## _nwc.dlb
#else
# define RT_LIB_NAME(n) lib ## n ## .dlb
#endif
#ifdef _ADI_THREADS
# define RT_LIB_NAME_MT(n) RT_LIB_NAME(n ## mt)
#else
# define RT_LIB_NAME_MT(n) RT_LIB_NAME(n)
#endif
#ifdef __ADI_LIBEH__
# define RT_LIB_NAME_EH(n) RT_LIB_NAME_MT(n ## eh)
#else
# define RT_LIB_NAME_EH(n) RT_LIB_NAME_MT(n)
#endif
// Libraries from the command line are included in COMMAND_LINE_OBJECTS.
$LIBRARIES =
RT_LIB_NAME_MT(c),
#ifdef __LIBIO_LITE
RT_LIB_NAME_MT(io_lite),
#elif defined(__LIBIO_FX)
RT_LIB_NAME_MT(io_fx),
#else
RT_LIB_NAME_MT(io),
#endif
RT_LIB_NAME_EH(cpp),
RT_LIB_NAME(dsp);
$OBJECTS =
#ifdef CRT_HDR
CRT_HDR,
#else
21489_hdr.doj,
#endif
$COMMAND_LINE_OBJECTS;
/*
** List of objects which prefer internal memory placement
*/
$OBJS_LIBS_INTERNAL =
$OBJECTS{prefersMem("internal")},
$LIBRARIES{prefersMem("internal")};
/*
** List of objects which don't prefer external memory placement
*/
$OBJS_LIBS_NOT_EXTERNAL =
$OBJECTS{!prefersMem("external")},
$LIBRARIES{!prefersMem("external")};
#if defined(USE_SDRAM_STACK) || defined(USE_SDRAM_HEAP)
#warning Putting stack/heap into external sdram can have a serious performance impact
#if !defined(USE_SDRAM)
#define USE_SDRAM
#endif
#endif
/*
** minimum sizes of the stack and heap allocated
*/
#define STACK_SIZE 8K
#define HEAP_SIZE 16K
#define STACKHEAP_SIZE 24K
MEMORY
{
// The SHARC 21489 has 5Mbit RAM and 4Mbit ROM in total.
// -------------------------- BLOCK 0 ----------------------------------------
// 0x0008 C000 to 0x0009 3FFF Normal word (48) Space (1.5 Mbit RAM)
// 0x0009 2000 to 0x0009 DFFF Normal word (32) Space (1.5 Mbit RAM)
// 0x0012 4000 to 0x0013 BFFF Short word (16) Space (1.5 Mbit RAM)
seg_rth { TYPE(PM RAM) START(0x0008c000) END(0x0008c0ff) WIDTH(48) }
#ifdef __MEMINIT__
seg_init { TYPE(PM RAM) START(0x0008c100) END(0x0008c2ff) WIDTH(48) }
seg_int_code { TYPE(SW RAM) START(0x00124900) END(0x0013Bfff) WIDTH(16) }
#else
seg_int_code { TYPE(SW RAM) START(0x00124300) END(0x0013BFFF) WIDTH(16) }
#endif // __MEMINIT__
// -------------------------- BLOCK 1 ----------------------------------------
// 0x000A C000 to 0x000B 3FFF Normal word (48) Space (1.5 Mbit RAM)
// 0x000B 2000 to 0x000B DFFF Normal word (32) Space (1.5 Mbit RAM)
// 0x0016 4000 to 0x0017 BFFF Short word (16) Space (1.5 Mbit RAM)
#ifdef IDDE_ARGS
#define ARGV_START 0xb2000
mem_argv { TYPE(DM RAM) START(0x000b2000) END(0x000b20ff) WIDTH(32) }
seg_dmda { TYPE(DM RAM) START(0x000b2100) END(0x000bbfff) WIDTH(32) }
#else
seg_dmda { TYPE(DM RAM) START(0x000b2000) END(0x000bbfff) WIDTH(32) }
#endif
seg_stak { TYPE(DM RAM) START(0x000bc000) END(0x000bdfff) WIDTH(32) }
// -------------------------- BLOCK 2 ----------------------------------------
// 0x000C 0000 to 0x000C 5554 Normal word (48) Space (1 Mbit RAM)
// 0x000C 0000 to 0x000C 7FFF Normal word (32) Space (1 Mbit RAM)
// 0x0018 0000 to 0x0018 FFFF Short word (16) Space (1 Mbit RAM)
seg_pmda { TYPE(DM RAM) START(0x000C0000) END(0x000C7FFF) WIDTH(32) }
// ------------------------- BLOCK 3 -----------------------------------------
// 0x000E 0000 to 0x000E 5554 Normal word (48) Space (1 Mbit RAM)
// 0x000E 0000 to 0x000E 7FFF Normal word (32) Space (1 Mbit RAM)
// 0x001C 0000 to 0x001C FFFF Short word (16) Space (1 Mbit RAM)
seg_heap { TYPE(DM RAM) START(0x000e0000) END(0x000e7fff) WIDTH(32) }
// ------------------------- SDRAM -------------------------------------------
// 0x00200000 to 0x009FFFFF Normal word (32) Space (32MB RAM) as found on the
// ADSP-21489 Ez-Board.
//
// Notes:
// 1) For Code accesses, which are only supported in Bank 0 of External
// port, address range is:
// - For VISA code (i.e 16bit accesses) : 0x600000 - 0xFFFFFF
// - For NonVISA code (i.e 48 bit accesses) : 0x200000 - 0x5FFFFF
//
// 2) The linker does not understand address translation so does not detect
// overlaps correctly which means that errors can be issued for non-
// overlapping sections and also that no errors are issued for overlapping
// sections. (TAR-43296)
seg_ext_swco { TYPE(SW RAM) START(0x00600000) END(0x0065FFFF) WIDTH(16) }
seg_ext_nwco { TYPE(PM RAM) START(0x00220000) END(0x0043FFFF) WIDTH(16) }
seg_ext_dmda { TYPE(DM RAM) START(0x00660000) END(0x009FFFFF) WIDTH(16) }
seg_ext_pmda { TYPE(DM RAM) START(0x00A00000) END(0x00AFFFFF) WIDTH(16) }
seg_flash { TYPE(DM RAM) START(0x04000000) END(0x043FFFFF) WIDTH(8) }
seg_sram { TYPE(DM RAM) START(0x0C000000) END(0x0C07FFFF) WIDTH(16) }
} /* MEMORY */
PROCESSOR P0
{
#ifdef IDDE_ARGS
RESOLVE(___argv_string, ARGV_START)
#endif
KEEP( _main,___lib_end_of_heap_descriptions )
OUTPUT( $COMMAND_LINE_OUTPUT_FILE )
SECTIONS
{
seg_rth PM
{
NO_FORCE_CONTIGUITY
INPUT_SECTIONS( $OBJECTS(seg_rth) $LIBRARIES(seg_rth))
} > seg_rth
seg_init PM
{
ldf_seginit_space = . ;
INPUT_SECTIONS( $OBJECTS(seg_init) $LIBRARIES(seg_init))
}
#if defined(__MEMINIT__)
> seg_init
#else
> seg_int_code
#endif
seg_int_code_sw SW
{
FILL(0x1)
NO_FORCE_CONTIGUITY
// map code required to be in internal memory first
INPUT_SECTIONS( $OBJECTS(seg_int_code_sw) $LIBRARIES(seg_int_code_sw))
INPUT_SECTIONS( $OBJECTS(seg_int_code) $LIBRARIES(seg_int_code))
} > seg_int_code
seg_int_code PM
{
NO_FORCE_CONTIGUITY
// map code required to be in internal memory first
INPUT_SECTIONS( $OBJECTS(seg_int_code) $LIBRARIES(seg_int_code))
} > seg_int_code
seg_swco SW
{
FILL(0x1)
NO_FORCE_CONTIGUITY
// now map the default code sections, sw first
INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(seg_swco))
INPUT_SECTIONS( $OBJS_LIBS_NOT_EXTERNAL(seg_swco))
INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(seg_pmco))
INPUT_SECTIONS( $OBJS_LIBS_NOT_EXTERNAL(seg_pmco))
INPUT_SECTIONS( $OBJECTS(seg_swco) $LIBRARIES(seg_swco))
INPUT_SECTIONS( $OBJECTS(seg_pmco) $LIBRARIES(seg_pmco))
} > seg_int_code
seg_pmco PM
{
NO_FORCE_CONTIGUITY
// now map the default code sections, pm after sw
INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(seg_pmco))
INPUT_SECTIONS( $OBJS_LIBS_NOT_EXTERNAL(seg_pmco))
INPUT_SECTIONS( $OBJECTS(seg_pmco) $LIBRARIES(seg_pmco))
} > seg_int_code
seg_pmda
{
INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(seg_pmda))
INPUT_SECTIONS( $OBJS_LIBS_NOT_EXTERNAL(seg_pmda))
INPUT_SECTIONS( $OBJECTS(seg_pmda) $LIBRARIES(seg_pmda))
} > seg_pmda
.bss ZERO_INIT
{
INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(.bss))
INPUT_SECTIONS( $OBJS_LIBS_NOT_EXTERNAL(.bss))
INPUT_SECTIONS( $OBJECTS(.bss) $LIBRARIES(.bss))
} > seg_dmda
#if defined(USE_SDRAM_STACK)
.bss_stak ZERO_INIT
{
INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(.bss))
INPUT_SECTIONS( $OBJS_LIBS_NOT_EXTERNAL(.bss))
INPUT_SECTIONS( $OBJECTS(.bss) $LIBRARIES(.bss))
} > seg_stak
#endif
#if defined(USE_SDRAM_HEAP)
.bss_heap ZERO_INIT
{
INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(.bss))
INPUT_SECTIONS( $OBJS_LIBS_NOT_EXTERNAL(.bss))
INPUT_SECTIONS( $OBJECTS(.bss) $LIBRARIES(.bss))
} > seg_heap
#endif
seg_dmda
{
INPUT_SECTIONS( $OBJECTS(seg_int_data) $LIBRARIES(seg_int_data))
INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(seg_dmda))
INPUT_SECTIONS( $OBJS_LIBS_NOT_EXTERNAL(seg_dmda))
INPUT_SECTIONS( $OBJECTS(seg_dmda) $LIBRARIES(seg_dmda))
} > seg_dmda
seg_dmda2
{
// use unused space in seg_pmda for dmda
INPUT_SECTIONS( $OBJECTS(seg_dmda) $LIBRARIES(seg_dmda))
} > seg_pmda
seg_pmda2
{
// use unused space in seg_dmda for pmda
INPUT_SECTIONS( $OBJECTS(seg_pmda) $LIBRARIES(seg_pmda))
} > seg_dmda
#if defined(USE_SDRAM_STACK)
seg_dmda_stak
{
INPUT_SECTIONS( $OBJECTS(seg_int_data) $LIBRARIES(seg_int_data))
INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(seg_dmda))
INPUT_SECTIONS( $OBJS_LIBS_NOT_EXTERNAL(seg_dmda))
INPUT_SECTIONS( $OBJECTS(seg_dmda) $LIBRARIES(seg_dmda))
} > seg_stak
#endif
#if defined(USE_SDRAM_HEAP)
seg_dmda_heap
{
INPUT_SECTIONS( $OBJECTS(seg_int_data) $LIBRARIES(seg_int_data))
INPUT_SECTIONS( $OBJS_LIBS_INTERNAL(seg_dmda))
INPUT_SECTIONS( $OBJS_LIBS_NOT_EXTERNAL(seg_dmda))
INPUT_SECTIONS( $OBJECTS(seg_dmda) $LIBRARIES(seg_dmda))
} > seg_heap
#endif
#if !defined(USE_SDRAM_STACK)
stackseg
{
// allocate a stack for the application
ldf_stack_space = .;
ldf_stack_length = MEMORY_SIZEOF(seg_stak);
ldf_stack_end = ldf_stack_space + ldf_stack_length;
} > seg_stak
#endif
#if !defined(USE_SDRAM_HEAP)
heap
{
// allocate a heap for the application
ldf_heap_space = .;
ldf_heap_length = MEMORY_SIZEOF(seg_heap);
ldf_heap_end = ldf_heap_space + ldf_heap_length - 1;
} > seg_heap
#endif
seg_flash
{
INPUT_SECTIONS($OBJECTS(seg_flash) $LIBRARIES(seg_flash))
} > seg_flash
#if defined(USE_SDRAM)
seg_sdram_code_sw SW
{
INPUT_SECTIONS( $OBJECTS(seg_ext_code) $LIBRARIES(seg_ext_code))
// place code we couldn't link internally into SDRAM
INPUT_SECTIONS( $OBJECTS(seg_swco) $LIBRARIES(seg_swco))
INPUT_SECTIONS( $OBJECTS(seg_pmco) $LIBRARIES(seg_pmco))
} > seg_ext_swco
seg_sdram_code PM
{
INPUT_SECTIONS( $OBJECTS(seg_ext_code) $LIBRARIES(seg_ext_code))
// place code we couldn't link internally into SDRAM
INPUT_SECTIONS( $OBJECTS(seg_pmco) $LIBRARIES(seg_pmco))
} > seg_ext_nwco
reserve_ext_stack_and_heap
{
//reserve memory for heap/stack if we need it
#if defined(USE_SDRAM_STACK) && defined(USE_SDRAM_HEAP)
RESERVE(stack_and_heap, stack_and_heap_length = STACKHEAP_SIZE)
#elif defined(USE_SDRAM_STACK)
RESERVE(stack_and_heap, stack_and_heap_length = STACK_SIZE)
#elif defined(USE_SDRAM_HEAP)
RESERVE(stack_and_heap, stack_and_heap_length = HEAP_SIZE)
#endif // USE_SDRAM_STACK && USE_SDRAM_HEAP
} > seg_ext_dmda
.bss_external ZERO_INIT
{
INPUT_SECTIONS( $OBJECTS(.bss) $LIBRARIES(.bss))
} > seg_ext_dmda
seg_sdram_data
{
INPUT_SECTIONS( $OBJECTS(seg_dmda) $LIBRARIES(seg_dmda))
INPUT_SECTIONS( $OBJECTS(seg_ext_data) $LIBRARIES(seg_ext_data))
INPUT_SECTIONS( $OBJECTS(seg_sdram) $LIBRARIES(seg_sdram))
} > seg_ext_dmda
#if defined(USE_SDRAM_STACK) || defined(USE_SDRAM_HEAP)
expand_ext_stack_and_heap
{
//expand the stack/heap to use the rest of the SDRAM.
RESERVE_EXPAND(stack_and_heap, stack_and_heap_length, 0)
#if defined(USE_SDRAM_STACK) && defined(USE_SDRAM_HEAP)
ldf_stack_space = stack_and_heap;
ldf_stack_end = (ldf_stack_space + ((stack_and_heap_length *
STACK_SIZE) / (STACK_SIZE + HEAP_SIZE)));
ldf_stack_length = ldf_stack_end - ldf_stack_space - 1;
ldf_heap_space = ldf_stack_end;
ldf_heap_end = stack_and_heap + stack_and_heap_length;
ldf_heap_length = ldf_heap_end - ldf_heap_space;
#elif defined(USE_SDRAM_STACK)
ldf_stack_space = stack_and_heap;
ldf_stack_length = stack_and_heap_length;
ldf_stack_end = ldf_stack_space + stack_and_heap_length;
#elif defined(USE_SDRAM_HEAP)
ldf_heap_space = stack_and_heap;
ldf_heap_length = stack_and_heap_length;
ldf_heap_end = ldf_heap_space + stack_and_heap_length;
#endif // USE_SDRAM_STACK && USE_SDRAM_HEAP
} > seg_ext_dmda
#endif // USE_SDRAM_STACK || USE_SDRAM_HEAP
seg_ext_pmda
{
INPUT_SECTIONS( $OBJECTS(seg_ext_pmda) $LIBRARIES(seg_ext_pmda))
} > seg_ext_pmda
#else
seg_ext_code_sw SW
{
INPUT_SECTIONS( $OBJECTS(seg_ext_code) $LIBRARIES(seg_ext_code))
} > seg_ext_swco
seg_ext_code PM
{
INPUT_SECTIONS( $OBJECTS(seg_ext_code) $LIBRARIES(seg_ext_code))
} > seg_ext_nwco
seg_ext_data
{
INPUT_SECTIONS( $OBJECTS(seg_ext_data) $LIBRARIES(seg_ext_data))
INPUT_SECTIONS( $OBJECTS(seg_sdram) $LIBRARIES(seg_sdram))
} > seg_ext_dmda
seg_ext_pmda
{
INPUT_SECTIONS( $OBJECTS(seg_ext_pmda) $LIBRARIES(seg_ext_pmda))
} > seg_ext_pmda
#endif // USE_SDRAM
seg_sram
{
INPUT_SECTIONS( $OBJECTS(seg_sram) $LIBRARIES(seg_sram))
} > seg_sram
} /* SECTIONS */
} /* PROCESSOR p0 */