Documentation:AVR GCC
From AVRFreaks Wiki
This article is a stub. You can help the AVR Wiki by expanding it.
AVR-GCC is a compiler that takes C language high level code, and creates a binary that you can program into your AVR.
Contents |
[edit] What is AVR-GCC
AVR-GCC is technically just a C (and C++) compiler. It is a port of GCC, the GNU compiler collection to the AVR target processor. Most references to avr-gcc are actually to the entire toolchain. For more information on the tools see AVR GCC Tool Collection.
[edit] Getting started with AVR-GCC
Getting started with avr-gcc can be easy! If you are not familar with microcontrollers, you should purchase a book on getting started with AVRs.
[edit] AVR-GCC on Unix and Linux
Depending on whoever packaged the Unix/Linux system, there might or might not be (pre-compiled) binary versions of the toolchain available.
Systems which are known to offer fairly up-to-date binary versions of the tools include
- [FreeBSD], via the ports system
- [Gentoo Linux], through portage
- [Debian Linux] (might lag a bit more behind the current versions)
- [Ubuntu Linux] AVR [packages]
For other systems, using AVR-GCC will require compiling from source. See the latest official avr-libc user manual for a description of how to do this.
As the official distributions of GCC and binutils often lag behind the fast pace of AVR development, patches are required in particular to get support for the latest AVRs. There is no formal repository for these patches, often the (ViewCVS-accessible) FreeBSD ports tree is used as the base to obtain them in an up-to-date form. (WinAVR adds some of their own to them then.) For a script to automate all this for Linux, see Bingo600's thread in the AVR-GCC forum.
[edit] AVR-GCC on Windows: WinAVR
To use AVR-GCC on Windows you can use the precompiled WinAVR.
See this page on WinAVR. Note that WinAVR is in fact avr-gcc, just a precompiled package set up to be used on Windows.
[edit] Porting from IAR to AVR-GCC
Here's an overview of considerations when porting code from IAR C-compiler to avr-gcc:
[edit] Useful AVR-GCC Links
Tutorials AT90UsbKey under Linux
avr-libc Frequently Asked Questions (FAQ) Read this!
Official avr-libc documentation (also covers related tools like AVR-GCC)
Official avr-libc demo projects
Bit Manipulation Tutorial (from the avrfreaks forum)
