How to use AVR template on Linux - tomas-fryza/digital-electronics-2 Wiki


  1. Download and install Visual Studio Code source code editor.

  2. AVR template requires the following packages to be installed correctly:

    sudo apt-get install git make avrdude putty doxygen doxygen-gui
  3. Download the latest toolchain AVR 8-bit Toolchain - Linux 64-bit from Microchip webpage, from this repository, or from Microchip's archive and extract all files to /opt directory:

    sudo tar -xzvf avr8-gnu-toolchain- -C /opt/


  1. Download and extract Examples folder from this repository to local computer.

  2. Start Visual Studio Code source code editor, open examples folder, and in Examples/ enable and/or modify Linux parameters according to your local settings:

    ## Linux
    PREFIX  = /opt/avr8-gnu-toolchain-linux_x86_64
    AVRDUDE = avrdude
    RM      = rm -f
    # See "dmesg" command output
    USBPORT = /dev/ttyUSB0
    ## Windows
    #PREFIX  = C:\Appz\Avr\avr8-gnu-toolchain-win32_x86
    #AVRDUDE = C:\Appz\Avr\avrdude.exe
    #RM      = del
    ## See USB-SERIAL CH340 port in Device Manager
  3. In Visual Studio Code, open a new terminal in menu Terminal > New Terminal and change working directory to Examples/blink.

    cd Examples/blink

    All processes are done with help of Makefile script file. The following commands allow compilation and programming:

    make all
    make flash
    make size
    make list
    make clean
  4. To create a new project, make a new directory within Labs folder and copy three files main.c, Makefile, and from Examples/blink project to Labs/new-project-folder

    If your Arduino board (or clone) does not contain any bootloader, follow instructions at Instructables or Arduino webpages.

    Install AVR Support extension in Visual Studio Code for AVR assembly language support.

Tested on operating systems

Version Result (yyyy-mm-dd) Note
Linux Mint 20.1, Ulyssa OK (2021-06-28) Office
Linux Mint 20.1, Ulyssa OK (2021-06-24) Laptop
Ubuntu 20.04.1 LTS, Focal Fossa OK (2020-12-22) Student, VirtualBox
Ubuntu 20.04.1 LTS, Focal Fossa OK (2020-12-10) Student, Laptop
Linux Mint 18.3, Sylvia OK (2019-06-13) Laptop
Linux Mint 18.2, Sonya OK (2019-05-17) Lab SC 6.61
Ubuntu 18.04.1 LTS, Bionic Beaver OK (2019-05-15) Office
Ubuntu 16.04, Xenial Xerus OK (2018-09-15) Office
# FYI: How to check OS version in Linux
cat /etc/os-release