Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

how to load avr/io.h header files in the gcc compiler..im using 12.04 version of Ubuntu.. wen ever i run a AVR program this kind of error is generating " fatal error: avr/io.h: No such file or directory. compilation terminated." pl help me out

share|improve this question

1 Answer 1

try installing avr-libc and gcc-avr:

sudo apt-get install avr-libc gcc-avr

Then, to compile code for the AVR you need start by compiling it to an executable using: gcc-avr and then link it using avr-objcopy to create a hex file for the device:

avr-gcc -mmcu=atmegaX yourpgm.c -o yourpgm.elf

avr-objcopy -j .text -O ihex yourpgm.elf yourpgm.hex

Then, the hex file generated is the one to be installed on the device. You can use avrdude to import it. There are a lot more options that you can use for the compiler and linker, I suggest reading the man page for these tools; they are very helpful.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.