Go Down

Topic: New Arduino IDE with an external AVR toolchain and compiler/linker options (Read 4 times) previous topic - next topic

ccpetersen

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.

Prebuilt IDEs with a readme along with the modified Compiler.java can be found here http://www.mostlysoftware.com/files

bperrybap

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.

That way this update is not forgotten.

--- bill

Nick Gammon

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.
http://www.gammon.com.au/electronics

ccpetersen

You have to get the source code and use ant to rebuild the IDE.  Look here for instructions http://code.google.com/p/arduino/wiki/BuildingArduino.  Replace the existing Compiler.java with my new one.

Alternately you could just download one of the prebuilt IDEs from my site.

skyjumper

Hi, thanks for this!

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:

Code: [Select]

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

Code: [Select]

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


Nick Gammon

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.
http://www.gammon.com.au/electronics

ccpetersen

@skyjumper, your welcome!

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.

skyjumper

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! 


ccpetersen

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.

skyjumper

Okay I'll try that, thanks!

And I am correct in seeing that you guys do -O3 by default?


Nick Gammon

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.
http://www.gammon.com.au/electronics

skyjumper


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.


Nick Gammon

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.
http://www.gammon.com.au/electronics

skyjumper

Is there a way to specify the compiler and/or linker options int eh preferences file, or some other easily modified file?

skyjumper

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.


Me too!

Go Up