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

Subversion Repositories ion

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

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

powered by: WebSVN 2.1.0

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