Home /Modules/cpu/SPECIFICATION.md

SPECIFICATION.md

lib/cpu/cortex-m/SPECIFICATION.md · 37 line(s) · markdown

Cortex-M Specification and Profile Contract

Configuration

Required configuration:

Architectural state

Common state includes R0-R12, stack-pointer bank selection where implemented (MSP and optionally PSP), LR, PC, xPSR, and profile-defined special registers. FPU state (S0-S31 and FPSCR where applicable), security-state banked registers, MPU registers and debug registers exist only when configured and accessible.

Required behavior

  1. Decode only the instruction encodings permitted by the selected architecture profile and enabled extensions.
  2. Preserve architectural condition flags and instruction-width semantics.
  3. Model exception entry/return and stack alignment according to profile and configured implementation.
  4. Route eligible interrupts through NVIC-compatible priority and pending/active state.
  5. Raise appropriate fault behavior for invalid encodings, privilege violations, memory protection violations, and invalid exception returns where defined.
  6. Keep core behavior separate from MCU peripherals and SoC-specific memory maps.

Optional capabilities

MPU, FPU, DSP instructions, MVE, TrustZone-M, instruction/data cache, debug/trace, and vendor-defined features must be explicit profile options. Cache presence and size are not inferred solely from the Cortex-M family name.

Timing contract

Instruction cycle counts are profile- and implementation-specific. Report documented, derived, estimated, or unspecified timing evidence. Do not treat a generic cycle estimate as a silicon guarantee.

Errors

Configuration errors fail before execution with the field and unsupported feature identified. At runtime, unsupported opcodes and illegal state transitions produce a profile-appropriate fault or a structured emulator diagnostic; never silently execute as a different instruction.