← Back to the chapter · Previous detail · Next detail →

Technical detail · Microcontroller Programming: Setup and GPIO

Cortex-M exception entry

The vector table lists the handler addresses the processor uses for reset, faults, and interrupts. An interrupt request (IRQ) signals that a peripheral needs attention. The stack pointer tracks the current place in working memory for saved data; the link register holds a return address, and the program counter identifies the current instruction location. These pieces let the processor enter a handler and resume work.

On a Cortex-M style board, that hidden machinery has a concrete execution model. Normal application work runs in thread mode; an interrupt briefly runs in handler mode, then returns. Core registers such as r0 through r3 carry arguments and return values, while r13, r14, and r15 act as the stack pointer, link register, and program counter. The vector table at address 0x0, or at a relocated vector-table address on some firmware, points reset, fault, service, and chip-specific IRQ entries at their handlers. A prototype record does not need to memorize every register, but it should prove that the intended IRQ is attached, the fault path is visible, and shared values are copied safely when handler code and normal loop code touch the same state.

← Back to the chapter · Previous detail · Next detail →