Stupid Question: What compiler is used?

If I am using a Arduino Mega 2560 Rev. 3. Simply put, what compiler is in use? I read http://www.arduino.cc/en/Main/Documentation and http://arduino.cc/en/Hacking/BuildProcess and that provided some help. I saw through a few google searches the AVR-GCC compiler seems to be in use. Can I find out which one specifically? I also know that it is changed to be in correct C format with a basic main function, but how exactly is the .ino turned into .c with the Arduino core functions (Is this simply Arduino.h). Thanks.

I'm not aware of any documentation describing exactly what mucking-about the Arduino IDE does with your sketch .INO file to generate the .cpp file. From observation, it inserts a #include for arduino.h, generates prototypes for the functions and variables defined in the file, and puts all the files it thinks are needed to build your sketch into a temporary directory. I think the algorithm for doing the inserting may have evolved in recent versions since some people have said that it is now possible to pre-empt the auto-generated prototypes by inserting your own prototypes, but that doesn't work for 1.0.4 which I use.

If you use File/Preferences to display the Preferences window and select the 'Show verbose output during: compilation' option then when you verify the sketch it will print the name of the temporary directory where the files generated by the IDE are stored. These are the files actually passed to the compiler. By comparing these .cpp files with the original sketch .ino files and tabs you can get an idea of how the IDE has modified your code to generate the .cpp which is actually compiled.

http://arduino.cc/en/Hacking/BuildProcess

avr-gcc 4.3.2, approximately, for the AVR

The version number is very important. Shouldn't this be stored in some txt file or something inside my portable edition of Arduino 1.0.5?

The version number is very important.

No! Not for Arduino users. Arduino addresses version control for users at the 1.01, 1.03, 1.05, exc. levels. Tool versions are of no concern to the user of the GUI.

IF you want to be concerned about run-line compilation, then:

C:\>avr-gcc -v
Using built-in specs.
Target: avr
Configured with: ../gcc-4.3.3/configure --enable-win32-registry=WinAVR-20100110
--with-gmp=/usr/local --with-mpfr=/usr/local --prefix=/c/WinAVR --target=avr --e
nable-languages=c,c++,objc --with-dwarf2 --enable-doc --disable-shared --disable
-libada --disable-libssp --disable-nls --with-pkgversion='WinAVR 20100110' --wit
h-bugurl='URL:http://sourceforge.net/tracker/?atid=520074&group_id=68108&func=br
owse'
Thread model: single
gcc version 4.3.3 (WinAVR 20100110)

For documentation purposes, I needed to know the version as I like to brake down the hardware and software setup to be replicated days, weeks, months, or years later. So for an arduino user after finishing a project, it is VERY important.

@KeithRB, maybe I am just an idiot, but I have no idea how to look at that link or use it to answer my question.

By printing out the values of those defines, you can tell exactly what version of GCC was used to compile your program.

napkinsterror:
The version number is very important. Shouldn't this be stored in some txt file or something inside my portable edition of Arduino 1.0.5?

I dunno, it the Arduino team thought it was important, perhaps they might consider going to newer versions of the compiler than a 5 year old compiler whose source tree at the Free Software Foundation is now frozen. Yes, there are perhaps some new features that need to be dealt with (the underlying support for PROGMEM changed for instance), and perhaps there are some bugs that need to be fixed in the GCC or perhaps the changes need to be made in the Arduino libraries.

Right now, GCC 4.8.1 is the current released version, and 4.7.x is widely used.
</grumble from a GCC maintainer>

For documentation purposes, I needed to know the version as I like to brake down the hardware and software setup to be replicated days, weeks, months, or years later. So for an arduino user after finishing a project, it is VERY important.

I once worked for a Fortune 10 company and they could not make what you are inferring work because a workstation simply needs to be cloned with the tools intact, that is, frozen in time. However, this did not work because some license files expired. Your best best is just to put the Arduino installation ZIP into the local/off-site backup with the source. I agree that you need to document it, and while "months " later may be a reality, "years" later is somewhat unrealistic based upon my experience with Y2K projects.

Ray

avr-gcc 4.3.2, approximately, for the AVR

Perhaps True for windows ,but not sure.
False for Linux ! And sure .

Debian :
old stable (Squeeze) : 4.3.5
Stable (Wheezy), Testing (Jessie) and Sid : 4.7.2

