This is a template setup of a virtual development container for AVR microcontroller projects, using avr-gcc for compilation. It includes a suite of scripts designed to streamline the processes of flashing firmware to the microcontroller and monitoring its serial output.
Before using this template, ensure you have the following software installed on your system:
- Docker
- Visual Studio Code (VS Code)
- Dev Containers (VS Code extension)
To deploy firmware to your microcontroller, navigate to the script
directory and execute the flash-firmware.sh
script. This utility simplifies the process of transferring your compiled code onto the AVR device.
First install avrdude:
# macOS
brew install avrdude
# Linux
sudo apt-get update
sudo apt-get install avrdude
# Windows or WSL
# Download from website: https://www.nongnu.org/avrdude/
Then run the flash firmware script:
cd script
chmod +x ./flash-firmware.sh
./flash-firmware.sh
# You can also specify your device port
./flash-firmware.sh -p <YOUR-PORT>
# Example
./flash-firmware.sh -p /dev/cu.usbserial-110
For real-time observation of the microcontroller's serial communication, the following utilities are provided within the script
folder:
- For a basic monitoring setup, execute:
cd script
chmod +x ./monitor-mcu.sh
./monitor-mcu.sh
- Alternatively, for a more flexible monitoring experience, run the
monitor-mcu.py
Python script. Ensure Python and pySerial are installed on your system.
python monitor-mcu.py
If you are uncertain about your device's port, you can determine it using the following commands in your terminal or command prompt:
macOS
ls /dev/cu.* # Option 1
ls /dev/tty.* # Option 2
Linux:
dmesg | grep tty # Option 1
ls /dev/ttyUSB* # Option 2
ls /dev/ttyACM* # Option 3
Windows
mode
Contributions are welcome. Please fork the repository, make your changes, and submit a pull request.
Distributed under the MIT License. See LICENSE
for more information.