Documentation:AVR GCC/Winavr
From AVRFreaks Wiki
Contents |
[edit] AVR-GCC, WinAVR and the GCC-plugin
How does it all come together?
[edit] AVR-GCC
Avr-gcc is an Open source C compiler and assembler
It is part of the GNU Project, and free to download and use.
It can be compiled for any platform, and the development and support is done by volunteers.
AVRfreaks.net has some resources for the project, and it is also covered in
this wiki.
[edit] WinAVR
WinAVR is a collection of AVR software pre-compiled for Windows. It contains:
- a C Compiler, an assembler and a C library
- Linker and Librarian
- File conversion + other utilities
- Programmer software, Debugger, In-Circuit Emulator software
- Editor / IDE
- Many support utilities...
The WinAVR distribution is a single, ready to install package. It installs itself by a simple double-click.
It was first built and maintained by Eric Weddington, who is still running the project. You will find more info + downloads on the WinAVR homepage.
[edit] AVRstudio and the GCC plugin
The Avr-gcc plugin makes AVRstudio the First IDE with a Free C-compiler! It makes AVRstudio a complete environment for C and asm devlopment, including debugging.
The plugin is included in the AVRstudio installer package, so all you need is to:
but the sequence is irrelevant. AVRstudio will look for WinAVR’s avr-gcc key in registry upon startup. If winAVR is not installed, the plugin itself still works, but of course it can't build anything.
AVRstudio + WinAVR is the recommended constellation, but other distribution can also be used with the plugin. The plugin allows you to set the path to the gcc and make binaries, so you can even use your own, home-built versions of the tools!
Creating a new C-code project in AVRstudio is now as easy as:
- Select "New project", device and platform
- write code
- compile and debug
The GCC-plugin will create a proper makefile for you!
This is fed to the compiler to have your project built with minimum hassle - a small step for the experienced developer, but a giant leap for humanity.
There are many powerful settings readily available:
- Optimization level
- Include paths, libraries, linker options
- use external makefile if you like
- memory settings, create special segments for flash data, bootloader code
- etc...
[edit] Porting from IAR to avr-gcc
Here's a collection of points to consider when porting code from IAR to avr-gcc:


