AN209 – Using Cortex-M3/M4/M7 Fault Exceptions Copyright © 2017 ARM Ltd. All rights reserved
feedback@keil.com www.keil.com/appnotes/docs/apnt_209.asp
Using Cortex-M3/M4/M7 Fault Exceptions
MDK Tutorial
AN209, Summer 2017, V 5.0 feedback@keil.com
Abstract
ARM
®
Cortex
®
-M processors implement an efficient exception model that traps illegal memory accesses and
several incorrect program conditions. This application note describes the Cortex-M fault exceptions from the
programmers view and explains their usage during the software development cycle. It also contains an example
of a HardFault handler that reports information about the underlying fault.
Contents
Using Cortex-M3/M4/M7 Fault Exceptions ...............................................................................................................1
Abstract ......................................................................................................................................................................1
Introduction ................................................................................................................................................................2
Prerequisites ...............................................................................................................................................................2
Fault exception handlers ............................................................................................................................................2
Fault exception numbers and priority ....................................................................................................................2
Priority escalation ...................................................................................................................................................3
Synchronous and asynchronous BusFaults .............................................................................................................3
Fault types ...............................................................................................................................................................3
Fault exception registers ............................................................................................................................................4
Control registers for fault exceptions .....................................................................................................................4
Configuration and Control Register CCR .............................................................................................................5
System Handler Priority Register SHP .................................................................................................................5
System Handler Control and State Register SHCSR.............................................................................................6
Status and address registers for fault exceptions ...................................................................................................7
HardFault Status Register HSFR Register ............................................................................................................7
Configurable Fault Status Register CFSR Register ...............................................................................................8
MemManage Fault Status and Address Registers (MMFSR; MMFAR) ...............................................................8
BusFault Status and Address Register (BFSR; BFAR) ...........................................................................................9
UsageFault Status Register (UFSR) ................................................................................................................... 11
Auxiliary Bus Fault Status Register ABFSR Register (Cortex-M7 only) ............................................................. 12
Implementing fault handlers ................................................................................................................................... 13
HardFault handler example ................................................................................................................................. 13
Fault handling considerations for ARM Cortex-M7 ............................................................................................. 14
Debugging faults with µVision
®
............................................................................................................................... 15
Determining which exception has occurred ........................................................................................................ 15
Accessing the Fault Reports dialog from the Peripherals menu ...................................................................... 16
Determining where the exception has occurred ................................................................................................. 17
Further documentation ........................................................................................................................................... 18
Revision history ....................................................................................................................................................... 18
评论0
最新资源