summaryrefslogtreecommitdiffstats
path: root/c/src/lib
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-05-24 13:21:56 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-05-24 13:21:56 +0000
commitbb3efe9e64ed3caac083a2827d1fc2108361a2fd (patch)
treed74289090f220424453f271ed59f99da3fedb009 /c/src/lib
parent2001-05-24 Greg Menke <gregory.menke@gsfc.nasa.gov> (diff)
downloadrtems-bb3efe9e64ed3caac083a2827d1fc2108361a2fd.tar.bz2
2001-05-24 Greg Menke <gregory.menke@gsfc.nasa.gov>
* Assisted in design and debug by Joel Sherrill <joel@OARcorp.com>. * start/regs.S, start/start.S: Now works on Mongoose-V. Missed in previous patch.
Diffstat (limited to 'c/src/lib')
-rw-r--r--c/src/lib/libbsp/mips/genmongoosev/ChangeLog6
-rw-r--r--c/src/lib/libbsp/mips/genmongoosev/start/regs.S2
-rw-r--r--c/src/lib/libbsp/mips/genmongoosev/start/start.S103
3 files changed, 96 insertions, 15 deletions
diff --git a/c/src/lib/libbsp/mips/genmongoosev/ChangeLog b/c/src/lib/libbsp/mips/genmongoosev/ChangeLog
index 617bfaf187..63c33eed2d 100644
--- a/c/src/lib/libbsp/mips/genmongoosev/ChangeLog
+++ b/c/src/lib/libbsp/mips/genmongoosev/ChangeLog
@@ -1,3 +1,9 @@
+2001-05-24 Greg Menke <gregory.menke@gsfc.nasa.gov>
+
+ * Assisted in design and debug by Joel Sherrill <joel@OARcorp.com>.
+ * start/regs.S, start/start.S: Now works on Mongoose-V. Missed
+ in previous patch.
+
2001-05-22 Greg Menke <gregory.menke@gsfc.nasa.gov>
* Assisted in design and debug by Joel Sherrill <joel@OARcorp.com>.
diff --git a/c/src/lib/libbsp/mips/genmongoosev/start/regs.S b/c/src/lib/libbsp/mips/genmongoosev/start/regs.S
index c673e5e1c9..0d1ec23d02 100644
--- a/c/src/lib/libbsp/mips/genmongoosev/start/regs.S
+++ b/c/src/lib/libbsp/mips/genmongoosev/start/regs.S
@@ -53,6 +53,8 @@
#define fp0 $f0
#define fp1 $f1
+#define WATCHDOG 0xBE000000
+
/* Useful memory constants: */
#define K0BASE 0x80000000
#ifndef __mips64
diff --git a/c/src/lib/libbsp/mips/genmongoosev/start/start.S b/c/src/lib/libbsp/mips/genmongoosev/start/start.S
index 525232e2c8..609aaac4df 100644
--- a/c/src/lib/libbsp/mips/genmongoosev/start/start.S
+++ b/c/src/lib/libbsp/mips/genmongoosev/start/start.S
@@ -17,6 +17,15 @@
* they apply.
*/
+
+
+#define PMON_UTIL_ROUTINES 0xbfc00200
+#define UTIL_WARMSTART_VECTOR 21*4
+#define UTIL_CPUINIT_VECTOR 22*4
+#define UTIL_CONFIGUART_VECTOR 23*4
+#define UTIL_PUTCHROM_VECTOR 24*4
+
+
#include <asm.h>
#include "regs.S"
@@ -37,6 +46,13 @@
# define LA(t,x) la t,x
#endif /* __mips_embedded_pic */
+
+/* defined by linkcmds, pointing to the start of the relocation target
+ memory, referenced in this way so we can avoid defining it
+ multiply */
+
+
+
.text
.align 2
@@ -56,30 +72,77 @@ _start:
$LF1 = . + 8
bal $LF1
nop
+
_branch:
- move $5, $31 # $5 == where are we
- li $6, 0x8800000c # $6 == where we want to be
- #la $6,_branch
- beq $5, $6, _start_in_ram
+ move a1, ra /* save return address from the jump above */
+
+ /* call down into PMON's CpuInit, so we avoid having to
+ duplicate all that code plus remember to update both copies
+ when something changes... Note, a1 must be preserved by
+ CpuInit */
+
+ li t7,PMON_UTIL_ROUTINES /* get base address of pmon's vector table */
+ lw t0,UTIL_CPUINIT_VECTOR(t7)
+ nop
+ jal t0 /* init cpu */
+ nop
+
+ lw t0,UTIL_CONFIGUART_VECTOR(t7)
+ nop
+ jal t0 /* reconfigure UART for console output */
+ nop
+
+ lw t0,UTIL_PUTCHROM_VECTOR(t7)
+ li a0,'b' /* show we booted */
+ jal t0
+
+
+
+ /*
+ get the address of the _branch label above as it would appear in
+ the relocated code
+ */
+ la a2, _branch /* relocation destination */
+
+ beq a1, a2, _start_in_ram /* skip relocating if we're already there */
nop
- # relocate the code from EEPROM to RAM
- la $7, _edata
+
+ /* relocate the code from EEPROM to RAM */
+
+ lw t0,UTIL_PUTCHROM_VECTOR(t7)
+ li a0,'r' /* show we're starting relocation */
+ jal t0
+
+ la a3, _edata
relocate:
- lw $8, ($5) # $8 = *EEPROM
- addu $5, $5, 4 # EEPROM++
- sw $8, ($6) # *RAM = $8
- addu $6, $6, 4 # RAM++
- bne $6, $7, relocate # copied all the way to edata?
+ lw t0, (a1) /* load from EEPROM */
+ addu a1, 4
+ sw t0, (a2) /* store to RAM */
+ addu a2, 4
+ bne a2, a3, relocate /* copied all the way to edata? */
nop
- la $6, _start_in_ram
- jr $6
+
+ lw t0,UTIL_PUTCHROM_VECTOR(t7)
+ li a0,'R' /* show we relocated */
+ jal t0
+ nop
+
+ la a2, _start_in_ram
+ jr a2
nop
.end _start
+
+
+
+
.globl _start_in_ram
.ent _start_in_ram
_start_in_ram:
+ lw t0,UTIL_PUTCHROM_VECTOR(t7)
+ li a0,'S' /* show we're starting in the target address range */
+ jal t0
nop
#ifdef __mips_embedded_pic
@@ -181,13 +244,23 @@ init:
.globl _sys_exit
.ent _sys_exit
_sys_exit:
-7:
#ifdef GCRT0
jal _mcleanup
nop
#endif
+
+ /* return non-zero if we want default behavior, else return to pmon */
+ bne a0,zero,7f
+ nop
+
+ li t0,PMON_UTIL_ROUTINES /* base address of PMON's util_routines table */
+ lw t0,UTIL_WARMSTART_VECTOR(t0) /* retrieve _warmstart vector at offset 21*4 */
+ nop
+ j t0 /* and jump */
+ nop
+
# break instruction can cope with 0xfffff, but GAS limits the range:
- break 1023
+7: break 1023
nop
b 7b # but loop back just in-case
nop