summaryrefslogtreecommitdiff
path: root/cpu/nios/start.S
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-05-19 21:33:14 +0000
committerwdenk <wdenk>2004-05-19 21:33:14 +0000
commite4cc71aa4403c82f0b3e89087024f83832ece9ec (patch)
tree48c8295c714dfbfe7be70796c87b41c2065f166f /cpu/nios/start.S
parent10767ccb86e0413633e7d89fbbb354014288b036 (diff)
downloadu-boot-imx-e4cc71aa4403c82f0b3e89087024f83832ece9ec.zip
u-boot-imx-e4cc71aa4403c82f0b3e89087024f83832ece9ec.tar.gz
u-boot-imx-e4cc71aa4403c82f0b3e89087024f83832ece9ec.tar.bz2
Patch by Scott McNutt, 25 Apr 2004:
Add Nios GDB/JTAG Console support: - Add stubs to support gdb via JTAG. - Add support for console over JTAG. - Minor cleanup.
Diffstat (limited to 'cpu/nios/start.S')
-rw-r--r--cpu/nios/start.S51
1 files changed, 51 insertions, 0 deletions
diff --git a/cpu/nios/start.S b/cpu/nios/start.S
index 7cbd1a7..cb1af3c 100644
--- a/cpu/nios/start.S
+++ b/cpu/nios/start.S
@@ -93,6 +93,14 @@ _start:
subi %g6, 4 /* %g6 <- src addr */
ld %g7, [%g7] /* %g7 <- dst addr */
+ /* No need to move text sections if we're already located
+ * at the proper address.
+ */
+ cmp %g7, %g6
+ ifs cc_z
+ br reloc
+ nop /* delay slot */
+
1: cmp %g7, %g5
skps cc_nz
br 2f
@@ -114,6 +122,7 @@ _start:
pfx %xhi(reloc@h)
movhi %g0, %xlo(reloc@h)
jmp %g0
+ nop /* delay slot */
reloc:
/*
@@ -141,6 +150,48 @@ reloc:
4:
/*
+ * INIT VECTOR TABLE
+ */
+ pfx %hi(CFG_VECT_BASE)
+ movi %g0, %lo(CFG_VECT_BASE)
+ pfx %xhi(CFG_VECT_BASE)
+ movhi %g0, %xlo(CFG_VECT_BASE) /* dst */
+ mov %l0, %g0
+
+ pfx %hi(_vectors)
+ movi %g1, %lo(_vectors)
+ pfx %xhi(_vectors)
+ movhi %g1, %xlo(_vectors) /* src */
+ bgen %g2, 6 /* cnt = 64 */
+
+ ldp %g3, [%l0, 3] /* bkpt vector */
+ ldp %g4, [%l0, 4] /* single step vector */
+
+5: ld %g7, [%g1]
+ addi %g1, 4 /* src++ */
+ st [%g0], %g7
+ addi %g0, 4 /* dst++ */
+
+ subi %g2, 1 /* cnt-- */
+ ifrnz %g2
+ br 5b
+ nop /* delay slot */
+
+#if defined(CONFIG_ROM_STUBS)
+ /* Restore the breakpoint and single step exception
+ * vectors to their original values.
+ */
+ stp [%l0,3], %g3 /* breakpoint */
+ stp [%l0,4], %g4 /* single step */
+#endif
+
+ /* For debug startup convenience ... software breakpoints
+ * set prior to this point may not succeed ;-)
+ */
+ .global __start
+__start:
+
+ /*
* Call board_init -- never returns
*/
pfx %hi(board_init@h)