33 lines
676 B
ArmAsm
33 lines
676 B
ArmAsm
# startup.s - Baremetal startup code for Milk-V Duo
|
|
|
|
#/* Baremetal Risc-V USB <=> Amiga Joystick/Mouse HID converter.
|
|
#* March 2026 - Anders Holck
|
|
#* This software has no license. If you choose to use, please include my name :)
|
|
#*/
|
|
|
|
.section .text.startup
|
|
.global _start
|
|
|
|
_start:
|
|
# 1. Disable interrupts
|
|
csrw mie, zero
|
|
|
|
# 2. Set up stack pointer (end of SRAM)
|
|
li sp, 0x0E000000 + 128*1024
|
|
|
|
# 3. Clear BSS
|
|
la t0, _bss_start
|
|
la t1, _bss_end
|
|
|
|
bss_clear_loop:
|
|
bgeu t0, t1, bss_clear_done
|
|
sd zero, 0(t0)
|
|
addi t0, t0, 8
|
|
j bss_clear_loop
|
|
|
|
bss_clear_done:
|
|
j main
|
|
|
|
.section .text
|
|
# The main function will be in amiga_joystick_mouse.s
|