Home / Learn Chip Programming / ARM Cortex-M Architecture: M0 to M7

ARM Cortex-M Architecture: M0 to M7

The core inside STM32, RP2040, nRF52 and hundreds of other chips.

In shortThe core inside STM32, RP2040, nRF52 and hundreds of other chips.

Theory in plain words

Cortex-M ladderM0 / M0+: smallest, lowest power, 2 or 3 stage pipelineM3: Thumb-2, hardware divide, 3 stage pipelineM4: M3 + DSP instructions + optional FPUM7: 6 stage superscalar, caches, TCM, up to 1 GHzM33 / M55: TrustZone security, M55 adds Helium vectors
Cortex-M ladder

What it is

Cortex-M is a 32 bit RISC core family with Thumb-2 instructions, a nested vectored interrupt controller (NVIC), SysTick timer, and a fixed memory map. M0/M0+ are smallest, M3/M4 add speed and DSP/FPU, M7 adds cache and dual issue, M33 adds TrustZone.

Why we use it

One core architecture means one toolchain and the same debug interface for almost every modern MCU. Learn it once, use it everywhere.

How it works

Registers R0-R12, SP (MSP/PSP), LR, PC, xPSR. On reset the core loads SP and PC from the vector table. Interrupts push 8 registers automatically and return with a special LR value.

Where it is used

  • STM32, RP2040, nRF52, SAMD, LPC
  • Bare-metal and RTOS firmware
  • Interviews: exception model

Exception entry

What the hardware does on an interruptTry it Yourself

Because hardware saves the registers, an ISR is a normal C function: no special attribute needed on Cortex-M.

CoreMax clock (typ)FPUMPUTypical chip
M0+48 to 133 MHznooptionalRP2040, STM32G0
M372 to 120 MHznooptSTM32F1
M4F80 to 180 MHzsingleoptSTM32F4, nRF52
M7216 to 600 MHzdoubleyesSTM32F7/H7, i.MX RT
M33110 to 250 MHzsingleyesSTM32L5/U5, RP2350

Quick quiz

1. How many registers does hardware push on exception entry?

2. Lower priority number means...