Commit 329f0bd9 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra

Added a weak _debug_unit symbol to crt0.S.

When linked against debug.S, which provides this symbol, this will setup debugging.
If not linked against debug.S the symbol will be the same as _reset_handler.
parent 690daff9
......@@ -88,8 +88,9 @@
.section .boot, "ax", @progbits
.global _start
.weak _debug_unit
.global _reset_handler
.type _reset_handler, @function
......@@ -127,6 +128,12 @@ _interrupt_handler:
/* Clear r0 */
xor r0, r0, r0
/* Setup the debug ROM if it's linked in */
mvhi r1, hi(_debug_unit)
ori r1, r1, lo(_debug_unit)
wcsr DEBA
/* Setup stack and global pointer */
mvhi sp, hi(_fstack)
ori sp, sp, lo(_fstack)
......@@ -139,7 +146,7 @@ _crt0:
mvhi r3, hi(_ebss)
ori r3, r3, lo(_ebss)
sub r3, r3, r1
calli memset
calli memset
mvi r1, 0
mvi r2, 0
mvi r3, 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment