avr-gcc Atmel AVR microncontrollers on Linux / Windows Arduino IDE

I recently heard all about avr-gcc and avr-lib support on Linux that can be used for developing code for Atmel AVR micro-controller (ATmega48/88/168, ATmega16/32). I also understand that Arduino also uses Atmel's AVR micro-controller (I am not sure which one).

Now different vendors have designed their own product (using Atmel AVR uc) where code is to be developed using avr-gcc i.e. on Linux platform. In the same regards Arduino's Windows IDE is much simpler and easy to code with.

I am confused as to which platform is more promising - what are the benefits of learning avr-gcc? Which is the better option to program using the same? There are many sites that provides much info about avr-gcc - I have done some sample programs on both platform. Arduino Windows IDE (using Arduino UNO board) is much simpler but programming Atmel AVR thru avr-gcc is much difficult (using other vendor product to program ATmega48/88/168, ATmega16/32). So why this difference and what’s the advantage of each? Should we learn (or spend time in self-educating) avr-gcc?

Are you asking if you should learn C++, or is this some other question?

I already know C/C++ well enough on Linux OS. My question is three fold:

  1. If I learn programming concepts using avr-gcc then what type of program or what type of application one can develop? I mean is it that avr-gcc is only used for programming Atmel's AVR micro-controller or I get benefit of learning to develop applications for other micro-controller / devices? Is avr-gcc compiler famous from perspective of development in embedded system world?

  2. Arduino IDE on Windows is pretty easy to use ( I believe it is also available for Linux) - then where and why developers use avr-gcc? Does it has any added advantage over Arduino IDE like performance / size of executable produced etc?

  3. Using Arduino IDE I understand that I can program only Arduino? Can I use it program any other AVR target processor?

Firstly, there are a number of different versions of the Arduino IDE. The latest version at this point is Arduino 1.5(.4r2) Beta which is the only one with support for the recent Arduino Yún and Arduino Due boards.

The previous "stable" version is 1.0.5. Both of these can be installed more-or-less easily with the Windoze installer, or manually to Linux. :frowning:

Unfortunately, whoever is responsible for the Linux repositories seems to have failed to update them beyond 1.0 which is most unfortunate as this install from the Linux repositories (as with most software packages) is absolutely painless and considerably easier and more reliable than on Windoze.

Now under Linux, most devices including the USB serial devices are effectively "driver-free" - which is to say the drivers are there but managed automatically by class rather than by manufacturer and model - whilst on Windoze you have to discover the necessary drivers from often poorly documented and obscure sources. So compared to Windoze, using the Linux IDE for Arduino is a breeze! The only thing you need to do when plugging in a USB device new to a session, is to do so before starting the Arduino IDE.

Of course, the language is entirely independent of the operating system. In fact, the IDE is running in Java on a JRE. Java JREs are a major headache (security disaster) if you permit them to be accessed by a Web browser which you should of course ensure you never do. The Arduino IDE is however, a good example of what Java can provide by way of platform-independence - it also runs on the ARM hardware such as the Raspberry Pi (and presumably, Funduino).

My experience is that it is much faster on Linux than on Windoze but of course, this may be from observing different computers and different versions - I have not tested it "head to head" on just one computer.

Since the actual install is essentially automated, you need to know nothing as such about avr-gcc or avr-lib. You need to become familiar with whatever subset of C is used for the Arduino, best learned primarily through working on example code (and a general C reference I suppose - I really have not used C variants elsewhere to any extent). I am sure that you may expect no difference in the language implementation between Windoze and Linux.

prakash_prasad:

  1. If I learn programming concepts using avr-gcc then what type of program or what type of application one can develop?

Whatever is within the capabilities of the particular MCU.

prakash_prasad:
I mean is it that avr-gcc is only used for programming Atmel's AVR micro-controller or I get benefit of learning to develop applications for other micro-controller / devices? Is avr-gcc compiler famous from perspective of development in embedded system world?

It would be called avr-gcc for a reason.

prakash_prasad:
2. Arduino IDE on Windows is pretty easy to use ( I believe it is also available for Linux) - then where and why developers use avr-gcc?

