Chapter 7: ARM Cortex-M33 ISA Overview

September 17, 2026 · View on GitHub

Introduction

The instruction set architecture (ISA) defines every operation the processor can perform. The ARM Cortex-M33 implements the ARMv8-M Mainline architecture using the Thumb-2 instruction set — a variable-length encoding that mixes 16-bit and 32-bit instructions for both code density and performance. This chapter surveys the ISA at a high level and identifies every instruction our blink driver uses.

The ARM Design Philosophy

ARM processors follow the RISC (Reduced Instruction Set Computer) philosophy:

  • Fixed-width instructions (with the Thumb-2 exception of 16/32-bit mix)
  • Load-store architecture — only ldr/str access memory
  • Large register file — 16 general-purpose registers
  • Simple addressing modes — base + offset
  • Conditional execution — many instructions can be conditionally executed

The Thumb-2 extension adds 32-bit encodings to the original 16-bit Thumb set, giving access to the full ARM feature set without sacrificing code density.

Thumb-2 Instruction Encoding

Every instruction is either 16 bits (2 bytes) or 32 bits (4 bytes):

TypeSizeWhen Used
Narrow (Thumb)16-bitSimple operations with low registers (r0–r7)
Wide (Thumb-2)32-bitComplex operations, large immediates, high registers

The assembler chooses the narrowest encoding that can represent the operation. The .syntax unified directive tells the assembler to accept both widths transparently.

16-bit example:

  bx    lr                                       // 16-bit: return to caller

32-bit example:

  bic   r5, r5, #(1<<7)                          // 32-bit: clear bit 7

Instruction Categories

All Cortex-M33 instructions fall into these categories:

CategoryExamplesUsed in Our Firmware
Data processingadd, sub, orr, bic, tst, cmp, mulYes
Load/storeldr, str, push, popYes
Branchb, bl, bx, beq, bne, bleYes
Movemov, ldr Rd, =immYes
Systemmsr, mrs, dsb, isb, mcrrYes
MultiplymulYes

Instruction Encoding Formats

Thumb-2 32-bit instructions use several encoding formats:

FormatDescriptionExample
Data processing (register)op Rd, Rn, Rmorr r1, r1, #(1<<11)
Data processing (immediate)op Rd, Rn, #immbic r5, r5, #(1<<7)
Load/store (immediate)ldr/str Rt, [Rn, #imm]ldr r1, [r0]
Branchb/bl labelbl GPIO_Set
Systemmsr/mrs special, Rnmsr MSP, r0
Coprocessormcrr pN, opc, Rt, Rt2, CRmmcrr p0, #4, r2, r4, c4

Instructions Used in Our Firmware

Here is the complete list of instructions appearing in our blink driver:

InstructionCategoryDescription
ldr Rd, =immPseudo-instructionLoad 32-bit constant into register
ldr Rd, [Rn]LoadLoad word from memory
str Rd, [Rn]StoreStore word to memory
push {regs}Store (multiple)Push registers onto stack
pop {regs}Load (multiple)Pop registers from stack
add Rd, Rn, RmArithmeticAdd two registers
sub Rd, Rd, #immArithmeticSubtract immediate
subs Rd, Rd, #immArithmeticSubtract and update flags
mul Rd, Rn, RmMultiplyMultiply two registers
orr Rd, Rd, #immLogicBitwise OR with immediate
bic Rd, Rd, #immLogicBit clear (AND with NOT imm)
tst Rn, #immLogicTest bits (AND, discard, set flags)
cmp Rn, #immComparisonCompare (subtract, discard, set flags)
b labelBranchUnconditional branch
bl labelBranchBranch with link (call)
bx RnBranchBranch exchange (return)
beq labelBranchBranch if equal (Z=1)
bne labelBranchBranch if not equal (Z=0)
ble labelBranchBranch if less or equal
msr reg, RnSystemWrite to special register
dsbBarrierData synchronization barrier
isbBarrierInstruction synchronization barrier
mcrr pN, opc, Rt, Rt2, CRmCoprocessorMove to coprocessor from two registers

Summary

  • The Cortex-M33 uses the Thumb-2 instruction set: a mix of 16-bit and 32-bit encodings.
  • .syntax unified enables transparent use of both widths.
  • Instructions are categorized into data processing, load/store, branch, system, and coprocessor.
  • Our blink driver uses approximately 23 distinct instructions to achieve full GPIO control from bare metal.