aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/common/startup/e200/compilers/GHS/ld/SPC560B50.ld
blob: 52d6fe8342502317ee4b6ffe405c97640f569b8e (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
/*
    ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

/*
 * SPC560B50 memory setup.
 */
MEMORY
{
    flash     : org = 0x00000000, len = 512k
    dataflash : org = 0x00800000, len = 64k
    ram       : org = 0x40000000, len = 32k
}

OPTION ("-e=_reset_address")

SECTIONS
{
    .boot0 ALIGN(16) :
    {
        *(.boot)
        *(.handlers)
        *(.crt0)
    } > flash

    .vectors ALIGN(0x800) :
    {
        /* The vectors table requires a 2kB alignment.*/
        *(.vectors)
    } > flash

    .ivors ALIGN(0x1000) :
    {
        /* The IVORs table requires a 4kB alignment.*/
        __ivpr_base__ = .;
        *(.ivors)
    } > flash

    constructors ALIGN(4) :
    {
        PROVIDE(__init_array_start = .);
        "*(.init_array.*)"
        *(.init_array)
        PROVIDE(__init_array_end = .);
    } > flash

    destructors ALIGN(4) :
    {
        PROVIDE(__fini_array_start = .);
        *(.fini_array)
        "*(.fini_array.*)"
        PROVIDE(__fini_array_end = .);
    } > flash

    .vletext ALIGN(16) :
    {
        *(.vletext)
        "*(.vletext.*)"
    } > flash

    .text ALIGN(16) :
    {
        *(.text)
        "*(.text.*)"
    } > flash

    .rodata ALIGN(16) :
    {
        *(.rodata)
        "*(.rodata.*)"
        *(.rodata1)
    } > flash

    .sdata2 ALIGN(16) :
    {
        __sdata2_start__ = . + 0x8000;
        *(.sdata2)
        "*(.sdata2.*)"
        *(.sbss2)
        "*(.sbss2.*)"
    } > flash

    .stacks ALIGN(16) :
    {
        . = ALIGN(8);
        __irq_stack_base__ = .;
        . += __irq_stack_size__;
        . = ALIGN(8);
        __irq_stack_end__ = .;
        __process_stack_base__ = .;
        __main_thread_stack_base__ = .;
        . += __process_stack_size__;
        . = ALIGN(8);
        __process_stack_end__ = .;
        __main_thread_stack_end__ = .;
    } > ram

    .romdatastart ALIGN(16) :
    {
        __romdata_start__ = .;
    } > flash

    .data ALIGN(4) : AT(__romdata_start__)
    {
        __data_start__ = .;
        *(.data)
        "*(.data.*)"
        . = ALIGN(4);
        *(.ramtext)
        . = ALIGN(4);
        __data_end__ = .;
    } > ram

    __romsdata_start__ = (__data_end__ - __data_start__) + __romdata_start__;

    .sdata ALIGN(4) : AT(__romsdata_start__)
    {
         __sdata_start__ = . + 0x8000;
        *(.sdata)
        "*(.sdata.*)"
    } > ram

    .sbss ALIGN(4) :
    {
        __bss_start__ = .;
        *(.sbss)
        "*(.sbss.*)"
        *(.scommon)
    } > ram

    .bss ALIGN(4) :
    {
        *(.bss)
        "*(.bss.*)"
        *(COMMON)
        __bss_end__ = .;
    } > ram

    __flash_size__          = SIZEOF(flash);
    __flash_start__         = ADDR(flash);
    __flash_end__           = ENDADDR(flash);

    __dataflash_size__      = SIZEOF(dataflash);
    __dataflash_start__     = ADDR(dataflash);
    __dataflash_end__       = ENDADDR(dataflash);

    __ram_size__            = SIZEOF(ram);
    __ram_start__           = ADDR(ram);
    __ram_end__             = ENDADDR(ram);

    __heap_base__           = __bss_end__;
    __heap_end__            = __ram_end__;
}