cpq / bare-metal-programming-guide

A bare metal programming guide (ARM microcontrollers)
MIT License
3.27k stars 284 forks source link

Setting SP using vector table #15

Closed nscooling closed 1 year ago

nscooling commented 1 year ago

is there any particular reason you doing:

asm("ldr sp, = _estack");  // Set initial stack pointer

rather than

__attribute__((section(".vectors"))) void (*tab[16 + 91])(void) = {
  _estack, _reset
};

Vector zero should contain the initial stack pointer

cpq commented 1 year ago

@nscooling you are correct!

The assembly code is a leftover from the earlier version, where a vector table contained 0 instead of _estack. I'll cleanup the redundant asm instructions.