Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# add headers
$ echo ‘#include “Arduino.h”’ > blink.cpp
# add sketch
$ cat blink.ino >> blink.cpp
# add int main()
$ cat /Applications/ >> blink.cpp
# build binary
$ avr-g++ -x c++ -MMD -c -mmcu=atmega328p -Wall -DF_CPU=16000000L -DARDUINO=160 -DARDUINO_ARCH_AVR -D__PROG_TYPES_COMPAT__ -I/Applications/ -I/Applications/ -Wall -Os blink.cpp
# add arduino core libraries
$ avr-ar rcs libcore.a hooks.o wiring.o wiring_digital.o
# create elf
$ avr-gcc -mmcu=atmega328p -Wl,–gc-sections -Os -o blink.elf blink.o libcore.a -lc -lm
# create hex
$ avr-objcopy -O ihex -R .eeprom blink.elf blink.hex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment