Update of /cvsroot/blob/blob/src/diag
In directory usw-pr-cvs1:/tmp/cvs-serv19570
Modified Files:
Makefile.am ld-script start.S
Added Files:
stack.S
Log Message:
Also move the diag stack into the .bss section
--- NEW FILE: stack.S ---
/*
* stack.S: diag stack
*
* Copyright (C) 2001 Erik Mouw (J.A...@it...)
*
* $Id: stack.S,v 1.1 2001/10/28 22:14:20 erikm Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
.ident "$Id: stack.S,v 1.1 2001/10/28 22:14:20 erikm Exp $"
#ifdef HAVE_CONFIG_H
# include <blob/config.h>
#endif
.section ".stack"
/* 8kB stack should be enough */
.space (8 * 1024)
Index: Makefile.am
===================================================================
RCS file: /cvsroot/blob/blob/src/diag/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile.am 2001/10/09 17:55:04 1.4
+++ Makefile.am 2001/10/28 22:14:20 1.5
@@ -36,6 +36,7 @@
# be linked in the wrong order!
diag_elf32_SOURCES = \
start.S \
+ stack.S \
command_hist.c \
commands.c \
initcalls.c \
@@ -47,7 +48,8 @@
diag_elf32_DEPENDENCIES = \
@LCD@ \
- @DIAG_PLATFORM_OBJ@
+ @DIAG_PLATFORM_OBJ@ \
+ ld-script
diag_elf32_LDFLAGS += \
-Wl,-T,${srcdir}/ld-script
Index: ld-script
===================================================================
RCS file: /cvsroot/blob/blob/src/diag/ld-script,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ld-script 2001/10/07 22:09:54 1.1
+++ ld-script 2001/10/28 22:14:20 1.2
@@ -52,6 +52,15 @@
/* the BSS section should be the last section */
. = ALIGN(4);
- .bss : { *(.bss) }
-}
+ .bss : {
+ __bss_start = .;
+ /* first the real BSS data */
+ *(.bss)
+ /* and next the stack */
+ . = ALIGN(4);
+ *(.stack)
+ __stack_end = .;
+ __bss_end = .;
+ }
+}
Index: start.S
===================================================================
RCS file: /cvsroot/blob/blob/src/diag/start.S,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- start.S 2001/10/07 22:09:54 1.1
+++ start.S 2001/10/28 22:14:20 1.2
@@ -26,15 +26,30 @@
.globl _start
_start:
- /* set up the stack pointer */
- ldr r0, MEM_START
- add r1, r0, #(1024 * 1024)
- sub sp, r1, #0x04
+ /* clear the BSS section */
+ ldr r1, bss_start
+ ldr r0, bss_end
+ sub r0, r0, r1
+ /* r1 = start address */
+ /* r0 = #number of bytes */
+ mov r2, #0
+
+clear_bss:
+ stmia r1!, {r2}
+ subs r0, r0, #4
+ bne clear_bss
+
+ /* setup the stack pointer */
+ ldr r0, stack_end
+ sub sp, r0, #4
+
loop:
bl main
/* if main ever returns we just call it again */
- b loop
+ b _start
-/* main memory starts at 0xc0000000 */
-MEM_START: .long 0xc0000000
+
+bss_start: .word __bss_start
+bss_end: .word __bss_end
+stack_end: .word __stack_end
|