AVR development on GNU/Linux Machine

Artists usually don't make all that much money, and they often keep their artistic hobby despite the money rather than due to it.

~Linus Torvalds

Electronics geeks all around the world are rapidly moving toward Linux based free tools for their development work. Most of the newbies find it difficult to switch fully to linux as the lack of availability of window counterpart tools in linux.

Here i am giving you an idea how to start AVR development while you are using some Linux distro as your OS. Now a days UBUNTU is one of the most popular Linux distro for beginners because it is very easy to use, and most of the necessary tools are packed with the distro.

Here i am describing how to write a program, compile a program and burn the AVR in UBUNTU. I checked this procedure on UBUNTU Desktop edition 8.10(previously) and 11.04 it should be compatible with others also but i didnt try. So lets start your embedded world with avr on Linux too

To start with AVR development on linux you need following four packages.

  1. avr-gcc
  2. avr-binutils
  3. avr-libc : standard AVR C library
  4. avr-dude : basic package that transfers your intel hex to MC

The whole installation procedure is explained in this Tutorial, but first let me explain you what these above 4 packages actually are;

avr-gcc is the C cross compiler for AVR which generates

avr-binutils- The binutils package provides all the low-level utilities needed in building and manipulating object files. Once installed, your environment will have an AVR assembler (avr-as), linker (avr-ld), and librarian (avr-ar and avr-ranlib). In addition, you get tools which extract data from object files (avr-objcopy), dissassemble object file information (avr-objdump), and strip information from object files (avr-strip). Before we can build the C compiler, these tools need to be in place.

avr-libc- it is the satndard function used while programming for AVR in C. It consistes of header files for utilizing the features of AVR like Interrupts, EEPROM, I2C, SPI, UART etc. For more info go to AVR-libc home http://www.nongnu.org/avr-libc/

avr-dude- AVR-DUDE is an open source utility to download/upload/manipulate the ROM and EEPROM contents of AVR microcontrollers using the in-system programming technique (ISP). For more info try this : http://www.nongnu.org/avrdude/

That is all about what AVR specific tools you need to do your stuff, but first thing you need is some editor where you can type your code. I use gEdit as a text editor on my machine.In all new releases of Ubuntu its already there with distribution otherwise Below is the command to install gEdit.

Installing gEdit Text editor

These days all Linux distribution has one or other Text editor already installed. All new versions of Ubuntu has gEdit editor. In case you don't have gEdit install you can install it by typing in the following command in a terminal window.

sudo apt-get install gedit

Or you can use Ubuntu software center to install it directly over there. Once gEdit is installed you can start it by typing gedit on terminal.

To make it more easy to use we can add some more plug-in with our gEdit installation, one very useful plug in is embedded terminal which allows us to use terminal window embedded with gEdit in bottom pane of the editor. To install gEdit plug-in issue following command in a terminal.

sudo apt-get install gedit-plugins

follow these steps to show terminal in the bottom pane of gEdit window.

  1. Goto Edit→Preferences
  2. Check the box for embedded terminal
  3. Now goto View→Bottom Pane (Ctrl + F9)
  4. It will open an attached window at the bottom of gEdit editing area. Its the Terminal window which can be used like any other Terminal window.

Fatal error: Allowed memory size of 100663296 bytes exhausted (tried to allocate 72 bytes) in /home/electroo/public_html/wiki/inc/auth/plain.class.php on line 290