Beware: This page contains information about the AVR ATMega8 as well as the AVR ATMega88 and the AVR ATMega88A. These chips are all extremely similar and only very slightly different...however the differences are extremely important. Of particular note, the AVR fuses differ as do the serial communication modules.
Again: If you are going to use a Makefile from this page as a base (and I encourage you to do so), be sure to double and triple check the AVR fuses prior to programming
There is some excellent information on avr-gcc, avr-objcopy and avr-objdump here. Essentially avr-gcc will generate an "executable" file with all the needed information, and from that avr-objcopy can extract the information to send to the programmer. It is not difficult, but it is far from intuitive.
Here is the makefile and the c program that we did in class 4/5/2016 it is for a mega88A
Here is the script I used (on OpenSuse) to build a patched version of Avrdude for use with Andy's programmer
Here is the script translated to Ubuntu...not well tested, use at your own risk.
A sample makefile watch our for tabs! They are important and often get changed to spaces after three or four document formattings. The Makefile must be named Makefile, the first character is capitalized, there is no extention. You will need to change the ADFLAGS for sure, and TARGET (unless you name your program serial) and probably not much else.
A sample c file for an AVR ATMEGA8. It continually does the bright/dim on an LED and echos serial. Whenever it gets a character it echos back the next character.
Most of the files on this page are for an AVR ATMega8, an older, slightly less capable, more expensive chip that the AVR ATMega88A is *almost* upward compatible with. The differences are slight and very annoying. Here is a Makefile and a sample c file for the Mega88A.
Another sample C file, kind of a hello world over the serial port
and the makefile to go with it
Note that the FT232/ftdi programmer is not standard with avrdude, although the printer port one is (I'm 99% sure), (use -c bsd) anyway, here are some directions https://docs.google.com/document/d/18OsuNFPJhk_wbk3V9dMQM-rktafkW_Airpg9-iMtcLU/edit?hl=en
Here's the programmer/development board/usb serial board
The Interrupts on an AVR ATMEGA8 http://docs.google.com/a/maine.edu/View?id=dsm92x5_113csgq8w88
A short and incomplete document that talks about the timers on an AVR https://docs.google.com/document/d/1WOCMjyv1EMDwRVpeBsXFa3lKL4lorhbVYieNT8RJlwY/edit
http://electrons.psychogenic.com/modules/arms/art/8/AVRProjectOrganizationStandardizedAVRMakefileTemplate.php#maketarg An article on makefiles for the AVR
A tutorial on AVR fuses:
http://www.ladyada.net/learn/avr/fuses.html
A page to help figure out the correct fuses for your AVR (note that if you set the clock to external you will need an external clock to set it back)
http://www.engbedded.com/fusecalc/
and another
http://www.frank-zhao.com/fusecalc/fusecalc.php?chip=atmega8
Using printf and scanf on an avr
http://www.embedds.com/using-standard-io-streams-in-avr-gcc/
And some sample code
https://www.mainframe.cx/~ckuethe/avr-c-tutorial/lesson8.c
Frankly I think the sample code is needlessly complex. I have used printf and scanf in the code below. There's a lot going on in this code. The AVR expects to run at 8MHz and communicate at 9600 baud. It prompts you to enter hex numbers representing a pronto remote code. After you do this it "blinks" the signal on an IR LED connected to OCR1A. If, instead of entering a valid hex number you enter an invalid character, like a g, it will blink the "burp" sequence for a Robo Sapien robot. The code is here (or you can click download from below)