diff --git a/arm/bootloader.ld b/arm/bootloader.ld index e84d6fc..d13401e 100644 --- a/arm/bootloader.ld +++ b/arm/bootloader.ld @@ -29,4 +29,6 @@ SECTIONS *(.exidx*) __exidx_end = .; } > ICTM -} \ No newline at end of file + + _initial_stack_pointer = 16384; +} diff --git a/arm/vector_table.cc b/arm/vector_table.cc index c2f54ad..1c6b572 100644 --- a/arm/vector_table.cc +++ b/arm/vector_table.cc @@ -1,6 +1,6 @@ #include -extern "C" uint32_t _bss_begin, _bss_end; +extern "C" uint32_t _bss_begin, _bss_end, _initial_stack_pointer; extern "C" int main(); namespace { @@ -25,6 +25,6 @@ void ResetHandler() { __attribute__((section(".vector_table"))) uint32_t vector_table[16] = { - [StackPointer] = 0x00010000, + [StackPointer] = reinterpret_cast(&_initial_stack_pointer), [Reset] = reinterpret_cast(ResetHandler), -}; \ No newline at end of file +};