20 lines
376 B
C++
20 lines
376 B
C++
#include <cstdint>
|
|
|
|
extern "C" uint32_t _bss_begin, _bss_end, _initial_stack_pointer;
|
|
extern "C" int main();
|
|
|
|
__attribute__((section(".start"), used, naked))
|
|
void _start() {
|
|
// clear .bss
|
|
for (uint32_t* ptr = &_bss_begin; ptr < &_bss_end; ptr++) {
|
|
*ptr = 0;
|
|
}
|
|
|
|
asm volatile ( "la sp, _initial_stack_pointer" );
|
|
|
|
main();
|
|
|
|
while (true) {
|
|
}
|
|
}
|