You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
764 B
ArmAsm
36 lines
764 B
ArmAsm
.section .text._start // Make sure the linker put this at the begining of the
|
|
// .text section thanks to the `KEEP(*(.text._start))`
|
|
|
|
_start:
|
|
mrs x1, MPIDR_EL1
|
|
and x1, x1, #3
|
|
mov x2, #0
|
|
cmp x1, x2
|
|
b.ne ._exit // if core id != 0, wait forever
|
|
|
|
// Set bss to 0
|
|
ldr x0,=__bss_start
|
|
ldr x1,=__bss_end
|
|
._bss_loop:
|
|
cmp x0, x1
|
|
b.eq ._set_sp
|
|
stp xzr, xzr, [x0], #16
|
|
b ._bss_loop
|
|
|
|
// Set the stack pointer
|
|
._set_sp:
|
|
ldr x1,=__core_stack_end // the stack goest down
|
|
mov sp, x1
|
|
|
|
// go to rust
|
|
b _start_rust
|
|
|
|
._exit:
|
|
wfe // 'Wait For Event', put the cpu in low power mode
|
|
b ._exit
|
|
|
|
// define _start as a function
|
|
.size _start, . - _start
|
|
.type _start, function
|
|
.global _start
|