Line 44... |
Line 44... |
.equ SREG_RESUME_ACK, (1<<2) // -/w: CPU starts resuming
|
.equ SREG_RESUME_ACK, (1<<2) // -/w: CPU starts resuming
|
.equ SREG_EXECUTE_REQ, (1<<3) // r/-: DM requests to execute program buffer
|
.equ SREG_EXECUTE_REQ, (1<<3) // r/-: DM requests to execute program buffer
|
.equ SREG_EXECUTE_ACK, (1<<4) // -/w: CPU starts to execute program buffer
|
.equ SREG_EXECUTE_ACK, (1<<4) // -/w: CPU starts to execute program buffer
|
.equ SREG_EXCEPTION_ACK, (1<<5) // -/w: CPU has detected an exception
|
.equ SREG_EXCEPTION_ACK, (1<<5) // -/w: CPU has detected an exception
|
|
|
.file "debugger.S"
|
.file "park_loop.S"
|
.section .text
|
.section .text
|
.balign 4
|
.balign 4
|
.option norvc
|
.option norvc
|
.global _start
|
.global _start
|
.global entry_normal
|
.global entry_normal
|
.global entry_exception
|
.global entry_exception
|
|
|
|
|
_start:
|
_start:
|
|
|
// entry location on ebreak in debug-mode, halt request, or return from single-stepped instruction
|
// BASE + 0: entry for ebreak in debug-mode, halt request, or return from single-stepped instruction
|
entry_normal:
|
entry_normal:
|
jal zero, parking_loop_start
|
jal zero, parking_loop_start
|
|
|
// entry location for exceptions - signal EXCEPTION to DM and restart parking loop
|
// BASE + 4: entry for exceptions - signal EXCEPTION to DM and restart parking loop
|
entry_exception:
|
entry_exception:
|
csrw dscratch0, s0 // save s0 to dscratch0 so we have a general purpose register available
|
csrw dscratch0, s0 // save s0 to dscratch0 so we have a general purpose register available
|
addi s0, zero, SREG_EXCEPTION_ACK // mask exception acknowledge flag
|
addi s0, zero, SREG_EXCEPTION_ACK // mask exception acknowledge flag
|
sw s0, DBMEM_SREG_BASE(zero) // trigger exception acknowledge to inform DM
|
sw s0, DBMEM_SREG_BASE(zero) // trigger exception acknowledge to inform DM
|
csrr s0, dscratch0 // restore s0 from dscratch0
|
csrr s0, dscratch0 // restore s0 from dscratch0
|