There are some things I don't understand on the boot process of the STM32F4 microcontroller.
My understanding is as follows:
- The ARM Cortex-M4 boots expects the stack pointer initialization value and the interrupt vectors on
0x00000000 + SCB->VTOR
, whereasSCB->VTOR
is cleared at reset. - There is no memory at that location. Flash memory starts at
0x08000000
, SRAM at0x20000000
. - In order to make booting possible, the µC can map the flash or SRAM memory range to
0x00000000
. The memory range to be mapped is defined by the state of the boot pins.
My questions:
Why is the STM32F4 reference manual saying on page 69 that
When the device boots from SRAM, in the application initialization code, you have to relocate the vector table in SRAM using the NVIC exception table and the offset register.
? In my point of view this is not necessary, as the whole memory region is aliased anyway. Interestingly this doesn't seem to be required when the flash region is remapped to
0x0
space.The only use for booting from SRAM I can think if is to reduce write cycles on the flash during development. Before you release the µC from reset, you write the program to SRAM using the debugger and then boot from there. However, as you have debugger access, there wouldn't be any restrains on where to boot from anyway. So why having this feature?
That the boot position is derived from pins indicates (at least in my oppinion) that this feature is to be used not during development but in final operation. And in final operation, SRAM is clear at boot time. Hence it doesn't make sense to boot from SRAM.