I had a bug with the current 0022 compiler so I modified Compiler.java to accept an external AVR toolchain. It also allows you to optionally specify new compiler/linker options. Useful if you want to turn on warnings or spec a little better optimization. All options are specified in the preference.txt file and if left out the IDE reverts to the internal compiler and options.
I hope the Arduino team guys take notice of this.
This is a very simple update that could be tossed into the next release to offer tool options,
which many people have been requesting for quite some time.
I don't know the issues list # for it, but it would be great if you could track it down
(or any issue that asks for compiler or linker options) and
put a link to this thread in it.
Call me a Java noob, but I can't work out where to put Compiler.java. There isn't a file of that name, as far as I can see, in the existing IDE folder (this is OS/X).
But thanks for the great tool! If I can get it to work, it is exactly what I wanted.
I DLed it from your site and extracted it to my desktop. I called up the "Bare Minimum" example (or whatever its called) and hit "verify" holding down shift to get verbose output. The first line was this:
C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\tools\avr\bin\avr-g++ -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -O3 -IC:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino
I was thrilled to see the -O3 because that's what I was after. And, as a sort of conformation, the compiled app is several hundred bytes larger than when compiled with the 0022 distro (like 630 vs 400).
But, I also saw a pile of warnings like those pasted below. Is this just a matter of you having higher warning reporting on by default (as opposed to the standard 0022 distro) or is there something amiss here?
Thanks...
In file included from C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\/wiring_private.h:30,
from C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\pins_arduino.c:26:
c:/documents and settings/jim/desktop/arduino-aq22/hardware/tools/avr/lib/gcc/../../avr/include/avr/delay.h:36:2: warning: #warning "This file has been moved to <util/delay.h>."
C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\pins_arduino.c:361: warning: initialization makes integer from pointer without a cast
C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\pins_arduino.c:362: warning: initialization makes integer from pointer without a cast
C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\pins_arduino.c:363: warning: initialization makes integer from pointer without a cast
C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\pins_arduino.c:369: warning: initialization makes integer from pointer without a cast
C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\pins_arduino.c:370: warning: initialization makes integer from pointer without a cast
C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\pins_arduino.c:371: warning: initialization makes integer from pointer without a cast
C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\pins_arduino.c:377: warning: initialization makes integer from pointer without a cast
C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\pins_arduino.c:378: warning: initialization makes integer from pointer without a cast
C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\pins_arduino.c:379: warning: initialization makes integer from pointer without a cast
C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\tools\avr\bin\avr-gcc -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -O3 -IC:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\WInterrupts.c -oC:\DOCUME~1\Jim\LOCALS~1\Temp\build7948476801286890297.tmp\WInterrupts.c.o
In file included from C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\/wiring_private.h:30,
from C:\Documents and Settings\Jim\Desktop\arduino-AQ22\hardware\arduino\cores\arduino\WInterrupts.c:34:
c:/documents and settings/jim/desktop/arduino-aq22/hardware/tools/avr/lib/gcc/../../avr/include/avr/delay.h:36:2: warning: #warning "This file has been moved to <util/delay.h>."
I'm not surprised to see a few warnings. And if they appeared more often the library developers would be motivated to fix the problems they report, minor though they may be.
When you turn on warnings either by default or with a -Wall option the arduino core libs will output some warnings. As Nick said the warnings you are seeing really shouldn't be there but then the stock IDE uses -w to turn off all warnings so you don't usually see them.
Getting warnings back was one of the features that motivated me to change to IDE.
Thanks guys! As long as the warnings are normal and don't mean I installed your new IDE wrong, then I am fine with that. There were a bunch so I was concerned I did somethign wrong.
May I make a suggestion? The window where errors and warnings are dumped is very small. Perhaps there could be a switch to enable a popup window or a new tab? Warnings / errors are of course important, but its sure hard to weed through them in such a tiny window.
Thanks again! I have really been wanting to optomize for speed, now I can easily so it!
The best way (easiest) to enlarge the output window (where the errors appear) is to enlarge the IDE and then drag the upper edge of the output window up.
I use the standard IDE, with whatever optimization it gives me. It seems to work OK. As a general rule, the amount you will save with different optimization would be less than what you save with careful design, such as using strings from program memory. In fact their choice of -Os (optimize for size but not at the expense of speed) is probably a good choice.
Nick, I respectfully disagree. I was to optomize for speed. The compiler can make big wins here. My chip has 128k of flash, and leaving most of it empty gains me nothing. If the compiler can make the code faster (and it can) using -O2 or -O3, I'll take it.
Absolutely. Every design is a trade-off, and if in your case you have plenty of program memory, but want lots of speed, certainly optimize for speed. A lot of people however are trying to do stuff like lots of user interaction (which takes program space) but as long as the program responds in a few tenths of a second the speed is fine.
What I would really like is access to the compiler switches from the IDE. That includes warnings, if you want to see them, and customized optimizations.
[quote author=Nick Gammon link=topic=54456.msg443674#msg443674 date=1305606046]What I would really like is access to the compiler switches from the IDE. That includes warnings, if you want to see them, and customized optimizations.
[/quote]
Oh! Like the big note at the top of the preferences.txt file says, be sure to modify the correct file! You need to modify the local copy. Where the local copy is depends on your operating system but its not hard to find.
By the way, the latest github Arduino source has a lot less warnings, including many of the ones fixed in earlier posts on this thread. Plus I just submitted a patch that clear up all of the warnings I run into, so hopefully soon it will be silent. Yay!