I'm learning low-level details of the STM32. I am puzzled by how the vector table is setup.
In the reference manual, table 63, it lists the STM32F103C8's vector table. It goes from 0x00000000
through 0x00000130
. However, if you look at the generated files from STM32CubeMX (like startup_stm32f103xb.s), you notice it only lists entries until 0x00000108
, and at this address is the magic number 0xF108F85F
, which I eventually found information about here.
Why does the generated code's vector table have fewer entries than the reference manual's vector table? Are those last few entries not actually used, or they can somehow be omitted without consequence? Position 0x108 should be the handler for interrupt "TIM5 global interrupt". I don't know what this is but why is it that somehow the magic number above can be here instead of the actual handler?
It begs a related but different question, which is that on some bare metal STM32 code, the only entries defined in the vector table are the stack pointer and the reset handler. No other handlers. What happens here? Are those interrupts disabled by default? Or is that that since those handlers are undefined, the mcu behaviour will be undefined should those interrupts occur and the code just assumes those interrupts will not happen?
The reference manual linked is for a big family, STM32F10xxx, of devices, and each target/mcu variant in the family will have varying hardware peripheral blocks and functions. The number of maskable interrupts supported by a target vary with the available peripheral block. As such, the vector table could be then be reduced subset of the table listed for the family of devices, if a particular in the family has a reduced subset of peripherals. Consequently, everything that follows the vector table is moved up.
Looking through the product datasheet for the STM32F103C8 in specific, the peripheral blocks, as listed below, corresponding to the missing vectors are not available for the given target.
See table 2 in the product datasheet for an overview of the available peripheral blocks.
User contributions licensed under CC BY-SA 3.0