Skip to content

prdktntwcklr/cpp-on-avr

Repository files navigation

C++ on AVR

C++ code for resource-constrained microcontrollers.

Getting started

The best way to get started is to use the provided Dockerfile that comes with all required dependencies pre-installed.

Building the project

To build the project for the target hardware, you have to supply the toolchain file as follows:

cmake -DCMAKE_TOOLCHAIN_FILE="avr.cmake" -B Build/Avr

Then, build the project:

cmake --build Build/Avr --target app size hex

Flashing firmware

These commands need to be run outside of Docker. First, erase the chip:

avrdude -p m168 -P COM6 -c avrispv2 -e

Then, flash the firmware:

avrdude -p m168 -P COM6 -c avrispv2 -U flash:w:app.hex

Further reading

  • Kormanyos, C. (2021): Real-Time C++: Efficient Object-Oriented and Template Microcontroller Programming. Springer Berlin Heidelberg.