Because they want to?

prakash_prasad:
Does it has any added advantage over Arduino IDE like performance / size of executable produced etc?

I'm assuming avr-gcc is what the Arduino IDE is using.

prakash_prasad:
3. Using Arduino IDE I understand that I can program only Arduino? Can I use it program any other AVR target processor?

Most of them I believe, though some configuration is needed for other than those presently employed in Arduino devices. Sellers using other devices generally provide extensions for that purpose.

  1. If I learn programming concepts using avr-gcc then what type of program or what type of application one can develop?

Whatever you want to.

I mean is it that avr-gcc is only used for programming Atmel's AVR micro-controller or I get benefit of learning to develop applications for other micro-controller / devices? Is avr-gcc compiler famous from perspective of development in embedded system world?

It's C++. What you learn will translate to any other system that uses C++. That's, like, most of the Windows/Mac/Linux applications plus imbedded systems.

Yes, it's famous. Very.

  1. Arduino IDE on Windows is pretty easy to use ( I believe it is also available for Linux) - then where and why developers use avr-gcc? Does it has any added advantage over Arduino IDE like performance / size of executable produced etc?

When you compile using the IDE it calls avr-gcc. So I don't know what you mean by "advantages over". That's like asking "if I eat a banana, are there advantages over eating a banana?"

prakash_prasad:
3. Using Arduino IDE I understand that I can program only Arduino? Can I use it program any other AVR target processor?

There are quite a few AVR processors badged "Arduino".

So "any other" than what?


This is the "Project Guidance" part of the forum. What is your project?

prakash_prasad:
I already know C/C++ well enough on Linux OS. My question is three fold:

  1. If I learn programming concepts using avr-gcc then what type of program or what type of application one can develop? I mean is it that avr-gcc is only used for programming Atmel's AVR micro-controller or I get benefit of learning to develop applications for other micro-controller / devices? Is avr-gcc compiler famous from perspective of development in embedded system world?

If you are programming on Linux, you likely are using GCC there. GCC supports multiple different front ends (C, C++, Fortran, Ada, Objective C, Objective C++, Go, and Java), and many different machines. In my 25+ years of working on GCC, I have worked on IBM/Motorola PowerPC, Intel/AMD x86, various chips using the MIPS instruction set, Fujitsu FRV-500, TI TMS320C80, Mitsubishi M32RX, Mitsubishi D30V, Mitsubishi D10V, National NS32K, and Motorola/Data General 88100. On my Arduino Uno, Digispark, Trinket, Gemma I use avr-gcc because those processors use the AVR microprocessor, and on my Teensy 3.0, I use the arm-gcc.

Note, the Arduino IDE actually uses avr-gcc/arm-gcc underneath the covers, so it is a matter of whether you are dealing with a GUI (Arduino) or command-line/make (the AVR development system from ATmega).

The IDE does use GCC underneath the covers, but it has frozen on the 4.3.2 release of GCC that is now several major versions out of date (the current released version is 4.8.1, and we soon will be having a feature freeze for 4.9.0). This means you are not able to use the C++11 features that some people now want to use.

If you feel more comfortable with either command line/make environments or using the Eclipse IDE, you could switch to using those. Lets see, here is a link I saved about using Eclipse: http://eclipse.baeyens.it/. Here are Makefile instructions: GitHub - sudar/Arduino-Makefile: Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial..

IMHO, the IDE tries to be too helpful to newbies, in that it tries (and succeeds most but not all of the time) at putting forward references to functions. However, I feel a major short coming of the IDE is that it breaks using conditional compilation. For example, on the Uno you use i2c via the Wire functions, while on the ATtiny85 systems (digispark, trinket, gemma, etc.) there isn't enough room for the full Wire support, so they use TinyWireM. However, the IDE tries to bring in the Wire library on ATtiny85 systems and TinyWireM on the Uno and gets compilation errors.

While GCC is the most popular choice for embedded and Linux programming, there are other compiler choices out there, such as LLVM, which is another freely available compiler, and some compilers that you pay for, such as Metrowerks that I worked at briefly.