← All posts

What a Cortex-M core does before your first instruction

Sample article. Replace it with your own content, or edit it and keep it.

When reset is released, an ARMv7-M core (Cortex-M3/M4/M7) does not run any software to find its first instruction. The architecture defines this behaviour:

  1. SP_main is loaded from vector table entry 0.
  2. PC is loaded from vector table entry 1 (the reset vector). Bit 0 must be 1 to show Thumb state; it is cleared from PC and sets EPSR.T.
  3. Execution starts at that address.

Where is the vector table at reset?

The vector table is at the address held in VTOR. What VTOR holds at reset depends on the core:

Core VTOR at reset
Cortex-M3 / M4 0x00000000 (fixed)
Cortex-M7 Set by the INITVTOR input chosen by the SoC designer
Cortex-M23 / M33 INITSVTOR / INITNSVTOR inputs

So on a Cortex-M4, whatever memory the SoC decodes at address 0x0 supplies the first two words. That could be a boot ROM, flash, or an aliased region.

Why this matters in validation

Always check this against the device datasheet and the ARMv7-M Architecture Reference Manual.