2016-11-09 08:25 PM
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-sequence2016-11-10 04:24 AM
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+0x080000002016-11-12 09:28 AM
Thanks Clive1,
That gives some clarity. I'll read some more about it and ask here if something comes up.