55 lines
1.1 KiB
ArmAsm
55 lines
1.1 KiB
ArmAsm
#include "regdef.h"
|
|
|
|
.section .init
|
|
.globl _start
|
|
.type _start, @function
|
|
|
|
_start:
|
|
/* Enable direct mapped windows used by SRAM and uncached peripherals. */
|
|
li.w t0, 0x8
|
|
li.w t1, 0x18
|
|
csrxchg t0, t1, csr_crmd
|
|
|
|
csrwr zero, csr_dmw0
|
|
csrwr zero, csr_dmw1
|
|
li.w t0, 0x19
|
|
csrwr t0, csr_dmw0
|
|
li.w t0, 0xa0000009
|
|
csrwr t0, csr_dmw1
|
|
|
|
li.w t0, 0x10
|
|
li.w t1, 0x18
|
|
csrxchg t0, t1, csr_crmd
|
|
|
|
/* Polling-only benchmark: keep interrupts disabled. */
|
|
li.w t0, 0x4
|
|
csrxchg zero, t0, csr_crmd
|
|
csrwr zero, csr_prmd
|
|
csrwr zero, csr_ecfg
|
|
|
|
/* UART0 init, 115200 baud with the same divisor selection as BSP start.S. */
|
|
li.w t0, 0xbf000000
|
|
li.w t1, 0x07
|
|
st.b t1, t0, 2
|
|
li.w t1, 0x80
|
|
st.b t1, t0, 3
|
|
st.b zero, t0, 1
|
|
li.w t2, 0xbf20f500
|
|
ld.w t2, t2, 0
|
|
li.w t1, 0x1b
|
|
beq zero, t2, 1f
|
|
li.w t1, 0x1
|
|
1:
|
|
st.b t1, t0, 0
|
|
li.w t1, 0x03
|
|
st.b t1, t0, 3
|
|
st.b zero, t0, 4
|
|
|
|
la.local sp, _stack
|
|
li.w a0, 0
|
|
li.w a1, 0
|
|
bl main
|
|
|
|
1:
|
|
b 1b
|