arm: fix initial stack pointer

This commit is contained in:
Paul Mathieu 2022-05-08 20:55:01 -07:00
parent f3d875b4ac
commit dae76c4e17
2 changed files with 6 additions and 4 deletions

View File

@ -29,4 +29,6 @@ SECTIONS
*(.exidx*) *(.exidx*)
__exidx_end = .; __exidx_end = .;
} > ICTM } > ICTM
_initial_stack_pointer = 16384;
} }

View File

@ -1,6 +1,6 @@
#include <cstdint> #include <cstdint>
extern "C" uint32_t _bss_begin, _bss_end; extern "C" uint32_t _bss_begin, _bss_end, _initial_stack_pointer;
extern "C" int main(); extern "C" int main();
namespace { namespace {
@ -25,6 +25,6 @@ void ResetHandler() {
__attribute__((section(".vector_table"))) __attribute__((section(".vector_table")))
uint32_t vector_table[16] = { uint32_t vector_table[16] = {
[StackPointer] = 0x00010000, [StackPointer] = reinterpret_cast<uint32_t>(&_initial_stack_pointer),
[Reset] = reinterpret_cast<uint32_t>(ResetHandler), [Reset] = reinterpret_cast<uint32_t>(ResetHandler),
}; };