Programming AVR microcontrolleur with Qt-Creator without makefile

This article explains how to compile and program ATMELL devices with Qt-creator. This tutorial is based on the following versions of softwares and assume they are already installed:

  • Ubuntu 14.04 LTS
  • Qt Creator 3.0.1
  • avr-g++ (gcc version 4.8.2 (GCC))
  • avrdude 6.0.1

Create project

Create a folder for your project:

mkdir path/to/myproject

Change directory for the project folder:

cd path/to/myproject

Create five empty files:

touch myproject.config myproject.creator myproject.files myproject.includes main.cpp

Add the keyword [General] in the file myproject.creator:

echo [General] > myproject.creator

Add the source file name main.cpp in the file myproject.files:

echo main.cpp > myproject.files

Start Qt Creator and open the file myproject.creator. You can also open the file with a right click or with the following command:

qtcreator myproject.creator

Once Qt Creator is started, the project should be visible. Edit the file main.cpp, this is a very simple example:

 * This simple program shows how to start with Qt-Creator, avr-g++ and avrdude
 *  Fuses configuration (Fuses OK (H:FF, E:DF, L:EE):
 *       Extended :      0xDF
 *       High :          0xFF
 *       Low :           0xEE
 * To compile the project :
 *   avr-g++ -mmcu=atmega32m1 -Os main.cpp -o output.elf
 * To upload the file :
 *   avrdude -c avrispmkII -p m32m1 -P usb -U flash:w:output.elf
 * To update the fuses :
 *   avrdude -c avrispmkII -p m32m1 -P usb -U flash:w:output.elf  -Ulfuse:w:0xeEE:m -Uhfuse:w:0xFF:m -Uefuse:w:0xDF:m
 * Qt Creator project configuration:
 *  Build steps (Custom Process Step)
 *      Command :               avr-g++
 *      Arguments :             -mmcu=atmega32m1 -Os main.cpp -o output.elf
 *      Working directory :     %{buildDir}
 *  Clean steps(Custom Process Step)
 *      Command :               avrdude
 *      Arguments :             -c avrispmkII -p m32m1 -P usb -U flash:w:output.elf
 *      Working directory :     %{buildDir}
 *  Run (Custom


// 8MHz oscillator
#define	F_CPU 8000000UL


int main()
    // Set bit 7 of PORTC as output
    while (1)
        // Invert the bit 7 of PORTC
        PORTC = PORTC ^ 0x80;

        // Wait 500ms (the leb connectod to the bit 7 of PORTC will blink at 1Hz)

Configure the project

Go to the project tab and configure Qt Creator according to the following snapshots:


For uploading the project, two choices are possible (Deployment or Run). I used Deployment because the programming result is directly analysed by the Qt Creator IDE (the red bar becomes red in case of error). Note that an executable must be set, the echo command is here a dumb command.
Note also that this example is based on an atmega32m1 which is not originaly supported by this version of avrdude (for example, replace m32m1 by m328p if you want to use an atmega328p).

Screenshot from 2014-05-25 13:55:00

Leave a Reply

Your email address will not be published. Required fields are marked *