Skip to content
Bare metal AVR library and Makefile.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Fix the Makefile, and blink example. Jun 23, 2018
lib Add nice delay library I found online. Apr 19, 2018
tests Add nice delay library I found online. Apr 19, 2018
.gitattributes Marking as a C project. Jun 18, 2015
.gitignore Ignore o and a files. May 27, 2017
.travis.yml Only build on travis. Jan 19, 2018
Makefile Install Makefile into share/ May 5, 2019
README.md Add a link to the AVRDude manual. Jun 23, 2018
ROADMAP.txt Add some information about using the Makefile. Jun 23, 2018
TESTING.md

README.md

AVRM (M is for minimal)

Build Status

This is a minimal and efficient set of functions for the AVR microcontrollers. The code is all either C99, or AVR assembly. The main goal of this project is to write libraries which do not rely on Arduino.

Usage

It's important to me to make building things easy. I've made a Makefile which aims to make compiling and flashing AVRs as easy as possible. It tries to help you out too, for example it will find a /dev/tty.usb* device automatically.

# Compiles the library.
make

# Compiles the library, and installs it on the system.
# NOTE: You may need to run this command with `sudo` if you don't have
# write access to /usr/local.
make install

# Flash each test program to an AVR.
# TODO: Validate output #10.
make test

# Displays size information for a program.
make <program>.size

# Compiles and flashes a program to a connected AVR.
make <program>.flash

# Opens a `screen` session to a connected AVR.
make serial

Getting Started

I'm developing this project on both OS X, and Linux. Windows is simply not on my radar, and I'm uninterested in trying to support it in the build tooling.

Note: I've currently stopped development on macOS. If you're interested in keeping support for that platform I'll happily take PRs.

Installing Dependencies

These instructions are for installing the needed dependencies on Arch Linux or macOS.

sudo pacman -S avr-libc avr-gcc avr-binutils avrdude screen
brew tap osx-cross/avr
brew install avr-binutils avr-gcc avr-libc avrdude

Install AVRM

# Install the library. You may need to run this with `sudo`.
make install

Example Firmware.

# Flash the uart test program. Remember that the baud rate is different for
# various AVRs.
env AVRDUDE_BAUD=57600 make examples/hello_world.flash

# Open a serial connection to the AVR.
make serial

# Remember, `CTRL-a k` to exit screen.

AVRM STD Libraries

AVRM itself is made up of various C99 headers, and their implementations. Each "library" is meant to be somewhat self contained, and provide access to some underlying functionality of the AVR. External peripheral support is typically provided by an external library (see below).

All libraries have their own set of header and source files, with a common name in the /lib directory.

See the ROADMAP.txt for some insight into what's left to implement, and how things are organized. I generally only get around to writing things as I need thing however, so don't hold your breath. If you would like to help, please don't hessitate to open an issue, or jump right in with a PR.

External Libraries

In addition to the built-in libraries included in AVRM, there are a few more libraries I've written for specific chips.

Writing external libraries is easy with AVRM, since the Makefile was designed to be used in an include statement in external libraries as well.

# Describe our custom library.
LIBRARY = some_fun_chip
VERSION = 1.33.7

# Target our installed AVRM.
PREFIX = /usr/local/$(LIBRARY)/$(VERSION)
AVRM = /usr/local/avrm/0.0.5
DEPENDENCIES = $(PREFIX) $(AVRM)

# Include the AVRM Makefile, which will use the variables above to work with
# this library.
include $(AVRM)/Makefile

Projects

The main purpose of this library is to facilitate making cool projects of course! Here's a list of some of mine.

TODO: #4

AVRM = /usr/local/avrm/0.0.5
DS1307 = /usr/local/ds1307/0.0.3
MAX7221 = /usr/local/max7221/0.0.3
DEPENDENCIES = $(DS1307) $(MAX7221) $(AVRM)
LDLIBS = -lds1307 -lmax7221 -lavrm

include $(AVRM)/Makefile

Reference

You can’t perform that action at this time.