Put rodata in text section. Move stack out bss section. Typos.
[bertos.git] / cpu / arm / scripts / sam7s256_rom.ld
1 /**
2  * \file
3  * <!--
4  * This file is part of BeRTOS.
5  *
6  * Bertos is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * As a special exception, you may use this file as part of a free software
21  * library without restriction.  Specifically, if other files instantiate
22  * templates or use macros or inline functions from this file, or you compile
23  * this file and link it with other files to produce an executable, this
24  * file does not by itself cause the resulting executable to be covered by
25  * the GNU General Public License.  This exception does not however
26  * invalidate any other reasons why the executable file might be covered by
27  * the GNU General Public License.
28  *
29  * Copyright 2007 Develer S.r.l. (http://www.develer.com/)
30  *
31  * -->
32  *
33  * \version $Id: sysirq_at91.c 18273 2007-10-11 14:53:02Z batt $
34  *
35  * \author Daniele Basile <asterix@develer.com>
36  *
37  * \brief Script linker for Atmel AT91 SAM7S256 processors.
38  *
39  */
40
41 /**
42  * \file
43  * <!--
44  * This file is part of BeRTOS.
45  *
46  * Bertos is free software; you can redistribute it and/or modify
47  * it under the terms of the GNU General Public License as published by
48  * the Free Software Foundation; either version 2 of the License, or
49  * (at your option) any later version.
50  *
51  * This program is distributed in the hope that it will be useful,
52  * but WITHOUT ANY WARRANTY; without even the implied warranty of
53  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
54  * GNU General Public License for more details.
55  *
56  * You should have received a copy of the GNU General Public License
57  * along with this program; if not, write to the Free Software
58  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
59  *
60  * As a special exception, you may use this file as part of a free software
61  * library without restriction.  Specifically, if other files instantiate
62  * templates or use macros or inline functions from this file, or you compile
63  * this file and link it with other files to produce an executable, this
64  * file does not by itself cause the resulting executable to be covered by
65  * the GNU General Public License.  This exception does not however
66  * invalidate any other reasons why the executable file might be covered by
67  * the GNU General Public License.
68  *
69  * Copyright 2007 Develer S.r.l. (http://www.develer.com/)
70  *
71  * -->
72  *
73  * \version $Id: sysirq_at91.c 18273 2007-10-11 14:53:02Z batt $
74  *
75  * \author Daniele Basile <asterix@develer.com>
76  *
77  * \brief Script linker for Atmel AT91 SAM7S256 processors.
78  *
79  */
80
81
82 ENTRY(ResetHandler)
83 SEARCH_DIR(.)
84 OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
85 OUTPUT_ARCH(arm)
86
87 /*
88  * Define memory configuration for AT91SAM7S
89  */
90 MEMORY
91 {
92   rom(rx) : org = 0x00000000, len = 256k
93   ram(rw) : org = 0x00200000, len = 64k
94 }
95
96
97 /*
98  * Define stack size here
99  */
100 FIQ_STACK_SIZE = 0x0100;
101 IRQ_STACK_SIZE = 0x0100;
102 ABT_STACK_SIZE = 0x0100;
103 UND_STACK_SIZE = 0x0100;
104 SVC_STACK_SIZE = 0x0400;
105
106 /*
107  * Allocate section memory
108  */
109 SECTIONS
110 {
111     .text :
112     {
113             * (.vectors);
114             . = ALIGN (4);
115             * (.init);
116             . = ALIGN (4);
117             * (.rodata);
118             . = ALIGN (4);
119             * (.rodata*);
120             . = ALIGN (4);
121         } > rom
122
123         . = ALIGN (4);
124         _etext = .;
125         PROVIDE (__etext = .);
126
127         .data : AT (__etext)
128         {
129                 PROVIDE (__data_start = .);
130                 * (.data)
131                 . = ALIGN (4);
132                 _edata = .;
133                 PROVIDE (__data_end = .);
134         } > ram
135
136         .bss :
137         {
138                 PROVIDE (__bss_start = .);
139                 *(.bss)
140                 *(COMMON)
141                 . = ALIGN(4);
142                 PROVIDE (__bss_end = .);
143         } > ram
144
145 /*
146  * Allocate stack at the end of bss section.
147  * Data heap is allocate at end of stack.
148  */
149         PROVIDE (__stack_start = .);
150
151         PROVIDE (__stack_fiq_start = .);
152         . += FIQ_STACK_SIZE;
153         . = ALIGN(4);
154         PROVIDE (__stack_fiq_end = .);
155
156         PROVIDE (__stack_irq_start = .);
157         . += IRQ_STACK_SIZE;
158         . = ALIGN(4);
159         PROVIDE (__stack_irq_end = .);
160
161         PROVIDE (__stack_abt_start = .);
162         . += ABT_STACK_SIZE;
163         . = ALIGN(4);
164         PROVIDE (__stack_abt_end = .);
165
166         PROVIDE (__stack_und_start = .);
167         . += UND_STACK_SIZE;
168         . = ALIGN(4);
169         PROVIDE (__stack_und_end = .);
170
171         PROVIDE (__stack_svc_start = .);
172         . += SVC_STACK_SIZE;
173         . = ALIGN(4);
174         PROVIDE (__stack_svc_end = .);
175
176         PROVIDE (__stack_end = .);
177
178         PROVIDE (__heap_start = .);
179
180 }