Platform:ARM Cortex-M
| On this wiki | Facts · Code · Notes · Topics |
|---|
ARM's microcontroller cores (Cortex-M0 to M85, Thumb only): firmware images start with a vector table (initial stack pointer, then Reset_Handler and exception handlers with the Thumb bit set), and the System Control Space at 0xE000E000 (SysTick, NVIC, SCB) is the same in every chip.
Overview
Cortex-M cores run only Thumb/Thumb-2 code. Firmware in STM32, nRF52, RP2040, SAMD, LPC, i.MX RT and many IoT chips is a flat image (.bin, Format:Intel HEX, Format:UF2, or ELF) without a header of its own: the first words are the vector table.
Vector table
The table is an array of 32-bit little-endian words. Word 0 is the initial main stack pointer (a RAM address, usually 0x20000000 plus the RAM size, or 0x2xxxxxxx), word 1 is the Reset_Handler address, then the exception handlers: NMI, HardFault, and on Armv7-M and later MemManage, BusFault, UsageFault, four reserved words, SVCall, DebugMonitor, one reserved word, PendSV, SysTick; vendor IRQ handlers follow from word 16. The word order matches the CMSIS reference startup file CMSIS/CoreValidation/Layer/Target/CM3/RTE/Device/ARMCM3/startup_ARMCM3.c (ARM-software/CMSIS_6, commit d4a772e65d): initial stack pointer, Reset_Handler, NMI, HardFault, MemManage, BusFault, UsageFault, four reserved words, SVC, DebugMon, one reserved word, PendSV, SysTick, then Interrupt0 onward (exception numbers -14 to -1, interrupts from word 16).
Every handler address has bit 0 set (the Thumb bit): a handler stored as 0x08000149 is Thumb code at 0x08000148. Disassemble at the even address and set the Thumb/T-mode flag there.
Finding the load address from the vector table
Unverified technique: take word 1 (Reset_Handler) and the other handler words; all point into the same region of the image, so the load address is the largest 0x...000-aligned base that is at or below the smallest handler address and that makes the reset code land inside the file. Common bases: 0x08000000 (STM32 flash), 0x00000000 (nRF, aliased boot), 0x10000000 (RP2040 XIP flash is 0x10000000, but code is started by a 256-byte boot2 stage first). A bootloader-ed image can have an offset: the SCB VTOR register (0xE000ED08) is set by the bootloader to the application's table. Check that the stack pointer value is in a RAM range and that the handlers have bit 0 set.
System Control Space (SCS)
Fixed in the architecture, identical across vendors, so code that writes to 0xE000Exxx is core configuration, not a vendor peripheral. See the hardware address facts on this page: SysTick 0xE000E010, NVIC 0xE000E100, SCB 0xE000ED00 (VTOR at 0xE000ED08, AIRCR at 0xE000ED0C where writing 0x05FA in bits 31:16 is required, CFSR/HFSR fault status at 0xE000ED28/2C), MPU 0xE000ED90, FPU 0xE000EF30; ITM 0xE0000000 and DWT 0xE0001000 are separate debug blocks.
Vendor peripherals
Everything else (UART, GPIO, clocks) is vendor specific; its register map comes from the chip's CMSIS-SVD file, see Format:CMSIS-SVD and Tool:SVD-Loader for Ghidra.
Code & repositories
- https://github.com/ARM-software/CMSIS_6 @
d4a772e65df07a79ffe69c169a72d9bde4e5e7a6· license: Apache-2.0
CMSIS core headers (core_cm*.h) with SCB, NVIC, SysTick, MPU register layouts and base addresses.
Tested on: source read, not run: read · checked 2026-10-18; last activity 2026-10-08
See also
Format:CMSIS-SVD, Library:FreeRTOS, Library:Zephyr, Format:MCUboot image, Format:UF2, Format:Intel HEX, Format:Motorola S-record, Format:ESP32 application image (Xtensa/RISC-V, not Cortex-M), Platform:Linux kernel (Cortex-A, not Cortex-M).