aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boot/compressed
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-11-21 02:53:37 -0500
committerPaul Mundt <lethal@linux-sh.org>2008-01-27 23:18:52 -0500
commit71373068067b01c963eed1350909de81fc6a6d04 (patch)
tree46983ab00b37896519fd4833ed69eadfe618270f /arch/sh/boot/compressed
parent55183e9bb2c2ce43d88eaa575c2d6d4fd6d865a3 (diff)
sh: Merge the sh64 zImage bits.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boot/compressed')
-rw-r--r--arch/sh/boot/compressed/Makefile46
-rw-r--r--arch/sh/boot/compressed/Makefile_3243
-rw-r--r--arch/sh/boot/compressed/Makefile_6445
-rw-r--r--arch/sh/boot/compressed/cache.c12
-rw-r--r--arch/sh/boot/compressed/head_32.S (renamed from arch/sh/boot/compressed/head.S)0
-rw-r--r--arch/sh/boot/compressed/head_64.S163
-rw-r--r--arch/sh/boot/compressed/misc_32.c (renamed from arch/sh/boot/compressed/misc.c)0
-rw-r--r--arch/sh/boot/compressed/misc_64.c250
-rw-r--r--arch/sh/boot/compressed/vmlinux_64.lds64
9 files changed, 581 insertions, 42 deletions
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile
index 906a13f82fe0..efb01dc3c8c3 100644
--- a/arch/sh/boot/compressed/Makefile
+++ b/arch/sh/boot/compressed/Makefile
@@ -1,43 +1,5 @@
1# 1ifeq ($(CONFIG_SUPERH32),y)
2# linux/arch/sh/boot/compressed/Makefile 2include ${srctree}/arch/sh/boot/compressed/Makefile_32
3# 3else
4# create a compressed vmlinux image from the original vmlinux 4include ${srctree}/arch/sh/boot/compressed/Makefile_64
5#
6
7targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
8EXTRA_AFLAGS := -traditional
9
10OBJECTS = $(obj)/head.o $(obj)/misc.o
11
12ifdef CONFIG_SH_STANDARD_BIOS
13OBJECTS += $(obj)/../../kernel/sh_bios.o
14endif 5endif
15
16#
17# IMAGE_OFFSET is the load offset of the compression loader
18#
19IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \
20 $$[$(CONFIG_PAGE_OFFSET) + \
21 $(CONFIG_MEMORY_START) + \
22 $(CONFIG_BOOT_LINK_OFFSET)]')
23
24LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
25
26LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup -T $(obj)/../../kernel/vmlinux.lds
27
28
29$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
30 $(call if_changed,ld)
31 @:
32
33$(obj)/vmlinux.bin: vmlinux FORCE
34 $(call if_changed,objcopy)
35
36$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
37 $(call if_changed,gzip)
38
39LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh-linux -T
40OBJCOPYFLAGS += -R .empty_zero_page
41
42$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
43 $(call if_changed,ld)
diff --git a/arch/sh/boot/compressed/Makefile_32 b/arch/sh/boot/compressed/Makefile_32
new file mode 100644
index 000000000000..6ac8d4a4ed1d
--- /dev/null
+++ b/arch/sh/boot/compressed/Makefile_32
@@ -0,0 +1,43 @@
1#
2# linux/arch/sh/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux
5#
6
7targets := vmlinux vmlinux.bin vmlinux.bin.gz \
8 head_32.o misc_32.o piggy.o
9EXTRA_AFLAGS := -traditional
10
11OBJECTS = $(obj)/head_32.o $(obj)/misc_32.o
12
13ifdef CONFIG_SH_STANDARD_BIOS
14OBJECTS += $(obj)/../../kernel/sh_bios.o
15endif
16
17#
18# IMAGE_OFFSET is the load offset of the compression loader
19#
20IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \
21 $$[$(CONFIG_PAGE_OFFSET) + \
22 $(CONFIG_MEMORY_START) + \
23 $(CONFIG_BOOT_LINK_OFFSET)]')
24
25LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
26
27LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup -T $(obj)/../../kernel/vmlinux.lds
28
29$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
30 $(call if_changed,ld)
31 @:
32
33$(obj)/vmlinux.bin: vmlinux FORCE
34 $(call if_changed,objcopy)
35
36$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
37 $(call if_changed,gzip)
38
39LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh-linux -T
40OBJCOPYFLAGS += -R .empty_zero_page
41
42$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
43 $(call if_changed,ld)
diff --git a/arch/sh/boot/compressed/Makefile_64 b/arch/sh/boot/compressed/Makefile_64
new file mode 100644
index 000000000000..0b48ae99922b
--- /dev/null
+++ b/arch/sh/boot/compressed/Makefile_64
@@ -0,0 +1,45 @@
1#
2# linux/arch/sh64/boot/compressed/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# Copyright (C) 2002 Stuart Menefy
9# Copyright (C) 2004 Paul Mundt
10#
11# create a compressed vmlinux image from the original vmlinux
12#
13
14targets := vmlinux vmlinux.bin vmlinux.bin.gz \
15 head_64.o misc_64.o cache.o piggy.o
16EXTRA_AFLAGS := -traditional
17
18OBJECTS := $(obj)/vmlinux_64.lds $(obj)/head_64.o $(obj)/misc_64.o \
19 $(obj)/cache.o
20
21#
22# ZIMAGE_OFFSET is the load offset of the compression loader
23# (4M for the kernel plus 64K for this loader)
24#
25ZIMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \
26 $$[$(CONFIG_PAGE_OFFSET)+0x400000+0x10000]')
27
28LDFLAGS_vmlinux := -Ttext $(ZIMAGE_OFFSET) -e startup \
29 -T $(obj)/../../kernel/vmlinux.lds
30
31$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o FORCE
32 $(call if_changed,ld)
33 @:
34
35$(obj)/vmlinux.bin: vmlinux FORCE
36 $(call if_changed,objcopy)
37
38$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
39 $(call if_changed,gzip)
40
41LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh64-linux -T
42OBJCOPYFLAGS += -R .empty_zero_page
43
44$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
45 $(call if_changed,ld)
diff --git a/arch/sh/boot/compressed/cache.c b/arch/sh/boot/compressed/cache.c
new file mode 100644
index 000000000000..e27fc74f228c
--- /dev/null
+++ b/arch/sh/boot/compressed/cache.c
@@ -0,0 +1,12 @@
1int cache_control(unsigned int command)
2{
3 volatile unsigned int *p = (volatile unsigned int *) 0x80000000;
4 int i;
5
6 for (i = 0; i < (32 * 1024); i += 32) {
7 (void)*p;
8 p += (32 / sizeof (int));
9 }
10
11 return 0;
12}
diff --git a/arch/sh/boot/compressed/head.S b/arch/sh/boot/compressed/head_32.S
index a8399b013729..a8399b013729 100644
--- a/arch/sh/boot/compressed/head.S
+++ b/arch/sh/boot/compressed/head_32.S
diff --git a/arch/sh/boot/compressed/head_64.S b/arch/sh/boot/compressed/head_64.S
new file mode 100644
index 000000000000..1d4ecbfc767c
--- /dev/null
+++ b/arch/sh/boot/compressed/head_64.S
@@ -0,0 +1,163 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * arch/shmedia/boot/compressed/head.S
7 *
8 * Copied from
9 * arch/shmedia/kernel/head.S
10 * which carried the copyright:
11 * Copyright (C) 2000, 2001 Paolo Alberelli
12 *
13 * Modification for compressed loader:
14 * Copyright (C) 2002 Stuart Menefy (stuart.menefy@st.com)
15 */
16#include <linux/linkage.h>
17#include <asm/cache.h>
18#include <asm/cpu/mmu_context.h>
19#include <asm/cpu/registers.h>
20
21/*
22 * Fixed TLB entries to identity map the beginning of RAM
23 */
24#define MMUIR_TEXT_H 0x0000000000000003 | CONFIG_MEMORY_START
25 /* Enabled, Shared, ASID 0, Eff. Add. 0xA0000000 */
26#define MMUIR_TEXT_L 0x000000000000009a | CONFIG_MEMORY_START
27 /* 512 Mb, Cacheable (Write-back), execute, Not User, Ph. Add. */
28
29#define MMUDR_CACHED_H 0x0000000000000003 | CONFIG_MEMORY_START
30 /* Enabled, Shared, ASID 0, Eff. Add. 0xA0000000 */
31#define MMUDR_CACHED_L 0x000000000000015a | CONFIG_MEMORY_START
32 /* 512 Mb, Cacheable (Write-back), read/write, Not User, Ph. Add. */
33
34#define ICCR0_INIT_VAL ICCR0_ON | ICCR0_ICI /* ICE + ICI */
35#define ICCR1_INIT_VAL ICCR1_NOLOCK /* No locking */
36
37#if 1
38#define OCCR0_INIT_VAL OCCR0_ON | OCCR0_OCI | OCCR0_WB /* OCE + OCI + WB */
39#else
40#define OCCR0_INIT_VAL OCCR0_OFF
41#endif
42#define OCCR1_INIT_VAL OCCR1_NOLOCK /* No locking */
43
44 .text
45
46 .global startup
47startup:
48 /*
49 * Prevent speculative fetch on device memory due to
50 * uninitialized target registers.
51 * This must be executed before the first branch.
52 */
53 ptabs/u r63, tr0
54 ptabs/u r63, tr1
55 ptabs/u r63, tr2
56 ptabs/u r63, tr3
57 ptabs/u r63, tr4
58 ptabs/u r63, tr5
59 ptabs/u r63, tr6
60 ptabs/u r63, tr7
61 synci
62
63 /*
64 * Set initial TLB entries for cached and uncached regions.
65 * Note: PTA/BLINK is PIC code, PTABS/BLINK isn't !
66 */
67 /* Clear ITLBs */
68 pta 1f, tr1
69 movi ITLB_FIXED, r21
70 movi ITLB_LAST_VAR_UNRESTRICTED+TLB_STEP, r22
711: putcfg r21, 0, r63 /* Clear MMUIR[n].PTEH.V */
72 addi r21, TLB_STEP, r21
73 bne r21, r22, tr1
74
75 /* Clear DTLBs */
76 pta 1f, tr1
77 movi DTLB_FIXED, r21
78 movi DTLB_LAST_VAR_UNRESTRICTED+TLB_STEP, r22
791: putcfg r21, 0, r63 /* Clear MMUDR[n].PTEH.V */
80 addi r21, TLB_STEP, r21
81 bne r21, r22, tr1
82
83 /* Map one big (512Mb) page for ITLB */
84 movi ITLB_FIXED, r21
85 movi MMUIR_TEXT_L, r22 /* PTEL first */
86 putcfg r21, 1, r22 /* Set MMUIR[0].PTEL */
87 movi MMUIR_TEXT_H, r22 /* PTEH last */
88 putcfg r21, 0, r22 /* Set MMUIR[0].PTEH */
89
90 /* Map one big CACHED (512Mb) page for DTLB */
91 movi DTLB_FIXED, r21
92 movi MMUDR_CACHED_L, r22 /* PTEL first */
93 putcfg r21, 1, r22 /* Set MMUDR[0].PTEL */
94 movi MMUDR_CACHED_H, r22 /* PTEH last */
95 putcfg r21, 0, r22 /* Set MMUDR[0].PTEH */
96
97 /* ICache */
98 movi ICCR_BASE, r21
99 movi ICCR0_INIT_VAL, r22
100 movi ICCR1_INIT_VAL, r23
101 putcfg r21, ICCR_REG0, r22
102 putcfg r21, ICCR_REG1, r23
103 synci
104
105 /* OCache */
106 movi OCCR_BASE, r21
107 movi OCCR0_INIT_VAL, r22
108 movi OCCR1_INIT_VAL, r23
109 putcfg r21, OCCR_REG0, r22
110 putcfg r21, OCCR_REG1, r23
111 synco
112
113 /*
114 * Enable the MMU.
115 * From here-on code can be non-PIC.
116 */
117 movi SR_HARMLESS | SR_ENABLE_MMU, r22
118 putcon r22, SSR
119 movi 1f, r22
120 putcon r22, SPC
121 synco
122 rte /* And now go into the hyperspace ... */
1231: /* ... that's the next instruction ! */
124
125 /* Set initial stack pointer */
126 movi datalabel stack_start, r0
127 ld.l r0, 0, r15
128
129 /*
130 * Clear bss
131 */
132 pt 1f, tr1
133 movi datalabel __bss_start, r22
134 movi datalabel _end, r23
1351: st.l r22, 0, r63
136 addi r22, 4, r22
137 bne r22, r23, tr1
138
139 /*
140 * Decompress the kernel.
141 */
142 pt decompress_kernel, tr0
143 blink tr0, r18
144
145 /*
146 * Disable the MMU.
147 */
148 movi SR_HARMLESS, r22
149 putcon r22, SSR
150 movi 1f, r22
151 putcon r22, SPC
152 synco
153 rte /* And now go into the hyperspace ... */
1541: /* ... that's the next instruction ! */
155
156 /* Jump into the decompressed kernel */
157 movi datalabel (CONFIG_MEMORY_START + 0x2000)+1, r19
158 ptabs r19, tr0
159 blink tr0, r18
160
161 /* Shouldn't return here, but just in case, loop forever */
162 pt 1f, tr0
1631: blink tr0, r63
diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc_32.c
index df65e305acf7..df65e305acf7 100644
--- a/arch/sh/boot/compressed/misc.c
+++ b/arch/sh/boot/compressed/misc_32.c
diff --git a/arch/sh/boot/compressed/misc_64.c b/arch/sh/boot/compressed/misc_64.c
new file mode 100644
index 000000000000..aea00c53ce29
--- /dev/null
+++ b/arch/sh/boot/compressed/misc_64.c
@@ -0,0 +1,250 @@
1/*
2 * arch/sh64/boot/compressed/misc.c
3 *
4 * This is a collection of several routines from gzip-1.0.3
5 * adapted for Linux.
6 *
7 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
8 *
9 * Adapted for SHmedia from sh by Stuart Menefy, May 2002
10 */
11
12#include <asm/uaccess.h>
13
14/* cache.c */
15#define CACHE_ENABLE 0
16#define CACHE_DISABLE 1
17int cache_control(unsigned int command);
18
19/*
20 * gzip declarations
21 */
22
23#define OF(args) args
24#define STATIC static
25
26#undef memset
27#undef memcpy
28#define memzero(s, n) memset ((s), 0, (n))
29
30typedef unsigned char uch;
31typedef unsigned short ush;
32typedef unsigned long ulg;
33
34#define WSIZE 0x8000 /* Window size must be at least 32k, */
35 /* and a power of two */
36
37static uch *inbuf; /* input buffer */
38static uch window[WSIZE]; /* Sliding window buffer */
39
40static unsigned insize = 0; /* valid bytes in inbuf */
41static unsigned inptr = 0; /* index of next byte to be processed in inbuf */
42static unsigned outcnt = 0; /* bytes in output buffer */
43
44/* gzip flag byte */
45#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */
46#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
47#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
48#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
49#define COMMENT 0x10 /* bit 4 set: file comment present */
50#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
51#define RESERVED 0xC0 /* bit 6,7: reserved */
52
53#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
54
55/* Diagnostic functions */
56#ifdef DEBUG
57# define Assert(cond,msg) {if(!(cond)) error(msg);}
58# define Trace(x) fprintf x
59# define Tracev(x) {if (verbose) fprintf x ;}
60# define Tracevv(x) {if (verbose>1) fprintf x ;}
61# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
62# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
63#else
64# define Assert(cond,msg)
65# define Trace(x)
66# define Tracev(x)
67# define Tracevv(x)
68# define Tracec(c,x)
69# define Tracecv(c,x)
70#endif
71
72static int fill_inbuf(void);
73static void flush_window(void);
74static void error(char *m);
75static void gzip_mark(void **);
76static void gzip_release(void **);
77
78extern char input_data[];
79extern int input_len;
80
81static long bytes_out = 0;
82static uch *output_data;
83static unsigned long output_ptr = 0;
84
85static void *malloc(int size);
86static void free(void *where);
87static void error(char *m);
88static void gzip_mark(void **);
89static void gzip_release(void **);
90
91static void puts(const char *);
92
93extern int _text; /* Defined in vmlinux.lds.S */
94extern int _end;
95static unsigned long free_mem_ptr;
96static unsigned long free_mem_end_ptr;
97
98#define HEAP_SIZE 0x10000
99
100#include "../../../../lib/inflate.c"
101
102static void *malloc(int size)
103{
104 void *p;
105
106 if (size < 0)
107 error("Malloc error\n");
108 if (free_mem_ptr == 0)
109 error("Memory error\n");
110
111 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
112
113 p = (void *) free_mem_ptr;
114 free_mem_ptr += size;
115
116 if (free_mem_ptr >= free_mem_end_ptr)
117 error("\nOut of memory\n");
118
119 return p;
120}
121
122static void free(void *where)
123{ /* Don't care */
124}
125
126static void gzip_mark(void **ptr)
127{
128 *ptr = (void *) free_mem_ptr;
129}
130
131static void gzip_release(void **ptr)
132{
133 free_mem_ptr = (long) *ptr;
134}
135
136void puts(const char *s)
137{
138}
139
140void *memset(void *s, int c, size_t n)
141{
142 int i;
143 char *ss = (char *) s;
144
145 for (i = 0; i < n; i++)
146 ss[i] = c;
147 return s;
148}
149
150void *memcpy(void *__dest, __const void *__src, size_t __n)
151{
152 int i;
153 char *d = (char *) __dest, *s = (char *) __src;
154
155 for (i = 0; i < __n; i++)
156 d[i] = s[i];
157 return __dest;
158}
159
160/* ===========================================================================
161 * Fill the input buffer. This is called only when the buffer is empty
162 * and at least one byte is really needed.
163 */
164static int fill_inbuf(void)
165{
166 if (insize != 0) {
167 error("ran out of input data\n");
168 }
169
170 inbuf = input_data;
171 insize = input_len;
172 inptr = 1;
173 return inbuf[0];
174}
175
176/* ===========================================================================
177 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
178 * (Used for the decompressed data only.)
179 */
180static void flush_window(void)
181{
182 ulg c = crc; /* temporary variable */
183 unsigned n;
184 uch *in, *out, ch;
185
186 in = window;
187 out = &output_data[output_ptr];
188 for (n = 0; n < outcnt; n++) {
189 ch = *out++ = *in++;
190 c = crc_32_tab[((int) c ^ ch) & 0xff] ^ (c >> 8);
191 }
192 crc = c;
193 bytes_out += (ulg) outcnt;
194 output_ptr += (ulg) outcnt;
195 outcnt = 0;
196 puts(".");
197}
198
199static void error(char *x)
200{
201 puts("\n\n");
202 puts(x);
203 puts("\n\n -- System halted");
204
205 while (1) ; /* Halt */
206}
207
208#define STACK_SIZE (4096)
209long __attribute__ ((aligned(8))) user_stack[STACK_SIZE];
210long *stack_start = &user_stack[STACK_SIZE];
211
212void decompress_kernel(void)
213{
214 output_data = (uch *) (CONFIG_MEMORY_START + 0x2000);
215 free_mem_ptr = (unsigned long) &_end;
216 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
217
218 makecrc();
219 puts("Uncompressing Linux... ");
220 cache_control(CACHE_ENABLE);
221 gunzip();
222 puts("\n");
223
224#if 0
225 /* When booting from ROM may want to do something like this if the
226 * boot loader doesn't.
227 */
228
229 /* Set up the parameters and command line */
230 {
231 volatile unsigned int *parambase =
232 (int *) (CONFIG_MEMORY_START + 0x1000);
233
234 parambase[0] = 0x1; /* MOUNT_ROOT_RDONLY */
235 parambase[1] = 0x0; /* RAMDISK_FLAGS */
236 parambase[2] = 0x0200; /* ORIG_ROOT_DEV */
237 parambase[3] = 0x0; /* LOADER_TYPE */
238 parambase[4] = 0x0; /* INITRD_START */
239 parambase[5] = 0x0; /* INITRD_SIZE */
240 parambase[6] = 0;
241
242 strcpy((char *) ((int) parambase + 0x100),
243 "console=ttySC0,38400");
244 }
245#endif
246
247 puts("Ok, booting the kernel.\n");
248
249 cache_control(CACHE_DISABLE);
250}
diff --git a/arch/sh/boot/compressed/vmlinux_64.lds b/arch/sh/boot/compressed/vmlinux_64.lds
new file mode 100644
index 000000000000..59c2ef4aeda5
--- /dev/null
+++ b/arch/sh/boot/compressed/vmlinux_64.lds
@@ -0,0 +1,64 @@
1/*
2 * ld script to make compressed SuperH/shmedia Linux kernel+decompression
3 * bootstrap
4 * Modified by Stuart Menefy from arch/sh/vmlinux.lds.S written by Niibe Yutaka
5 */
6
7
8#ifdef CONFIG_LITTLE_ENDIAN
9/* OUTPUT_FORMAT("elf32-sh64l-linux", "elf32-sh64l-linux", "elf32-sh64l-linux") */
10#define NOP 0x6ff0fff0
11#else
12/* OUTPUT_FORMAT("elf32-sh64", "elf32-sh64", "elf32-sh64") */
13#define NOP 0xf0fff06f
14#endif
15
16OUTPUT_FORMAT("elf32-sh64-linux")
17OUTPUT_ARCH(sh)
18ENTRY(_start)
19
20#define ALIGNED_GAP(section, align) (((ADDR(section)+SIZEOF(section)+(align)-1) & ~((align)-1))-ADDR(section))
21#define FOLLOWING(section, align) AT (LOADADDR(section) + ALIGNED_GAP(section,align))
22
23SECTIONS
24{
25 _text = .; /* Text and read-only data */
26
27 .text : {
28 *(.text)
29 *(.text64)
30 *(.text..SHmedia32)
31 *(.fixup)
32 *(.gnu.warning)
33 } = NOP
34 . = ALIGN(4);
35 .rodata : { *(.rodata) }
36
37 /* There is no 'real' reason for eight byte alignment, four would work
38 * as well, but gdb downloads much (*4) faster with this.
39 */
40 . = ALIGN(8);
41 .image : { *(.image) }
42 . = ALIGN(4);
43 _etext = .; /* End of text section */
44
45 .data : /* Data */
46 FOLLOWING(.image, 4)
47 {
48 _data = .;
49 *(.data)
50 }
51 _data_image = LOADADDR(.data);/* Address of data section in ROM */
52
53 _edata = .; /* End of data section */
54
55 .stack : { stack = .; _stack = .; }
56
57 . = ALIGN(4);
58 __bss_start = .; /* BSS */
59 .bss : {
60 *(.bss)
61 }
62 . = ALIGN(4);
63 _end = . ;
64}