1. Entry Phase

The Vector Table:
Address 0x00000000

Once the voltage is stable and the clock is ticking, the CPU performs its first "magic" trick. It doesn't start at a random place. It looks at the very beginning of the memory—address 0x00000000.

00000000 2000 0400 // Initial Stack Pointer (MSP)
00000004 0800 0101 // Reset Vector (Entry Address)
00000008 0800 0451 // NMI Handler
0000000C 0800 045D // HardFault Handler

The First 8 Bytes

According to the Arm architecture (standardized across most MCUs like STM32, NXP, and TI), the CPU expects two specific values to be ready before it can move:

📚

1. Main Stack Pointer (Address 0x0)

Before the CPU can even call a sub-routine or handle an interrupt, it needs a Stack—a region of RAM where it stores temporary data. The very first task is loading the top of RAM address into the MSP register.

🏁

2. Reset Vector (Address 0x4)

This is the address of the Reset_Handler. It is the location of the first line of assembly code that will execute. The CPU takes this address and places it directly into the Program Counter (PC).

Pro Insight from Chapter 4: Why is the Reset Vector address always odd (e.g., 0x01 instead of 0x00)? In Arm Thumb-2 architecture, the last bit must be set to '1' to indicate the CPU should start in Thumb Mode. If it were '0', the CPU might try to run in ARM mode and immediately crash!

How does the linker put these values there?

Next: Memory Layout & SRAM →