Last active
September 8, 2020 16:12
-
-
Save mulderp/36ca39a9911d54de66ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add headers | |
$ echo ‘#include “Arduino.h”’ > blink.cpp | |
# add sketch | |
$ cat blink.ino >> blink.cpp | |
# add int main() | |
$ cat /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/main.cpp >> 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/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/ -I/Applications/Arduino.app/Contents/Java//hardware/arduino/avr/variants/standard -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