armhub.dev
Cheatsheets

The bench-side reference.

Quick-lookup tables and command summaries for when you're at the workstation and need an answer in five seconds, not five clicks.

GCC flags by CPU

Core-mcpu=-mfpu=float-abi
M0/M0+cortex-m0plus—soft
M3cortex-m3—soft
M4 (no FPU)cortex-m4—soft
M4Fcortex-m4fpv4-sp-d16hard
M7 (SP)cortex-m7fpv5-sp-d16hard
M7 (DP)cortex-m7fpv5-d16hard
M23cortex-m23—soft
M33cortex-m33fpv5-sp-d16hard
M55cortex-m55autohard
M85cortex-m85fpv5-d16hard
always add: -mthumb -ffunction-sections -fdata-sections -Wl,--gc-sections

CMSIS barriers — what to use when

NeedCall
Order memory ops__DMB()
Wait for memory ops__DSB()
Flush pipeline (sys reg)__DSB(); __ISB();
Sleep until interrupt__WFI()
Sleep until event__WFE()
Disable all IRQs__disable_irq()
Mask by priority__set_BASEPRI(p << (8 - bits))

GDB / probe-rs essentials

target extended-remote :3333    # connect
monitor reset halt              # halt at reset
load                            # flash + load symbols
break main                      # set breakpoint
continue / c                    # run
step / s                        # step (source)
stepi / si                      # step (instruction)
next / n                        # step over
finish                          # run to return
backtrace / bt                  # call stack
info registers                  # register dump
x/16wx 0xE000ED00               # examine 16 words hex at addr
set $pc = 0x08000200            # poke PC
monitor reset run               # reset + run

Cortex-M memory map

RegionAddress
Code (flash)0x0000_0000 – 0x1FFF_FFFF
SRAM0x2000_0000 – 0x3FFF_FFFF
Peripheral0x4000_0000 – 0x5FFF_FFFF
External RAM0x6000_0000 – 0x9FFF_FFFF
External device0xA000_0000 – 0xDFFF_FFFF
Private Peripheral Bus0xE000_0000 – 0xE00F_FFFF
SCB base0xE000_ED00
NVIC base0xE000_E100
SysTick base0xE000_E010
MPU base0xE000_ED90

Exception numbers

1Reset
2NMI
3HardFault
4MemManage
5BusFault
6UsageFault
7SecureFault (v8-M)
11SVCall
12DebugMonitor
14PendSV
15SysTick
16+External IRQs (vendor-specific)

Exception entry stack frame

SP+0x1C  → xPSR        ← top
SP+0x18  → PC
SP+0x14  → LR
SP+0x10  → R12
SP+0x0C  → R3
SP+0x08  → R2
SP+0x04  → R1
SP+0x00  → R0          ← SP after entry

+ FPU frame (lazy):
SP+0x20..SP+0x60  → S0..S15 + FPSCR