Collection of Rakefiles to start of and avoid the Arduino IDE.
Here you'll find a pure C, C++ and Arduino C++ scaffolds with optional libraries support.
git clone git://github.com/nofxx/avr_scaffold.git
https://github.com/nofxx/avr_scaffold/zipball/master # .zip https://github.com/nofxx/avr_scaffold/tarball/master # .tar.gz
And choose a scaffold, options: c, cpp, asm or arduino:
cp -r avr_scaffold/<LANG> ~/newproject
$ rake -T # see all tasks $ rake # build the project, flash to the arduino $ rake clobber # clean the project
- ATMega328P datasheet - http://www.atmel.com/dyn/resources/prod_documents/doc8161.pdf
- Arduino UNO Schematic - http://arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf
The following are instructions for getting up and running under different operating systems. This will take you through installing avr-gcc, avr-libc, avrdude, and the AVR GNU Binutils.
Getting the environment up and running on Linux is quite simple. One need only install some packages. These are all supported in the package manager. Open a terminal and run the following command:
$ sudo apt-get install binutils-avr avr-libc avrdude gcc-avr
$ sudo pacman -S avrdude gcc-avr
Building and Running the Sample Project
Each scaffold is driven by a Rakefile. If you're not familiar with Rake, you'll want to take some time to familiarize yourself with it. It's integral to the operation of this scaffolding.
The different stages of the build process are broken down into different rake
tasks. These can be viewed by running the command
rake -T in the
scaffold directory. You'll see something like this:
$ rake -T rake clean # Remove any temporary products. rake clobber # Remove any generated file. ...
The name of the serial port used by the programmer may be passed as an environment variable to the rake. If you do not know how to identify the name of the serial port used by the programmer, consult with the section corresponding with your operating system under the 'Identifying the Name of the Programmer Serial Port' later in this document.
rake SERIAL_PORT=[serial port name]
I recommend installing the needed AVR tools by means of Homebrew. If you're already setup with homebrew, then you should just have to execute the following commands. If not, take a moment to read a bit about Homebrew and get it setup on your Mac.
Once you're ready, here are the commands to install the needed tools:
$ brew install avrdude $ brew install https://raw.github.com/larsimmisch/homebrew-alt/3a4f8ce4bcda88c25f4fa4ea3f42688a2ed03d12/avr/avr-binutils.rb $ brew install https://raw.github.com/larsimmisch/homebrew-alt/124853640317af04e11269c517d449dbd202773d/avr/avr-gcc.rb $ brew install https://raw.github.com/larsimmisch/homebrew-alt/7d774c6b15dafdee6ca518aff5e8368528d69ae0/avr/avr-libc.rb
These are built from source and will take a while to complete.
Collection of software that can be used to replace the IDE's one:
GNU screen - Linux/OSX http://www.gnu.org/software/screen/
Example 19200 bps, 8-N-1 parity:
screen /dev/ttyUSB0 19200,cs8
minicom - Linux/OSX http://alioth.debian.org/projects/minicom
Example 19200 bps, 8-N-1 parity:
minicom -b 19200 -8 -D /dev/ttyUSB0
picocom - Linux/OSX
Subduino - Ruby http://github.com/nofxx/subduino
serialport - Ruby https://github.com/hparra/ruby-serialport
pySerial - Python http://pyserial.sourceforge.net
node-serialport - JS https://github.com/voodootikigod/node-serialport
hterm - Linux http://www.der-hammer.info/terminal
gtkterm - Linux/Mac https://fedorahosted.org/gtkterm
There's .inc files included in asm/incs. After trying for full day to download from: http://www.attiny.com/definitions.htm Server was off.
Exploring the Source Code
This works with others arduinos and barebones AVRs too. Tested on Duemilanove and the Blackwidow.
Chips ATMEGA328p, ATMEGA32, ATMEGA64 and ATTiny85. Programmer USBASP.