1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-05-28 08:41:30 +00:00
8bitworkshop/src/worker/lib/arm32/crt0.c

22 lines
510 B
C
Raw Normal View History

2023-12-30 04:46:57 +00:00
int entry();
__attribute__((weak, naked, noinline, noreturn)) void _start() {
2024-01-01 22:35:13 +00:00
// set bss segment symbols
2023-12-30 04:46:57 +00:00
asm(".global __bss_start__, __bss_end__");
asm("__bss_start__ = _edata");
asm("__bss_end__ = _end");
2024-01-01 22:35:13 +00:00
// set stack pointer
asm("mov sp, #0x100000");
// run main()
2023-12-30 04:46:57 +00:00
entry();
2024-01-01 22:35:13 +00:00
// wait for next video frame
while (*(volatile int*)0x4000020 != 0) { }
// halt cpu
2023-12-30 04:46:57 +00:00
asm(".long 0xe7f000f0"); // udf #0
}
void _Exit(int ec) {
asm(".long 0xe7f000f0"); // udf #0
}