Git Product home page Git Product logo

arduino-mk's Introduction

Build Arduino-based libraries without IDE

This repository contains all required infrastructure to allow you to build your Arduino projects without actually having an IDE nearby.

You are free to forget about *.ino files and Arduino IDE, just setup the toolchain, use main.cpp as a skeleton and you are free to go.

NOTE: only Arduino Nano board were tested (I only have this guy). But the base Makefile should work for any Arduino-based libraries.

AVR Toolchain

In order to be able to compile under GCC and upload firmware files you need:

  • avr-binutils
  • avr-gcc
  • avr-libc
  • avr-dude

Our installation directory will be /usr/local/avr/ and OS is Fedora.

Linux (Fedora) Prerequisites

sudo dnf install gmp gmp-devel mpfr mpfr-devel libmpc libmpc-devel flex

avr-binutils

wget https://ftp.gnu.org/gnu/binutils/binutils-2.29.tar.bz2
tar -xvjf binutils-2.29.tar.bz2
cd binutils-2.29
mkdir build && cd build
../configure --prefix=/usr/local/avr/ --target=avr --disable-nls
make -j8
sudo make install

avr-gcc

wget http://ftpmirror.gnu.org/gcc/gcc-7.1.0/gcc-7.1.0.tar.bz2
tar -xvjf gcc-7.1.0.tar.bz2
cd gcc-7.1.0
mkdir build && cd build
../configure --prefix=/usr/local/avr/ --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2  
make -j8
sudo make install

avr-libc

wget https://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2
tar -xvjf avr-libc-2.0.0.tar.bz2
cd avr-libc-2.0.0
mkdir build && cd build
../configure --prefix=/usr/local/avr/ --build=`../config.guess` --host=avr
make -j8
# Note: because `install` target that runs `/bin/sh` can't find `avr-ranlib` no matter what
# (expanding PATH doesn't work), we do `make install` from root
su -h
cd PATH_TO_AVR_LIBC
sudo make install

avr-dude

# Note: make sure only flex is installed: no bison/bison-devel is installed
wget https://download.savannah.gnu.org/releases/avrdude/avrdude-6.3.tar.gz
gunzip -c avrdude-6.3.tar.gz | tar xf -
cd avrdude-6.3
mkdir build && cd build
../configure --prefix=/usr/local/avr/
make -j8
sudo make install

Using Makefile

You can run make help in order to get all the information about possible targets and avalable options to change.

In general the flow is as follows (assuming you want to compile with Wire default Arduino library and immediately after upload to the board):

  1. Update main.cpp file - put your logic in there.

  2. Compile project

make BAUD=57600 PORT=/dev/ttyS0 BRD=AVR_NANO WITH_WIRE=1 all
  1. Upload the binary to the board
make upload

Feedback and Support

Fell free to send me emails, push requests. Also, create issues for missing things.

arduino-mk's People

Contributors

gahcep avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.