Documentation map / Programming manual
PMPM0253· 254 pages
PM0253 Cortex-M7 programming manual
The Cortex-M7 core: instruction set, exceptions, NVIC, SCB, SysTick, MPU, FPU, caches.
What a programming manual is for
The Arm Cortex-M7 core itself, shared by all STM32F7 and H7 parts. Covers what is inside the CPU rather than the ST peripherals: programmer’s model and registers, the Thumb instruction set, exception model and priorities, and the core peripherals that sit on the private bus (NVIC, SCB, SysTick, MPU, FPU, L1 caches). Read it for anything that is the same on every Cortex-M7.
Use it when
- How do exception priorities and preemption work?
- MPU region setup, cache maintenance (SCB_CleanDCache), memory barriers.
- What does an instruction like LDREX or VLDR do and how many cycles?
- SysTick, SCB->VTOR, fault status registers (CFSR, HFSR).
Not for
Anything outside the core (GPIO, RCC, timers…): that is the reference manual.
1 About this documentp.148
1.1 Typographical conventionsp.141.2 List of abbreviations for registersp.141.3 About the Cortex®-M7 processor and core peripheralsp.15Figure 1. STM32 Cortex®-M7 implementation processorp.151.3.1 System level interfacep.161.3.2 Integrated configurable debugp.161.3.3 Cortex®-M7 processor features and benefits summaryp.171.3.4 Cortex®-M7 processor core peripheralsp.17
2 The Cortex-M7 processorp.1967
2.1 Programmers modelp.192.1.1 Processor mode and privilege levels for software executionp.192.1.2 Stacksp.19Table 1. Summary of processor mode, execution privilege level, and stack use optionsp.202.1.3 Core registersp.20Figure 2. Processor core registersp.20Table 2. Core register set summaryp.21Figure 3. APSR, IPSR and EPSR bit assignmentsp.22Table 3. PSR register combinationsp.22Table 4. APSR bit assignmentsp.23Table 5. IPSR bit assignmentsp.24Table 6. EPSR bit assignmentsp.24Figure 4. PRIMASK bit assignments:p.26Table 7. PRIMASK register bit assignmentsp.26Figure 5. FAULTMASK bit assignmentsp.26Table 8. FAULTMASK register bit assignmentsp.26Figure 6. BASEPRI bit assignmentsp.27Table 9. BASEPRI register bit assignmentsp.27Figure 7. Control bit assignmentsp.27Table 10. Control register bit assignments (continued)p.272.1.4 Exceptions and interruptsp.282.1.5 Data typesp.292.1.6 The Cortex Microcontroller Software Interface Standard (CMSIS)p.292.2 Cortex®-M7 configurationsp.30Table 11. STM32F746xx/STM32F756xx Cortex®-M7 configurationp.30Table 12. STM32F76xxx/STM32F77xxx Cortex®-M7 configurationp.30Table 13. STM32F72xxx/STM32F73xxx Cortex®-M7 configurationp.31Table 14. STM32H7 Series Cortex®-M7 configurationp.312.3 Memory modelp.32Figure 8. Processor memory mapp.322.3.1 Memory regions, types and attributesp.332.3.2 Memory system ordering of memory accessesp.33Table 15. Ordering of memory accessesp.342.3.3 Behavior of memory accessesp.34Table 16. Memory access behaviorp.34Table 17. Memory region shareability and cache policiesp.352.3.4 Software ordering of memory accessesp.362.3.5 Memory endiannessp.36Figure 9. Little-endian formatp.372.3.6 Synchronization primitivesp.372.3.7 Programming hints for the synchronization primitivesp.38Table 18. CMSIS functions for exclusive access instructionsp.382.4 Exception modelp.392.4.1 Exception statesp.392.4.2 Exception typesp.39Table 19. Properties of the different exception types (continued)p.402.4.3 Exception handlersp.412.4.4 Vector tablep.42Figure 10. Vector tablep.422.4.5 Exception prioritiesp.432.4.6 Interrupt priority groupingp.432.4.7 Exception entry and returnp.44Figure 11. Exception stack framep.45Table 20. Exception return behaviorp.462.5 Fault handlingp.472.5.1 Fault typesp.47Table 21. Faults (continued)p.472.5.2 Fault escalation and hard faultsp.482.5.3 Synchronous and Asynchronous bus faultsp.492.5.4 Fault status registers and fault address registersp.49Table 22. Fault status and fault address registersp.492.5.5 Lockupp.492.6 Power managementp.502.6.1 Entering sleep modep.502.6.2 Wakeup from sleep modep.512.6.3 The external event inputp.512.6.4 Power management programming hintsp.51
3 The Cortex-M7 instruction setp.52152
3.1 Instruction set summaryp.52Table 23. Cortex®-M7 instructions (continued)p.523.1.1 Binary compatibility with other Cortex processorsp.613.2 CMSIS functionsp.62Table 24. CMSIS functions to generate some Cortex®-M7 processor instructionsp.62Table 25. CMSIS functions to access the special registersp.633.3 About the instruction descriptionsp.633.3.1 Operandsp.633.3.2 Restrictions when using PC or SPp.633.3.3 Flexible second operandp.643.3.4 Shift operationsp.65Figure 12. ASRp.66Figure 13. LSRp.66Figure 14. LSLp.67Figure 15. RORp.67Figure 16. RRXp.673.3.5 Address alignmentp.683.3.6 PC-relative expressionsp.683.3.7 Conditional executionp.68Table 26. Condition code suffixesp.703.3.8 Instruction width selectionp.713.4 Memory access instructionsp.72Table 27. Memory access instructionsp.723.4.1 ADRp.733.4.2 LDR and STR, immediate offsetp.73Table 28. Offset rangesp.753.4.3 LDR and STR, register offsetp.763.4.4 LDR and STR, unprivilegedp.773.4.5 LDR, PC-relativep.78Table 29. Offset rangesp.783.4.6 LDM and STMp.793.4.7 PLDp.813.4.8 PUSH and POPp.823.4.9 LDREX and STREXp.833.4.10 CLREXp.843.5 General data processing instructionsp.85Table 30. Data processing instructions (continued)p.853.5.1 ADD, ADC, SUB, SBC, and RSBp.873.5.2 AND, ORR, EOR, BIC, and ORNp.893.5.3 ASR, LSL, LSR, ROR, and RRXp.903.5.4 CLZp.913.5.5 CMP and CMNp.923.5.6 MOV and MVNp.933.5.7 MOVTp.943.5.8 REV, REV16, REVSH, and RBITp.953.5.9 SADD16 and SADD8p.963.5.10 SHADD16 and SHADD8p.973.5.11 SHASX and SHSAXp.983.5.12 SHSUB16 and SHSUB8p.993.5.13 SSUB16 and SSUB8p.1003.5.14 SASX and SSAXp.1013.5.15 TST and TEQp.1023.5.16 UADD16 and UADD8p.1033.5.17 UASX and USAXp.1043.5.18 UHADD16 and UHADD8p.1053.5.19 UHASX and UHSAXp.1063.5.20 UHSUB16 and UHSUB8p.1073.5.21 SELp.1083.5.22 USAD8p.1083.5.23 USADA8p.1093.5.24 USUB16 and USUB8p.1103.6 Multiply and divide instructionsp.111Table 31. Multiply and divide instructions (continued)p.1113.6.1 MUL, MLA, and MLSp.1123.6.2 UMULL, UMAAL, UMLALp.1133.6.3 SMLA and SMLAWp.1153.6.4 SMLADp.1163.6.5 SMLAL and SMLALDp.1173.6.6 SMLSD and SMLSLDp.1193.6.7 SMMLA and SMMLSp.1213.6.8 SMMULp.1223.6.9 SMUAD and SMUSDp.1233.6.10 SMUL and SMULWp.1243.6.11 UMULL, UMLAL, SMULL, and SMLALp.1263.6.12 SDIV and UDIVp.1273.7 Saturating instructionsp.128Table 32. Saturating instructionsp.1283.7.1 SSAT and USATp.1293.7.2 SSAT16 and USAT16p.1303.7.3 QADD and QSUBp.1313.7.4 QASX and QSAXp.1323.7.5 QDADD and QDSUBp.1333.7.6 UQASX and UQSAXp.1343.7.7 UQADD and UQSUBp.1363.8 Packing and unpacking instructionsp.137Table 33. Packing and unpacking instructionsp.1373.8.1 PKHBT and PKHTBp.1383.8.2 SXT and UXTp.1393.8.3 SXTA and UXTAp.1403.9 Bit field instructionsp.141Table 34. Packing and unpacking instructionsp.1413.9.1 BFC and BFIp.1423.9.2 SBFX and UBFXp.1433.9.3 SXT and UXTp.1443.10 Branch and control instructionsp.145Table 35. Branch and control instructionsp.1453.10.1 B, BL, BX, and BLXp.145Table 36. Branch rangesp.1463.10.2 CBZ and CBNZp.1473.10.3 ITp.1483.10.4 TBB and TBHp.1503.11 Floating-point instructionsp.151Table 37. Floating-point instructions (continued)p.1513.11.1 VABSp.1533.11.2 VADDp.1533.11.3 VCMP, VCMPEp.1543.11.4 VCVT, VCVTR between floating-point and integerp.1553.11.5 VCVT between floating-point and fixed-pointp.1563.11.6 VCVTB, VCVTTp.1573.11.7 VDIVp.1573.11.8 VFMA, VFMSp.1583.11.9 VFNMA, VFNMSp.1593.11.10 VLDMp.1593.11.11 VLDRp.1603.11.12 VMLA, VMLSp.1613.11.13 VMOV immediatep.1623.11.14 VMOV registerp.1623.11.15 VMOV scalar to Arm core registerp.1633.11.16 VMOV Arm core register to single-precisionp.1633.11.17 VMOV two Arm core registers to two single-precision registersp.1643.11.18 VMOV two Arm core registers and a double-precision registerp.1643.11.19 VMOV Arm core register to scalarp.1653.11.20 VMRSp.1653.11.21 VMSRp.1663.11.22 VMULp.1663.11.23 VNEGp.1673.11.24 VNMLA, VNMLS, VNMULp.1673.11.25 VPOPp.1683.11.26 VPUSHp.1693.11.27 VSQRTp.1693.11.28 VSTMp.1703.11.29 VSTRp.1703.11.30 VSUBp.1713.11.31 VSELp.1723.11.32 VMAXNM, VMINNMp.1723.11.33 VCVTA, VCVTN, VCVTP, VCVTMp.1733.11.34 VRINTR, VRINTXp.1733.11.35 VRINTA, VRINTN, VRINTP, VRINTM, VRINTZp.1743.12 Miscellaneous instructionsp.175Table 38. Miscellaneous instructionsp.1753.12.1 BKPTp.1753.12.2 CPSp.1763.12.3 DMBp.1773.12.4 DSBp.1773.12.5 ISBp.1783.12.6 MRSp.1783.12.7 MSRp.1793.12.8 NOPp.1803.12.9 SEVp.1803.12.10 SVCp.1813.12.11 WFEp.1813.12.12 WFIp.182
4 Cortex-M7 peripheralsp.183189
4.1 About the Cortex-M7 peripheralsp.183Table 39. Core peripheral register regionsp.1834.2 Nested Vectored Interrupt Controllerp.184Table 40. NVIC register summaryp.1844.2.1 Accessing the Cortex®-M7 NVIC registers using CMSISp.185Table 41. CMSIS access NVIC functionsp.1854.2.2 Interrupt set-enable registersp.185Figure 17. ISER bit assignmentsp.185Table 42. ISER bit assignmentsp.1854.2.3 Interrupt clear-enable registersp.186Figure 18. ICER bit assignmentp.186Table 43. ICER bit assignmentsp.1864.2.4 Interrupt set-pending registersp.186Figure 19. ISPR bit assignmentsp.186Table 44. ISPR bit assignmentsp.1874.2.5 Interrupt clear-pending registersp.187Figure 20. ICPR bit assignmentsp.187Table 45. ICPR bit assignmentsp.1874.2.6 Interrupt active bit registersp.188Figure 21. IABR bit assignmentsp.188Table 46. IABR bit assignmentsp.1884.2.7 Interrupt priority registersp.188Figure 22. IPR bit assignmentsp.188Table 47. IPR bit assignmentsp.1894.2.8 Software trigger interrupt registerp.189Figure 23. STIR bit assignmentsp.189Table 48. STIR bit assignmentsp.1894.2.9 Level-sensitive and pulse interruptsp.1904.2.10 NVIC design hints and tipsp.191Table 49. CMSIS functions for NVIC controlp.1914.3 System control blockp.192Table 50. Summary of the system control block registersp.1924.3.1 Auxiliary control registerp.193Figure 24. ACTLR bit assignmentsp.193Table 51. ACTLR bit assignmentsp.1934.3.2 CPUID base registerp.194Figure 25. CPUID bit assignmentsp.194Table 52. CPUID bit assignmentsp.1944.3.3 Interrupt control and state registerp.194Figure 26. ICSR bit assignmentsp.195Table 53. ICSR bit assignments (continued)p.1954.3.4 Vector table offset registerp.197Figure 27. VTOR bit assignmentsp.197Table 54. VTOR bit assignmentsp.1974.3.5 Application interrupt and reset control registerp.197Figure 28. AIRCR bit assignmentsp.197Table 55. AIRCR bit assignmentsp.198Table 56. Priority grouping (continued)p.1984.3.6 System control registerp.199Figure 29. SCR bit assignments:p.199Table 57. SCR bit assignments (continued)p.1994.3.7 Configuration and control registerp.200Figure 30. CCR bit assignmentsp.200Table 58. CCR bit assignments (continued)p.2014.3.8 System handler priority registersp.202Table 59. System fault handler priority fieldsp.202Figure 31. SHPR1 bit assignementsp.202Table 60. SHPR1 register bit assignmentsp.203Figure 32. SHPR2 bit assignmentsp.203Table 61. SHPR2 register bit assignmentsp.203Figure 33. SHPR3 bit assignmentsp.203Table 62. SHPR3 register bit assignmentsp.2034.3.9 System handler control and state registerp.204Figure 34. SHCSR bit assignmentsp.204Table 63. SHCSR bit assignments (continued)p.2044.3.10 Configurable fault status registerp.205Figure 35. CFSR bit assignmentsp.205Figure 36. MMFSR bit assignmentsp.206Table 64. MMFSR bit assignments (continued)p.206Figure 37. BFSR bit assignmentsp.207Table 65. BFSR bit assignmentsp.208Figure 38. UFSR bit assignmentsp.209Table 66. UFSR bit assignments (continued)p.2094.3.11 HardFault status registerp.210Figure 39. HFSR bit assignmentsp.210Table 67. HFSR bit assignmentsp.2114.3.12 MemManage fault address registerp.211Table 68. MMFAR bit assignmentsp.2114.3.13 BusFault address registerp.212Table 69. BFAR bit assignmentsp.2124.3.14 System control block design hints and tipsp.212Table 70. CMSIS function for system controlp.2124.4 System timer, SysTickp.212Table 71. System timer registers summaryp.2134.4.1 SysTick control and status registerp.213Figure 40. SysTick SYST_CSR bit assignmentsp.213Table 72. SysTick SYST_CSR bit assignmentsp.2134.4.2 SysTick reload value registerp.214Figure 41. SYST_RVR bit assignmentsp.214Table 73. SYST_RVR bit assignmentsp.2144.4.3 SysTick current value registerp.214Figure 42. SYST_CVR bit assignments:p.214Table 74. SYST_CVR bit assignmentsp.2154.4.4 SysTick calibration value registerp.215Figure 43. SYST_CALIB bit assignmentsp.215Table 75. SYST_CALIB bit assignmentsp.2154.4.5 SysTick design hints and tipsp.216Table 76. CMSIS functions for SysTick controlp.2164.5 Processor featuresp.217Table 77. Identification space summaryp.2174.5.1 Cache level ID registerp.217Figure 44. CLIDR bit assignmentsp.217Table 78. CLIDR bit assignments (continued)p.2174.5.2 Cache type registerp.218Figure 45. CTR bit assignmentsp.218Table 79. CTR bit assignments (continued)p.2184.5.3 Cache size ID registerp.219Figure 46. CCSIDR bit assignmentsp.219Table 80. CCSIDR bit assignmentsp.219Table 81. CCSIDR encodingsp.2204.5.4 Cache size selection registerp.220Figure 47. CSSELR bit assignmentsp.220Table 82. CSSELR bit assignmentsp.2204.6 Memory protection unitp.221Table 83. Memory attributes summary (continued)p.221Table 84. MPU registers summaryp.2224.6.1 MPU type registerp.223Figure 48. TYPE bit assignmentsp.223Table 85. TYPE bit assignmentsp.2234.6.2 MPU control registerp.223Figure 49. MPU_CTRL bit assignmentsp.223Table 86. MPU_CTRL bit assignmentsp.2244.6.3 MPU region number registerp.225Figure 50. MPU_RNR bit assignmentsp.225Table 87. MPU_RNR bit assignmentsp.2254.6.4 MPU region base address registerp.225Figure 51. MPU_RBAR bit assignments:p.225Table 88. MPU_RBAR bit assignmentsp.2264.6.5 MPU region attribute and size registerp.226Figure 52. MPU_RASR bit assignmentsp.227Table 89. MPU_RASR bit assignmentsp.227Table 90. Example SIZE field valuesp.2284.6.6 MPU access permission attributesp.228Table 91. TEX, C, B, and S encoding (continued)p.228Table 92. Cache policy for memory attribute encodingp.229Table 93. AP encodingp.2294.6.7 MPU mismatchp.2304.6.8 Updating an MPU regionp.230Figure 53. Example of disabling subregionp.2324.6.9 MPU design hints and tipsp.2324.7 Floating-point unitp.233Table 94. Cortex®-M7 floating-point system registersp.2334.7.1 Coprocessor access control registerp.233Figure 54. CPACR bit assignmentsp.233Table 95. CPACR bit assignmentsp.2344.7.2 Floating-point context control registerp.234Figure 55. FPCCR bit assignmentsp.234Table 96. FPCCR bit assignments (continued)p.2344.7.3 Floating-point context address registerp.236Figure 56. FPCAR bit assignmentsp.236Table 97. FPCAR bit assignmentsp.2364.7.4 Floating-point status control registerp.236Figure 57. FPSCR bit assignmentsp.236Table 98. FPSCR bit assignments (continued)p.2364.7.5 Floating-point default status control registerp.237Figure 58. FPDSCR bit assignmentsp.237Table 99. FPDSCR bit assignments (continued)p.2374.7.6 Enabling the FPUp.2384.7.7 Enabling and clearing FPU exception interruptsp.2394.8 Cache maintenance operationsp.240Table 100. Cache maintenance space register summaryp.2404.8.1 Full instruction cache operationp.2414.8.2 Instruction and data cache operations by addressp.241Table 101. Cache operation registers bit assignmentsp.2414.8.3 Data cache operations by set-wayp.241Figure 59. Cache operation bit assignmentsp.241Table 102. Cache operations by set-way bit assignmentsp.2414.8.4 Cortex®-M7 cache maintenance operations using CMSISp.242Table 103. CMSIS access cache maintenance operationsp.2424.8.5 Initializing and enabling the L1-cachep.2424.8.6 Faults handling considerationsp.2444.8.7 Cache maintenance design hints and tipsp.2444.9 Access controlp.245Table 104. Access control register summaryp.2454.9.1 Instruction and data tightly-coupled memory control registersp.246Figure 60. ITCMR and DTCMR bit assignmentsp.246Table 105. ITCMCR and DTCMCR bit assignmentsp.2464.9.2 AHBP control registerp.248Figure 61. AHBPCR bit assignmentsp.248Table 106. AHBPCR bit assignmentsp.2484.9.3 Auxiliary cache control registerp.249Figure 62. CACR bit assignmentsp.249Table 107. CACR bit assignmentsp.2494.9.4 AHB slave control registerp.250Figure 63. AHBSCR bit assignmentsp.250Table 108. AHBSCR bit assignments (continued)p.2504.9.5 Auxiliary bus fault status registerp.251Figure 64. ABFSR bit assignmentsp.251Table 109. ABFSR bit assignments (continued)p.251
Nothing matches.