Search code examples
armembeddedcpu-architecturecpu-registerscortex-m

Number of core registers in Cortex-M4? ARM's TRM says "32-registers" but diagrams show fewer


so , I am a little bit confused right now while reading Cortex M4 technical reference Manual , I came to this line in section 3.8 page 46 stated here on arm website:

Processor core register summary

The processor has 32-registers that includes 13 general-purpose registers and several special-purpose registers.

but When I counted them they were about 16 register not 32 according to Cortex M4 technical reference Manual.

on the other hand , while reading the Cortex M4 generic user guide , I come to this table where it shows around 23 register as in the image: a picture from generic user guide

, please note that PSR register is in fact 3 register not one as I understood from the user guide , so where are the rest of the registers ?, as according to technical reference manual , it's supposed that there are 32 core registers .


Solution

  • This looks like a typo. The manual talks about "32-bit registers", not "32 registers".

    The processor has the following 32-bit registers:

    • 13 general-purpose registers, r0-r12
    • Stack Pointer (SP) alias of banked registers, SP_process and SP_main
    • Link Register (LR), r14
    • Program Counter (PC), r15
    • Special-purpose Program Status Registers, (xPSR).

    See https://developer.arm.com/documentation/ddi0439/b/Programmers-Model/Processor-core-register-summary