作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
偶尔会遇到意外中断,我的代码会卡在里面Dummy_Handler()
在 exceptions.c
Atmel Studio 框架 (ASF)。我正在使用 Arduino Due 的 ATSAM3X8E 微 Controller 。
void Dummy_Handler(void)
{
while(1) {
}
}
void HardFault_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void HardFault_Handler ( void ) __attribute__ ((weak, alias("Dummy_HardFault_Handler")));
最佳答案
该 MCU 有一个中断程序状态寄存器,可提供有关来源的一些线索。 ASF 将它封装在一个函数中 __get_IPSR()
在 core_cmFunc.h 中:
uint32_t phantomISR = 9999;
void Dummy_Handler(void)
{
while(1) {
phantomISR = __get_IPSR();
}
}
ISR_NUMBERThis is the number of the current exception:0 = Thread mode1 = Reserved2 = NMI3 = Hard fault4 = Memory management fault5 = Bus fault6 = Usage fault7-10 = Reserved11 = SVCall12 = Reserved for Debug13 = Reserved14 = PendSV15 = SysTick16 = IRQ045 = IRQ29
Both times this happened to me it was the Hard Fault, a kind of blue-screen-of-death for the Ardunio Due. So I also installed a Hard Fault handler of my own.
ISR(HardFault_Handler)
{
while (1) {
}
}
关于exception-handling - Atmel Studio Dummy_Handler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21293580/
偶尔会遇到意外中断,我的代码会卡在里面Dummy_Handler() 在 exceptions.c Atmel Studio 框架 (ASF)。我正在使用 Arduino Due 的 ATSAM3X8
我是一名优秀的程序员,十分优秀!