Write, compile and upload to Arduboy without IDE



This is my quick and dirty guide to get up and running fast with single .ino file. I think this is also useful to anyone, who hasn’t got their Arduboy yet. You still probably need to have the Arduino IDE installed but with these steps you can bypass it.

  1. Compiling & uploading to Arduboy device: install Arduino Command Line Interface by following the instructions closely. Download here. Make sure the example in the README compiles and you’re able to upload binary to your Arduboy.

  2. Emulation: to run the compiled code in emulator instead of uploading it to the device each time, use simavr-arduboy. Follow the build instructions closely and you should end up with sim_arduboy binary to which you pass *.hex file generated by Arduino CLI (step 1).

  3. Automation: Every time you save your file(s), compile the code and execute/re-run the emulator with the fresh binary. For this, I hacked a little Makefile:

    emulation: HelloWorld.ino
        pgrep sim_arduboy | xargs kill -9
        arduino-cli compile -b  arduino:avr:leonardo /Users/[username]/Documents/Arduino/HelloWorld
        sim_arduboy ./HelloWorld.arduino.avr.leonardo.hex &

    Then I run this Makefile command every time my source file changes, on MacOS I use this: fswatch -o HelloWorld.ino | xargs -n1 -I{} make emulation.

So could someone navigate me to some resources? I’d like to write the code in my own editor, compile the code on command line and hopefully be able to upload the binary to arduboy.

So far I’ve been trying the first step to only compile single source file.

I know I can probably use gcc to compile it, however I don’t know how to link required libraries correctly.
I downloaded libraries from this repo and put it in the same folder as my .cpp file:

#include "/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/EEPROM/src/EEPROM.h"
#include "/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SPI/SPI.h"
#include "../Arduboy/src/Arduboy.h"

Arduboy arduboy;

