


make will run the avr-gcc compiler and other parts from the toolchain, to produce a binary. Make is a build automation tool which, well, automates the build process. In most cases you will use some kind of programmer, that is connected to your computer on one side and to the micro-controller on the other side. BTW: “cross” means, that the compiler itself will run on another architecture than the binary it is compiling.Īvrdude is the tool to actually flash the compiled binary file to a micro-controller. It already contains many functions and header files that are optimised for the target platform.Īvr-gcc is an open source cross-compiler for Atmels AVR micro-controllers and part of the so called toolchain, that will produce a ready-to-use binary that can be flashed to a micro-controller. STK500, USBasp, AVR-Doper or similar), other source code modules, fuse options etc.Avr-libc is the standard library for AVR micro-controllers. For a real project you should also edit Makefile to configure your uploader hardware (e.g.

data -O ihex main.elf main.hexĪvrdude -c USBasp -p atmega8 -U flash:w:main.hex:iĪvrdude: AVR device initialized and ready to accept instructions Now we compile the code and send it to the device: bash$ makeĪvr-gcc -Wall -Os -DF_CPU=8000000 -mmcu=atmega8 -c main.c -o main.oĪvr-gcc -Wall -Os -DF_CPU=8000000 -mmcu=atmega8 -o main.elf main.oĪvr-objcopy -j. We edit main.c and implement the blinking loop: #include ĭDRD = 1 << 4 /* make the LED pin an output */ The command avr-project creates a minimum firmware project which is configured for an ATMega8 with internal RC oscillator at 8 MHz. bash$ cd Desktopĭrwxr-xr-x 3 cs cs 102 Nov 22 18:29 Demo.xcodeprojĭrwxr-xr-x 4 cs cs 136 Nov 22 18:29 firmware This project is described in more detail in CrossPack’s manual. So let’s demonstrate CrossPack with a trivial project, a blinking LED implemented on an ATMega8. Since CrossPack consists of command line tools only (except the HTML manual which is linked to your Applications folder), you need to know some basic command names.
