42 lines
704 B
ArmAsm
42 lines
704 B
ArmAsm
.section .text.start, "ax", @progbits
|
|
.globl _start
|
|
_start:
|
|
.option push
|
|
.option norelax
|
|
la gp, __global_pointer$
|
|
.option pop
|
|
|
|
li t0, 0x6000
|
|
csrs mstatus, t0
|
|
|
|
# Keep this numeric: BootROM code is too far from DTIM for a PC-relative la.
|
|
li sp, (BSP_DTIM_BASE + BSP_DTIM_SIZE)
|
|
|
|
# BSS is in DTIM while this code runs from BootROM; load far addresses from ROM literals.
|
|
la t2, bss_bounds
|
|
ld t0, 0(t2)
|
|
ld t1, 8(t2)
|
|
1:
|
|
bgeu t0, t1, 2f
|
|
sd zero, 0(t0)
|
|
addi t0, t0, 8
|
|
j 1b
|
|
|
|
2:
|
|
call bsp_init
|
|
call main
|
|
li t0, 0x5a5a0000
|
|
or a0, a0, t0
|
|
csrw mscratch, a0
|
|
fence
|
|
|
|
3:
|
|
wfi
|
|
j 3b
|
|
|
|
.section .rodata, "a", @progbits
|
|
.align 3
|
|
bss_bounds:
|
|
.dword __bss_start
|
|
.dword __bss_end
|