Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

1.1 The Armv8-M family map

Armv8-M is one architecture with a small mandatory core and a set of optional extensions. There are no exception levels and no AArch64. Instead you get a fixed set of feature switches that an implementation includes or leaves out:

  • Baseline is the minimum. It is the Armv6-M feature set plus additions such as hardware divide (SDIV/UDIV), CBZ/CBNZ, MOVW/MOVT, exclusive accesses and load-acquire/store-release. It has a single fault exception (HardFault) and only PRIMASK for interrupt masking.
  • Main Extension turns Baseline into Mainline. It adds the full 32-bit T32 instruction set (including IT), the configurable faults MemManage, BusFault and UsageFault (plus their status registers), BASEPRI and FAULTMASK.
  • Security Extension (TrustZone for Armv8-M) is optional on both Baseline and Mainline.
  • DSP Extension and Floating-point Extension both require the Main Extension.

Armv8.1-M builds on Mainline with features that include the M-profile Vector Extension (MVE, marketed as Helium; it requires the Main Extension), the Low Overhead Branch extension (WLS/DLS/LE loops), PACBTI (pointer authentication and branch target identification), a Privileged eXecute-Never MPU attribute, CLRM/VSCCLRM register clearing, and PMU and RAS support.

CoreArchitecture
Cortex-M23v8-M Baseline, optional Security Extension
Cortex-M33v8-M Mainline, optional Security Ext, DSP, single-precision FP
Cortex-M35PLike M33, with physical (tamper/side-channel) resistance
Cortex-M52v8.1-M Mainline; MVE and PACBTI are configuration options
Cortex-M55v8.1-M Mainline; MVE (integer, or integer and FP) as a configuration option
Cortex-M85v8.1-M Mainline; MVE and PACBTI as configuration options

In practice, your first questions about a part are: Baseline or Mainline? Is the Security Extension present? Which v8.1-M features are there? The answers determine which registers, faults and instructions exist. Check the core’s configuration (and the ID registers in the SCS), not just its name.

Coming from A-profile: On A-profile, ID_AA64* registers plus the FEAT_* naming tell you what is implemented. On M-profile, the Baseline/Mainline split takes away whole blocks of the programmer’s model, including fault exceptions and mask registers, not just a few instructions.

Checkpoint

Q1.1.1 You port an RTOS from a Cortex-M33 to a Cortex-M23. Its critical sections use MSR BASEPRI, r0 so that high-priority interrupts are never masked. What do you need to change?

  • A. Nothing. BASEPRI is part of the mandatory programmer’s model.
  • B. Replace BASEPRI with FAULTMASK, which Baseline provides instead.
  • C. Use PRIMASK, which masks all configurable-priority exceptions. Baseline has no BASEPRI, so selective masking by priority level is not available.
  • D. Use the Security Extension so that Secure interrupts stay unmasked.
Answer

C. BASEPRI and FAULTMASK come with the Main Extension, and the Cortex-M23 implements Baseline. PRIMASK is the only mask register Baseline offers, and it is all-or-nothing for configurable priorities. FAULTMASK is also Mainline-only, so it cannot be the substitute.

Read more: Armv8-M ARM (DDI0553), Programmers’ model: special-purpose mask registers; Main Extension feature list

Q1.1.2 Which of these features cannot be implemented without the Main Extension?

  • A. The Security Extension
  • B. Stack pointer limit registers for the Secure state
  • C. Load-acquire/store-release instructions
  • D. The DSP Extension
Answer

D. The DSP Extension (and the FP Extension and MVE) depend on the Main Extension. The Security Extension, Secure stack limits and load-acquire/store-release are all available on Baseline. For example, the Cortex-M23 implements TrustZone and Secure stack limit checking.

Read more: Armv8-M ARM (DDI0553), Introduction: Armv8-M architecture extensions

Q1.1.3 A loop compiled with DLS lr, r2 … LE lr, loop runs on a Cortex-M33. What do you expect?

  • A. It runs correctly, because low-overhead loops are part of v8-M Mainline.
  • B. The instructions are not available: the Low Overhead Branch extension is Armv8.1-M, so on a v8.0-M core these encodings are UNDEFINED and fault.
  • C. It runs, but without the zero-overhead benefit.
  • D. It works only if the DSP Extension is implemented.
Answer

B. The Low Overhead Branch extension (WLS/DLS/LE) was introduced in Armv8.1-M. The Cortex-M33 is Armv8.0-M Mainline, so executing them gives an UNDEFINSTR UsageFault (or HardFault if UsageFault is disabled). The tempting assumption is that every Mainline core has these instructions, but they need a v8.1-M core such as the M52, M55 or M85.

Read more: Armv8-M ARM (DDI0553), Armv8.1-M Low Overhead Branch Extension