Appearance
Getting Started
This guide gets you from an empty checkout to building the included blink example for an ATmega328P/Arduino Uno style board.
Current compiler requirement
You need the newest C3 Compiler
To use this library you need a version of the compiler that is newer or atleast 0.8.0, since that was the point that avr support was included in the default executable.
Install or update to the latest nightly C3 compiler and make sure c3c is on your PATH:
sh
c3c --versionYou also need AVR upload tooling if you want to flash a board:
avrdude- an Arduino Uno / ATmega328P compatible board
- a USB serial port such as
/dev/ttyACM0or/dev/ttyUSB0
Clone the project
sh
git clone https://github.com/jotrorox/arduino.c3l.git
cd arduino.c3lBuild the blink example
The examples are standalone C3 projects. Start with examples/blink:
sh
cd examples/blink
c3c buildThe blink example project declares the important AVR settings in project.json:
json
{
"dependencies": ["arduino"],
"cpu": "atmega328p",
"targets": {
"blink": {
"target": "elf-avr",
"use-stdlib": false,
"link-libc": false,
"no-entry": true
}
}
}The output ELF is written to:
text
examples/blink/build/blink.elfFlash the board
Connect the board and check the serial device. The included helper defaults to /dev/ttyACM0:
sh
./scripts/flash.shIf your board appears on another port, edit examples/blink/scripts/flash.sh and change -P /dev/ttyACM0 to the correct device.
What to read next
- Blink Walkthrough explains the code line by line.
- Build & Flash covers the build files and uploader in more detail.
- GPIO and Time document the APIs used by blink.