If you need absolutly to know the exact version use Linux.

If you need absolutly to know the exact version use Linux.

"Absolutely"... Oh, come on! Or just drop down in Windows to the command prompt and find out from the utility as I showed earlier!

Ray

When your working with power utilities and systems, years is common. Half of the project is interfacing with a machine made in 1995(I am not sure they had repositories or version control back then from the looks of it haha) . I have put the arduino 1.0.5 zip stored in there, but since the board design is likely to be recreated and stripped of most of its... Arduinoness? and most people here just do everything in Eclipse or the like they would not want to touch the Arduino IDE. Thanks for the help! (It does seem to be 4.3.2 or 4.3.3)

Edit:
I found some good ol' text files inside the arduino directory -> hardware -> tools -> avr

When your working with power utilities and systems, years is common. Half of the project is interfacing with a machine made in 1995(I am not sure they had repositories or version control back then from the looks of it haha) .

Fone_Company... ultimate insanity... BTDT... BeenThereDoneThat

With middleware and PC software, there is little hope of having a sane Backup and Recovery plan that would past scrutiny years down the road. Just having the ZIP or tar-ball in archive does not mean that you can reconstruct perfectly... there are Windows USB drivers and such that may not be supported years down the road... which was my point about having entire machines in warehouses for DR until someone realized that much of the development software had license keys.

I know personally many of the DR folks in the Atlanta office... they have created safety nets and procedures at great cost to manage such scenarios. They spend hundred of hours a year testing the procedures and fine-tuning them. It makes me glad I'm retired.

All the above being said, if you noted my versions in the post, you will see that my system has been patched ahead of yours if you are running plain vanilla. But worst, outside of the software versions that can be coaxed from executables, there are configuration files such as boards.txt and programmers.txt that can impact a successful build, so good documentation is going to have to document those flat files, too, since the time/date code is not to be overly trusted in a Windows world.

Ray

"I found some good ol' text files inside the arduino directory -> hardware -> tools -> avr"

Of course, you have to trust that this gets updated with every change...

For documentation purposes, I needed to know the version as I like to brake down the hardware and software setup to be replicated days, weeks, months, or years later. So for an arduino user after finishing a project, it is VERY important.

Yes, and no. Having your arduino sketch work depends on having a matched (and "working") set of avr-gcc, binutils, avr-libc, avrdude, AND the arduino libraries. Since the Arduino "package" includes all of those, "Arduino 1.0.2" is the correct level of packaging/versioning to be looking at.

You can get individual version numbers by running the individual tools from their homes within the arduino distribution (.../hardware/tools/avr/bin) with the -v or --version or whatever switches. (exact directory is somewhat dependent on OS and Arduino version.)

avr-gcc 4.3.2, approximately, for the AVR

Perhaps True for windows ,but not sure.
False for Linux ! And sure .

That depends. It USED to be the case that the Arduino install procedure for linux-like operating systems included installing the avr-gcc compiler separately from the IDE, using your favorite package manger. This lead to a lot of people running into bugs because the version(s) that their linux installed was buggy, buggy WRT Arduino, or mis-packaged. If you download the LATEST Arduino .tgz file, it includes complete copies of ... avr-gcc 4.3.2...

perhaps they might consider going to newer versions of the compiler than a 5 year old compiler

Well, Arduino is about 5 years old. IIRC, they started out using the latest version that was available packaged for both windows (WinAVR) and Mac (CrossPack), and then got burnt with significant bugs in later versions: avr-gcc, avr-libc compiler and toolchain known bugs · Issue #1208 · arduino/Arduino · GitHub (also, WINavr stopped getting updated as well, and Atmel was pretty slow to adopt/suppprt new versions of gcc) (It doesn't help when bug reports to the gcc community get answers like "you're doing it wrong, and it was never supposed to work the way that you're using it.") NOW, it looks like 4.7.2 would be a fine version to jump to, but that's only been true for a couple of months (ie the same time when Atmel switched Atmel Studio to 4.7.2)

I have put the arduino 1.0.5 zip stored in there, but since t ... people here just do everything in Eclipse or the like they would not want to touch the Arduino IDE.

It doesn't matter; most of the Arduino zip is copies of the binaries for all of the OTHER tools, including gcc/etc.