Add ARM basic bootloader build

This commit is contained in:
2022-05-07 23:00:22 -07:00
parent 47059c1c15
commit d83d42fb60
4 changed files with 100 additions and 0 deletions

30
arm/vector_table.cc Normal file
View File

@@ -0,0 +1,30 @@
#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),
};