OpenCores
URL https://opencores.org/ocsvn/ion/ion/trunk

Subversion Repositories ion

[/] [ion/] [trunk/] [src/] [ion_noxram.lds] - Blame information for rev 184

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ja_rd
/**
2
* ion_noxram.lds -- Linker script file for ION project (with no RAM or cache)
3
*
4 184 ja_rd
* WARNING: This script is no longer used by any makefile, to be removed or
5
* refactored.
6 67 ja_rd
*
7 184 ja_rd
* The ion cpu has separate buses for code and data (Harvard architecture) and
8
* can be used with no cache. This linker script targets that 'bare'
9 2 ja_rd
* system configuration. It is meant for early testing and debugging.
10
*
11
* This script will split the object file in two areas so that they can be put
12
* in separate memory blocks:
13
* 1.- Code area (text output section)
14
* 2.- Data area (sdata, data and bss output sections)
15
*
16
* Since data constants can't be reached from the code bus, constant data
17
* (usually in section rodata) needs to be put in the same space as other data.
18
* This is the main purpose of this file.
19 184 ja_rd
* Alternatively, we might just implement a 3-port memory and leave all sections
20 2 ja_rd
* adjacent, but that would be too expensive (3-port memory would take about
21
* twice as many memory blocks for the same memory size).
22
*
23
* FIXME code and data RAM block sizes hardcoded
24
* FIXME code and data start addresses hardcoded
25
*/
26 67 ja_rd
/*
27
# Known problems:
28
#
29
# 1.- LINK PROBLEM IF FLAG '-G0' NOT USED
30
#       If flag '-G0' is not used on gcc, linker fails with 'relocation
31
#       truncated to fit: R_MIPS_GPREL16' error message.
32
#       This only happens when you use global or static veriables, initialized
33
#       or not.
34
#       (See explaination in the project docs about $gp indexed addressing in
35
#       MIPS architectures and the -G0 flag).
36
#
37
#     SUSPECTED CAUSE:
38
#       I'm sure there is something wrong with my linker script.
39
#       With the default link scripts this does not happen. Yet we need to use
40
#       a script so that we can split code and data (including read-only) to
41
#       different sections (and later to different ram blocks).
42
#
43
#     WORKAROUND:
44
#       Use -G0 flag so that _gp indexing is disabled. There is a performance
45
#       hit, though. In effect we're telling the compiler to NOT use $gp for
46
#       indexed access to any global variables.
47
#       This is only necessary for the 'bare' target (no external ram and no
48
#       cache) and will have to be fixed for regular targets (by using a
49
#       standard link script or fixing mine).
50 2 ja_rd
 
51 67 ja_rd
*/
52
 
53
 
54 2 ja_rd
/* Make sure the first linked file is ths startup code from boot.s */
55
/* (We might put boot.o in the ld command line, BEFORE all other files) */
56
STARTUP(boot.o)
57
 
58
/* Default object output format is ELF big endian */
59
OUTPUT_FORMAT(elf32-big)
60
 
61
 
62
 
63
SECTIONS {
64
    /* Put all code at CODE area */
65
    .text 0x00000000 : {
66
        _ftext = . ;
67
        * (.text);
68
 
69
 
70
    } = 0 /* fill gaps with zeros */
71
 
72
    /* Mark end of executable code */
73
    _ecode = .;
74
    /* mark end of read-only code */
75
    _etext = .;
76
    PROVIDE (etext = .);
77
 
78
 
79
    /**** Put all data, including read-only, at DATA area */
80
 
81 34 ja_rd
    .data 0x80000000 : {
82 2 ja_rd
        _fdata = . ;
83
        * (.data);
84
        * (.data.*);
85
 
86
        /* Conventionally, symbol _gp points to the middle of a 64K area at the
87
           start of the sdata section ('small data section'). Register $gp is
88
           loaded with _gp at program startup (in boot.s) so that data in that
89
           area can be reached with just one instruction.
90
           Note that the compiler/assembler will put data in the sdata section
91
           only if it is small enough (see as/gcc docs, -G option and others).
92
           FIXME this feature has not been tested.
93
        */
94
        _gp = . + 0x7ff0; /* 0x7ff0 -> middle of 64K area */
95
        *(.lit8);
96
        *(.lit4);
97
        *(.sdata);
98
        *(.sbss);
99
        *(.gnu.linkonce.s*);
100
        *(.rodata);
101
        *(.rodata.*);
102
        /* mark end of initialised data */
103
        _edata  =  .;
104
        PROVIDE (edata = .);
105
 
106
        /* start bss on dword boundary for easier clearing */
107
        . = ALIGN(8);
108
 
109
    }
110
 
111
    /* start bss on dword boundary for easier clearing */
112
    . = ALIGN(8);
113
 
114
    /* mark start of uninitialised data */
115
    __bss_start = .;
116
    _fbss = __bss_start;
117
 
118
    .bss : {
119
        /* *(.sbss); */
120
        *(.dynbss);
121
        *(COMMON);
122
        * (.bss);
123
        _end = . ;
124
    }
125
    /* mark end of uninitialised data */
126
    _end = . ;
127
    PROVIDE (end = .);
128
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.