在 Arduino 环境中启用异常 [英] Enable exceptions in the Arduino environment

查看:38
本文介绍了在 Arduino 环境中启用异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 回答关于 arduino 环境是否支持异常的问题,理论上可以在 Arduino 板上运行异常"二进制文件.

According to an answer to a question about whether the arduino environment supports exceptions, it is theoretically possible to run "exceptional" binaries on an Arduino board.

我将如何更改我的 Arduino IDE 以允许这样做?具体来说,如何防止 IDE 在调用编译器时包含 -fno-exceptions 标志?

How would I alter my Arduino IDE to allow this? Specifically, how do I prevent the IDE from including the -fno-exceptions flag when invoking the compiler?

推荐答案

Arduino IDE 将 -fno-exceptions 传递给它使用的编译器 (avr-gcc).它这样做是因为编译器的文档指定它是必需的(参见 http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_cplusplus).

The Arduino IDE passes -fno-exceptions to the compiler it uses (avr-gcc). It does this because the compiler's documentation specifies that it is required (see http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_cplusplus).

由于此参数是编译器正常运行所必需的(正确或错误),因此 Arduino IDE 不提供更改此参数的方法.

Since this parameter is required (rightly or wrongly) for correct functioning of the compiler the Arduino IDE does not provide a way to change this.

然而,如果您想尝试删除此参数以查看它有什么影响,您需要编辑 Arduino 源代码(当前在 https://github.com/arduino/Arduino/blob/master/app/src/processing/app/debug/Compiler.java) 并自行重建 IDE.

Nevertheless, if you want to try removing this parameter to see what effect it has you'll need to edit the Arduino source code (currently line 589 in https://github.com/arduino/Arduino/blob/master/app/src/processing/app/debug/Compiler.java) and rebuild the IDE yourself.

这篇关于在 Arduino 环境中启用异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