cancel
Showing results for 
Search instead for 
Did you mean: 

How RESET address is determined in STM32?

navintiwari08
Associate III
Posted on November 10, 2016 at 05:25

Hi,

I know that when a stm32 mcu resets, it first jumps to address 0x0 where a vector table resides. And then it jumps to reset handler. My question is, how is the vector table flashed at address 0x0 ? Is it decided by the startup file or the linker script. Also, if flash address space starts at 0x80000000, how is the code flashed here. Is that also decided by linker script or startup file. I'm a little confused about the whole reset sequence. Is there any wiki where I can find all the info?

Thanks!

#stm32 #reset-sequence
2 REPLIES 2
Posted on November 10, 2016 at 13:24

You build your code for 0x08000000 (not 0x80000000, or 0)

The FLASH memory physically starts at 0x08000000

The BOOTx pins decided what is also mapped at zero, this basically a ''shadow'' where the address decoder understands multiple address ranges enable the chip select for the FLASH

The Cortex-Mx just pulls the Initial SP/PC from the vector table, the PC will be in the 0x08000000 region, and off it will go. Similarly even if SCB->VTOR continues to be zero it will pull the execution addresses for your IRQs from the zero region mapped vector table, and go immediately to the 0x08000000 region code pointed to in the table.

Now, you could technically build the code to reside at zero, but you'd have to load that into the ST-LINK Utilities as a binary, or otherwise code your own flashing code that recognizes that the write you want goes to Address+0x08000000

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
navintiwari08
Associate III
Posted on November 12, 2016 at 18:28

Thanks Clive1,

That gives some clarity. I'll read some more about it and ask here if something comes up.