Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Last updated: Friday 13 November 2026 @ 17:29:40
Programming for Engineers

AVR-GCC and AVRDUDE

In this practical you will configure the tools used to compile C programmes for AVR microcontrollers and upload the resulting firmware to a development board. You will also check that the tools are accessible from Git Bash before moving on to the next laboratory.

AVRCGCCAVRDUDEPATH

1. Understanding the AVR tools

ToolPurpose
avr-gccCompiles C code for the selected AVR microcontroller.
avr-objcopyConverts compiled firmware into a format such as Intel HEX for uploading.
avrdudeCommunicates with a supported programmer or bootloader to write firmware to the microcontroller.
makeOptional build automation tool; reads a file named Makefile containing build instructions.

2. Configure your environment

The following instructions use Git Bash on Windows. The specified locations correspond to Arduino-installed AVR tools; they may differ if Arduino IDE was installed elsewhere or if different tool versions are installed.

  1. Open Git Bash and edit your Bash startup file.

    nano ~/.bashrc
  2. Choose the appropriate environment below and append both export PATH=... lines to ~/.bashrc.

    export PATH="$PATH:/c/ProgramData/arduino-ide-v2/Local/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin"
    export PATH="$PATH:/c/ProgramData/arduino-ide-v2/Local/Arduino15/packages/arduino/tools/avrdude/8.0.0-arduino1/bin"

    These paths correspond to the university installation described in this workbook.

    export PATH="$PATH:/c/Users/yourusername/AppData/Local/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin"
    export PATH="$PATH:/c/Users/yourusername/AppData/Local/Arduino15/packages/arduino/tools/avrdude/8.0.0-arduino1/bin"

    Replace yourusername with your Windows username, and adjust the paths if your Arduino installation uses different version directories.

  3. Save the changes in nano using Ctrl+O and Enter; exit with Ctrl+X.

  4. Reload the configuration in the current shell.

    source ~/.bashrc
  5. Check that the shell can find both tools and display their versions.

    command -v avr-gcc
    command -v avrdude
    avr-gcc --version
    avrdude -v
    If a command is not found

    Confirm that each directory exists on your computer and contains the corresponding executable. The names 7.3.0-atmel3.6.1-arduino7 and 8.0.0-arduino1 are version-specific; an Arduino IDE update may install different folders. Ensure you have reloaded ~/.bashrc after editing it.

3. Check your understanding