hardfault常见原因_XMC实验分享之四十八: Cortex M0的Hard Fault发生原因
凡是在Cortex M系列內核上寫過程序的程序員, 沒有不知道Hard Fault的. 大多數程序出現問題的表現就是進入Hard Fault.
但是進入Hard Fault的原因是甚么, 為了查明這個問題, 不少程序員為之廢寢忘食...
Hard Fault的設計初衷就是為了程序出錯之后提供一個預警機制, 但是進入Hard Fault的原因有很多. 所以把這個問題研究透對調試排錯意義很大.
相比于其他型號, Cortex M0只有一種Fault就是Hard Fault. 本帖以幾個實驗稍稍探究一下子發生Fault的原因.
首先看手冊, Cortex M0發生Hard Fault的原因有如下幾種:
Faults are a subset of exceptions, see Exception model on page 2-19. All faults result in
the HardFault exception being taken or cause lockup if they occur in the NMI or
HardFault handler. The faults are:
? execution of an SVC instruction at a priority equal or higher than SVCall
? execution of a BKPT instruction without a debugger attached
? a system-generated bus error on a load or store
? execution of an instruction from an XN memory address
? execution of an instruction from a location for which the system generates a bus fault
? a system-generated bus error on a vector fetch
? execution of an Undefined instruction
? execution of an instruction when not in Thumb-State as a result of the T-bit being previously cleared to 0
? an attempted load or store to an unaligned address.
總結
以上是生活随笔為你收集整理的hardfault常见原因_XMC实验分享之四十八: Cortex M0的Hard Fault发生原因的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: nio2 java_java NIO2(
- 下一篇: java todo error_java