Question

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? What type of application can we develop using avr-gcc compiler?

Was it helpful?

Solution

Arduino has been developped so you can use whatever OS you want to write your code, it won't affect your final application on the Arduino. Linux, OS X, Windows, are all equal regarding the compilation and upload using the Arduino IDE, so you can choose the one you prefer. For example, I use OS X and Linux on a daily basis with the same results.

It works this way because the tools you need to compile your code and upload it on the Arduino are all present inside the Arduino IDE application. You don't need to install avr-gcc or anything else besides the IDE. That's wonderful for beginners because you can code your apps right away. The other reason why it works so seamlessly is because the Arduino uc are burnt with a bootloader which is able to accept new code from the Arduino IDE through a simple USB cable.

If you want to programm your own uc with the Arduino IDE, you first need to burn the bootloader so that your chip works like an Arduino but is not really and Arduino. Here is a tutorial to do that : http://arduino.cc/en/Tutorial/ArduinoISP

Before using an uc, you need to check if a bootloader is available for this uc. You can do so here: board.txt

One other thing to keep in mind is that when your project goes bigger, using the Arduino IDE can be a pain in the neck and you'll want to use things like Makefiles and stuff with your favorite code editor.

So to put it in a nutshell, the operating system is not the important part now. But if you build more complexe projects with more tools, I would go with Linux or OS X, because avr-gcc and co. are really easy to use on those plateform (and more documented in my own opinion).

EDIT:

First, I will clarify some concepts:

avr-gcc is a compiler. It is the software that takes your code and transforms it into something usable/executable by your Arduino microcontroler or any AVR chip. It is based on gcc, a famous open source compiler for C/C++. So when you use avr-gcc, you are only just using gcc with some specific implementations.

You have to differentiate between two things : the hardware development and the software development. The hardware is basically "making your own Arduino with what you need". The software needs to know the hardware to be written and do what your want. It's looks like the chicken or the egg paradoxe but really it isn't : I would say the hardware comes first.

So if you're beginning hardware development, I would sugget that you first buy an Arduino to learn the concepts. All the Arduino code is open source so you can really try to understand everything.

The AVR chips are widely used so once you get to know one, it will be easier to try and use different ones. And even if you need to change for another brand, the basics will be the same, even if you won't be able to use avr-gcc. But to start somewhere, go for Arduino! :)

I wrote some documentation for my project where I explain everything with greater details. It is intended for OS X and Linux but it will give you a good idea of what you need to do.

https://github.com/WeAreLeka/moti/blob/master/INSTALL.md

Hope it helps!

OTHER TIPS

In theory, your compiler choice shouldn't affect what you can actually do with the device. One compiler should let you access the same device functionality as another. They may support slightly different language features, and the libraries could be a little different. However, unless the compiler is seriously broken, you can always work around those differences.

One area where you may see a tangible (albeit small) advantage is in the size and efficiency of the compiled code. For example, one compiler may have better optimisations, which can give a more concise output. That means you might be able to squeeze a very slightly bigger program onto the device. The differences are likely to be slight, as most modern compilers are pretty good, but it may be enough to be useful.

Beyond that, you're really looking at the practicalities and personal preferences of your toolchain; e.g. if your favourite editor/IDE only works on Windows, or you need a good debugger which only works on Linux, etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top