2022-05-10 18:20:02 +00:00
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
extern "C" int main();
|
|
|
|
extern uint32_t _bss_begin, _bss_end, _initial_stack_pointer;
|
|
|
|
|
2022-05-17 03:57:51 +00:00
|
|
|
__attribute__((section(".app_init"), used)) void AppInit() {
|
2022-05-10 18:20:02 +00:00
|
|
|
*(uint32_t*)(0x40000000) = 0;
|
2022-05-17 03:57:51 +00:00
|
|
|
asm("mov sp, %0" : : "r"(&_initial_stack_pointer) :);
|
2022-05-10 18:20:02 +00:00
|
|
|
|
|
|
|
// clear .bss
|
|
|
|
for (uint32_t* ptr = &_bss_begin; ptr < &_bss_end; ptr++) {
|
|
|
|
*ptr = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
main();
|
|
|
|
|
2022-05-17 03:57:51 +00:00
|
|
|
while (true) {
|
|
|
|
}
|
2022-05-10 18:20:02 +00:00
|
|
|
}
|