VSCode AVR skelleton base example project to work (develop) with Microchip-Atmel AVR microcontrollers on a Linux system without the need of a full IDE.
This project example target an atmega328p microcontroller, but the repository can be used as a reference to create new projects for other targets.
- Install required toolchain components:
sudo apt-get update
sudo apt-get -y install binutils
sudo apt-get -y install make
sudo apt-get -y install gcc-avr
sudo apt-get -y install avr-libc
sudo apt-get -y install cflow
- Install Flashing Tool:
sudo apt-get -y install avrdude
- Give execute permissions to tools scripts:
chmod +x vscode-skelly-avr/tools/*
Here is the steps that has been followed to create current project:
- Create project directories and setup current project:
mkdir ~/vscode-skelly-avr
cd ~/vscode-skelly-avr
mkdir bin build doc inc lib src test tools
-
Create src/main.cpp source file with some basic application (i.e. blink).
-
Create a build/Makefile with expected targets and configurations to build the project.
-
Create a ./vscode/c_cpp_properties.json file and setup C & C++ standard versions, Defines, compiler arguments that are used in project, and the include paths to system installed AVR libc to setup correctly intellisense functionality.
-
Create a ./vscode/tasks.json file and setup make commands to execute for each available tasks to be used from vscode.
-
Create a ./vscode/launch.json file and setup vscode project Run and Debug behaviour.
Build:
-
Physically connect the hardware programmer to target device and the PC.
-
Using a shell, go to build/ directory and run make to see build instructions.
-
Run make build DEVICE=X F_CPU=X to launch the Build.
-
Run make flash PROGRAMMER=X to build and flash the firmware into target device.