void setup() {

void loop() {
  if (!(arduboy.nextFrame()))


  arduboy.setCursor(4, 9);

  arduboy.print(F("Hello, Codebender!"));

I run gcc ./helloworld.cpp -o ex.
This won’t compile because the header EEPROM.h references another header:

/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/EEPROM/src/EEPROM.h:25:10: fatal error:
      'avr/eeprom.h' file not found
#include <avr/eeprom.h>
1 error generated.

Yeah obviously you can tell I’m not really experienced with C based languages :slight_smile:

(Scott) #2

You may be able to make use of the Arduino Command Line Interface (CLI).

(Simon) #3

Out of curiosity, when you say ‘write the code in my own editor’ do you mean something you wrote yourself or anything better than the Arduino IDE? There are other options, including VSCode and PlatformIO that can compile Arduino code from within their IDE - albeit using the Arduino code below it.

I personally use VSCode and think its pretty good and its the right price! (Free)

1 Like
(Pharap) #4

Is this strictly necessary?

If so PlatformIO and compiling manually with GCC are probably your only options short of writing your own makefile.

I’m not aware of anyone who has bothered to make a makefile for Arduboy compiling because it’s quite a bit of hassle.

Even then, you’d need to incorporate Arduino’s weird .ino file processor into the process to be able to compile other games.

Personally I use either VSCode with the Arduino plugin (as @filmote mentioned),
or I just edit code in Notepad++ and compile with the Arduino IDE.

That repo is functionally obsolete.
The Arduboy library is no longer maintained.
Arduboy2 is what most people use instead.

(Blake) #5

I have done this recently.

I use a Makefile, some stub code and submodules.

There is an upload script that typically requires the physical reset button be used.


Will try that on saturday, thanks!


Nope not my editor, I’m just used to VIM right in terminal that’s all. I don’t like IDE that much, VSCode I actually used and liked a lot (but recently switched back to VIM again).

(Simon) #8

Right …I must admit I am always suspicious of people who like VI. Sorry :slight_smile:

1 Like
(Scott) #9

If the Arduino CLI doesn’t work out for you:
Do you run VIM in a terminal window on some sort of GUI desktop?
If so, do you mind installing and running the Arduino IDE just for compiling and uploading?
If so, you can easily use any external editor for writing code, and then compile and upload from the Arduino IDE.

  • In the IDE, open Preferences:
    File > Preferences
    (or Ctrl+Comma)
  • Select:
    ☑ Use external editor
  • Click on OK at the bottom right

Now, when you open your sketch in the IDE, the code will be greyed out and read only. If you edit and save your code using an external editor, the changes will be automatically updated in the IDE when you switch to it. You can then use the IDE to compile and/or upload.

(Scott) #10

Actually, someone has made a Makefile for Arduino in general


Oh that’s fine, I get that from people sometimes :slight_smile:


This seems like a no hassle, quick solution too! I might try that out (I use VIM in terminal though but I bet it’s possible to do this via graphical UI GVIM).


So I ended up with arduino-cli. It is pretty straightforward and I managed to compile and upload the example!

1 Like

Haha even better. I created a Makefile in the folder of my project:

program: HelloWorld.ino
	arduino-cli compile -b arduino:avr:leonardo /Users/[username]/Documents/Arduino/HelloWorld
	arduino-cli upload -p /dev/cu.usbmodem1411 -b arduino:avr:leonardo ~/Documents/Arduino/HelloWorld

And on MacOS there’s a little program for watching if certain file has changed so I run make command every time I change my source file:

fswatch -o HelloWorld.ino | xargs -n1 -I{} make (had to Google that one)

So with my Arduboy connected, I make changes to my code and it’s directly uploaded to the device. I feel so hacker-y :slight_smile:

1 Like
(Pharap) #15

Be careful with that.
If you upload too often you’ll burn out the progmem/flash memory’s write limit faster.

(Kevin) #16

So long as when you save the document you intend to flash it. I wouldn’t worry about running out of reflash cycles, you should be good for over a million flashes. Which if you were continously developing 24/7 would only last you a couple years so, should be ok!

(Pharap) #17

The datasheet only guarantees 10,000 flash writes.

Writes per day Days of guarantee Years of Guarantee
1 10000 27.39726
2 5000 13.69863
3 3333.333 9.13242
4 2500 6.849315
5 2000 5.479452
25 400 1.09589
26 384.6154 1.053741
27 370.3704 1.014713
28 357.1429 0.9784735
29 344.8276 0.9447331
30 333.3333 0.913242
31 322.5807 0.8837826
Full table
Writes per day Days of guarantee Years of Guarantee
1 10000 27.39726
2 5000 13.69863
3 3333.333 9.13242
4 2500 6.849315
5 2000 5.479452
6 1666.667 4.56621
7 1428.571 3.913894
8 1250 3.424658
9 1111.111 3.04414
10 1000 2.739726
11 909.0909 2.49066
12 833.3333 2.283105
13 769.2308 2.107481
14 714.2857 1.956947
15 666.6667 1.826484
16 625 1.712329
17 588.2353 1.611603
18 555.5555 1.52207
19 526.3158 1.441961
20 500 1.369863
21 476.1905 1.304631
22 454.5454 1.24533
23 434.7826 1.191185
24 416.6667 1.141552
25 400 1.09589
26 384.6154 1.053741
27 370.3704 1.014713
28 357.1429 0.9784735
29 344.8276 0.9447331
30 333.3333 0.913242
31 322.5807 0.8837826

Assuming the datasheet is accurate, that would mean that if you were doing 28 flashes per day the flash would pass the guarantee within 1 year.
(Obviously it’s likely to last longer than that, but after that point it’s anyone’s guess.)

This usually isn’t too much of a problem,
but if you’ve got a tool set up to flash the Arduboy every time a code file is edited then I don’t think 28 flashes per day (or even more) is an unrealistic figure.

(Kevin) #18

Thanks for the info!

The data sheet says lots of things! We don’t live in a data sheet however:

Just to make it clear, if you run out of write cycles (doing normal things, and not destructively testing them) on your Arduboy, let me know at contact.arduboy.com because you’ll be the first!

I’ve only heard a few stories of people wearing out their Arduinos, and in those circumstances they were actually being used every day being re flashed dozens of times per day for years on end. Being used in classrooms and labs.

(Michael Gollnick) #19

Have a look at my repo here. I am also working on command line with vim and platformio.

Pretty simple to install and use. No GUI needed. You can also upload your sketch to the Arduboy with it.

platformio run --target upload
(Pharap) #20

I crunched the numbers for their “2 hours each weekday and 8 hours over the weekend on their Arduino, flashing it once every 5 minutes” scenario,
and it comes out at 32.0512 weeks, (or roughly 224.3589 days),
which is just ~2/3 of a year (there’s around 52.17857 weeks in a year).


2 * 60 / 5 = 24 (flashes per weekday)
8 * 60 / 5 = 96 (flashes per weekend)
(24 * 5) + (96 * 2) = 312 (flashes per week)
10,000 / 312 = 32.051282051282051282051282051282 (flashes until ‘death’)

I don’t think the 8 hours per week figure is realistic for game development.
For hardware development maybe, but not game development.

Either way, flashing the chip every time a code file is saved would tally up to more than that,
which is my main point here.

As for the ‘dangerous prototypes’ project,
the article only specifies EEPROM figures, not flash figures,
and EEPROM has 10 times the number of writes anyway.

This is my point.

Code files are edited potentially 25-100 times per day depending on the individual,
so flashing every time a code file is more than just average use.

I’m not saying average users have to worry about flash usage,
I’m saying that flashing every time a code file is saved is a cause for concern.