2022-05-08 06:00:22 +00:00
|
|
|
#include <cstdint>
|
|
|
|
|
2022-05-09 03:55:01 +00:00
|
|
|
extern "C" uint32_t _bss_begin, _bss_end, _initial_stack_pointer;
|
2022-05-08 06:00:22 +00:00
|
|
|
extern "C" int main();
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
enum VectorTableEntry {
|
|
|
|
StackPointer = 0,
|
|
|
|
Reset = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
void ResetHandler() {
|
|
|
|
// clear .bss
|
|
|
|
for (uint32_t* ptr = &_bss_begin; ptr < &_bss_end; ptr++) {
|
|
|
|
*ptr = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
main();
|
|
|
|
|
|
|
|
while(true) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2022-05-17 03:56:25 +00:00
|
|
|
__attribute__((section(".vector_table"), used))
|
2022-05-08 06:00:22 +00:00
|
|
|
uint32_t vector_table[16] = {
|
2022-05-09 03:55:01 +00:00
|
|
|
[StackPointer] = reinterpret_cast<uint32_t>(&_initial_stack_pointer),
|
2022-05-08 06:00:22 +00:00
|
|
|
[Reset] = reinterpret_cast<uint32_t>(ResetHandler),
|
2022-05-09 03:55:01 +00:00
|
|
|
};
|