您好,我在主函数中故意进行一步x=(float)1 / 0这样的操作,在调试过程中,没有产生异常,也没有进入中断中,貌似直接给计算过去了,我想问该要捕获这样的异常进行处理,我需要怎么样的配置。有没有相关的Demo程序?谢谢。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi duan,
请参考帖子:http://www.deyisupport.com/question_answer/microcontrollers/hercules/f/70/t/24732.aspx
安全手册这段中提到的“复位后不会自动打开的异常”应该是指浮点运算单元的异常。
这些异常是:
Floating-point inexact exception
Floating-point overflow exception
Floating-point underflow exception
Floating-point invalid operation exception
Floating-point divide-by-zero exception
Floating-point input denormal exception
这些异常信号受Secondary Auxiliary Control Register(第二辅助控制寄存器)的控制,复位后的默认状态是关闭,用户可以通过Secondary Auxiliary Control Register来打开这些异常。
如何操作Secondary Auxiliary Control 寄存器:
MRC p15, 0, <Rd>, c15, c0, 0 ; Read Secondary Auxiliary Control Register
MCR p15, 0, <Rd>, c15, c0, 0 ; Write Secondary Auxiliary Control Register
详情可以参考ARM的技术手册:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0363e/index.html
Regards,
Jay