Line 36... |
Line 36... |
.section .text.boot
|
.section .text.boot
|
.balign 4
|
.balign 4
|
.global _start
|
.global _start
|
|
|
|
|
// IO region
|
|
.equ IO_BEGIN, 0xFFFFFF00 // start of processor-internal IO region
|
|
|
|
|
|
_start:
|
_start:
|
.cfi_startproc
|
.cfi_startproc
|
.cfi_undefined ra
|
.cfi_undefined ra
|
|
|
// *********************************************************
|
// *********************************************************
|
Line 56... |
Line 52... |
addi x3, x0, 0
|
addi x3, x0, 0
|
addi x4, x0, 0
|
addi x4, x0, 0
|
addi x5, x0, 0
|
addi x5, x0, 0
|
addi x6, x0, 0
|
addi x6, x0, 0
|
addi x7, x0, 0
|
addi x7, x0, 0
|
addi x8, x0, 0
|
//addi x8, x0, 0
|
addi x9, x0, 0
|
//addi x9, x0, 0
|
//addi x10, x0, 0
|
//addi x10, x0, 0
|
//addi x11, x0, 0
|
//addi x11, x0, 0
|
//addi x12, x0, 0
|
//addi x12, x0, 0
|
//addi x13, x0, 0
|
//addi x13, x0, 0
|
addi x14, x0, 0
|
addi x14, x0, 0
|
Line 102... |
Line 98... |
// no access from less-privileged modes to counter CSRs
|
// no access from less-privileged modes to counter CSRs
|
csrw mcounteren, zero
|
csrw mcounteren, zero
|
|
|
// stop all counters except for [m]cycle[h] and [m]instret[h]
|
// stop all counters except for [m]cycle[h] and [m]instret[h]
|
li x11, ~5
|
li x11, ~5
|
csrw mcountinhibit, x11
|
csrw 0x320, x11 // mcountinhibit (literal address for lagacy toolchain compatibility)
|
|
|
// clear cycle counters
|
// clear cycle counters
|
csrw mcycle, zero
|
csrw mcycle, zero
|
csrw mcycleh, zero
|
csrw mcycleh, zero
|
|
|
Line 150... |
Line 146... |
// Reset/deactivate IO/peripheral devices
|
// Reset/deactivate IO/peripheral devices
|
// Devices, that are not implemented, will cause a store access fault
|
// Devices, that are not implemented, will cause a store access fault
|
// which is captured but actually ignored due to the dummy handler.
|
// which is captured but actually ignored due to the dummy handler.
|
// *********************************************************
|
// *********************************************************
|
__crt0_reset_io:
|
__crt0_reset_io:
|
li x11, IO_BEGIN // start of processor-internal IO region
|
la x8, __ctr0_io_space_begin // start of processor-internal IO region
|
|
la x9, __ctr0_io_space_end // end of processor-internal IO region
|
|
|
__crt0_reset_io_loop:
|
__crt0_reset_io_loop:
|
sw zero, 0(x11)
|
sw zero, 0(x8)
|
addi x11, x11, 4
|
addi x8, x8, 4
|
bne zero, x11, __crt0_reset_io_loop
|
bne x8, x9, __crt0_reset_io_loop
|
|
|
|
|
// *********************************************************
|
// *********************************************************
|
// Clear .bss section (byte-wise) using linker script symbols
|
// Clear .bss section (byte-wise) using linker script symbols
|
// *********************************************************
|
// *********************************************************
|