Fixed the mess with all the different stacks


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@204 a1c6a512-1295-4272-9138-f99709370657
diff --git a/gdb/linker.cfg b/gdb/linker.cfg
index 621492a..5d5334b 100644
--- a/gdb/linker.cfg
+++ b/gdb/linker.cfg
@@ -10,16 +10,17 @@
         *(.rodata)
     }
 
-    .bss :
-    {
-       _stack = . + 0x1000;
-    }
-
     .text :
     {
         *(.text)
     }
 
+    .bss :
+    {
+       _stack = . + 0x1000;
+       _stub_stack = _stack + 0x1000;
+    }
+
     .pad 0x0900C800 :
     {
         LONG(0);
diff --git a/gdb/sh-stub.c b/gdb/sh-stub.c
index 4def26b..2eb6a5d 100644
--- a/gdb/sh-stub.c
+++ b/gdb/sh-stub.c
@@ -358,12 +358,11 @@
 void breakpoint (void);
 
 
-#define init_stack_size 2*1024  /* if you change this you should also modify BINIT */
-#define stub_stack_size 2*1024
+//#define stub_stack_size 2*1024
 
-int init_stack[init_stack_size] __attribute__ ((section ("stack"))) = {0};
-int stub_stack[stub_stack_size] __attribute__ ((section ("stack"))) = {0};
+//int stub_stack[stub_stack_size] __attribute__ ((section (".stack"))) = {0};
 
+extern int stub_stack[];
 
 void INIT (void);
 void start (void);
@@ -934,6 +933,8 @@
 /**** Processor-specific routines start here ****/
 /**** Processor-specific routines start here ****/
 
+extern int stack[];
+
 /* SH1/SH2 exception vector table format */
 typedef struct
 {
@@ -949,13 +950,12 @@
 ** Note that we only define the first 128 vectors, since the Jukebox
 ** firmware has its entry point at 0x200
 */
-
 const vec_type vectable  __attribute__ ((section (".vectors"))) =
 { 
     &start,			        /* 0: Power-on reset PC */
-    init_stack + init_stack_size,       /* 1: Power-on reset SP */
+    stack,                              /* 1: Power-on reset SP */
     &start,			        /* 2: Manual reset PC */
-    init_stack + init_stack_size,       /* 3: Manual reset SP */
+    stack,                              /* 3: Manual reset SP */
     {
         &catch_exception_4,		/* 4: General invalid instruction */
         &catch_exception_5,  	        /* 5: Reserved for system */
@@ -1097,7 +1097,7 @@
     dofault = 1;
     stepped = 0;
 
-    stub_sp = stub_stack + stub_stack_size;
+    stub_sp = stub_stack;
     breakpoint ();
 
     /* We should never come here */
@@ -1115,7 +1115,7 @@
          "         bra   _INIT\n"
          "         nop\n"
          "         .align 2\n"
-         "L_sp:    .long _init_stack + 8000");
+         "L_sp:    .long _stack");
 
     asm("saveRegisters:\n");
     asm(" mov.l	@(L_reg, pc), r0\n"
diff --git a/gdb/start.s b/gdb/start.s
index 88ad906..e902db7 100644
--- a/gdb/start.s
+++ b/gdb/start.s
@@ -23,7 +23,7 @@
 	.section	.text
 	.extern	_INIT
 	.extern _vectable
-	.extern _init_stack
+	.extern _stack
 	.global _start
 	.align  2
 
@@ -36,6 +36,6 @@
 	nop
 
 1:	.long	_vectable
-2:	.long	_init_stack+2*1024*4
+2:	.long	_stack
 3:	.long	_INIT
 	.type		_start,@function