La ferme de wikis a été mise à jour à la version 1.9rc1, rapportez tout problème à support@koumbit.org. Mentionner le numéro de billet #14822.
The wikifarm has been upgraded to MoinMoin 1.9rc1, report any anomaly to support@koumbit.org. Mention the ticket number #14822.

Contents

  1. Tutorial

I had a hard time at first understanding how to compile my programs and send them to my chips. I have an AVRISP2 programmer, for instructions on how to set everything up on OS X see this page.

Tutorial

I found my way by reading this guide.

They provide a very nice Makefile template. Just download it and set the flags at top of files to your own sourcefiles.

As a test, you can try the following test program empty.c:

/* Empty program, does nothing */
void main (void)
{
        return 0;
}

You then run make. Example:

# make
avr-gcc -I. -I. -g -mmcu=atmega644p -Os -fpack-struct -fshort-enums -funsigned-bitfields -funsigned-char -Wall -Wstrict-prototypes -Wa,-ahlms=empty.lst -c empty.c -o empty.o
avr-gcc -Wl,-Map,empty.out.map -mmcu=atmega644p -lm  -o empty.out empty.o  
#

Then make install will send it to the board using avrdude:

# make install
avr-objcopy -j .text                    \
        -j .data                       \
        -O ihex empty.out empty.hex
avr-objcopy -j .eeprom                  \
        --change-section-lma .eeprom=0 \
        -O ihex empty.out empty.ee.hex
avr-objcopy: --change-section-lma .eeprom=0x00000000 never used
avrdude -c avrisp2   \
 -p m644p -P usb -e        \
 -U flash:w:empty.hex 

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e960a
avrdude: erasing chip
avrdude: reading input file "empty.hex"
avrdude: input file empty.hex auto detected as Intel Hex
avrdude: writing flash (204 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 204 bytes of flash written
avrdude: verifying flash memory against empty.hex:
avrdude: load data flash data from input file empty.hex:
avrdude: input file empty.hex auto detected as Intel Hex
avrdude: input file empty.hex contains 204 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying ...
avrdude: 204 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

None: Electronix/AvrGCCProgramming (last edited 2009-11-05 14:47:35 by localhost)