30 lines
508 B
C++
30 lines
508 B
C++
#include <cstdint>
|
|
|
|
extern "C" uint32_t _bss_begin, _bss_end;
|
|
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
|
|
|
|
__attribute__((section(".vector_table")))
|
|
uint32_t vector_table[16] = {
|
|
[StackPointer] = 0x00010000,
|
|
[Reset] = reinterpret_cast<uint32_t>(ResetHandler),
|
|
}; |