3

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.

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?

Community
  • 1
  • 1
aaaidan
  • 7,093
  • 8
  • 66
  • 102
  • The Pragmatic Bookshelf [Advanced Arduino Hacking][1] article states that "...it does not support exceptions, because their runtime overhead would be too big." So probably it is not a good idea to enable them. [1]: https://pragprog.com/magazines/2011-04/advanced-arduino-hacking – Filippo De Luca Jan 11 '15 at 16:45

1 Answers1

3

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).

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.

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.

Matthew Murdoch
  • 30,874
  • 30
  • 96
  • 127
  • 11
    Or simpler move the compiler avr-gcc and replace it with a script that filters the flags before invoking the compiler indirectly. – Martin York Apr 10 '12 at 22:06