Emulation with simavr-arduboy

sim-arduboy (the repository formerly known as simavr-arduboy) is an Arduboy simulator based on simavr. See the project’s README for OSX build instructions (instructions for more OSes will be added). Please use GitHub’s issue tracking system to report issues.

Windows 10 instructions are in this post.


Awesome work! A couple things though: found that it doesn’t handle delay() correctly. Instead, it speeds through it as seen in the level start transition animation:


Also, the emulator will now hang if a game tries to use while(true){delay(1000);} to crash itself.

Really liking it though! This has been helping a lot, thank you!

This is a known issue and I’ll try to fix it soon…

1 Like

Don’t sweat it, those are pretty minor issues for the way I’m using this, at least. It’s been immensely helpful as I’ve been using it as a near-live preview for implementing game UI, and instantly testing the behavior of other game data. In the future, I’d like to be able to use this as part of automated testing.

I will document the steps for Windows 10, but basically is getting the Bash Terminal from the Windows Store https://www.microsoft.com/store/apps/9NBLGGH4MSV6 and an xwindow server (and checking google for solving the compilation errors… like a normal linux user)

1 Like

In fairness that’s a bad way for a game to ‘crash’ itself, that’s what exit(0) is for.

I wasn’t aware that worked on an Arduino. I figured it would be better to put it in a known state, since there’s no OS to fall back to! But thanks, I’m still working on improving my debugging tools. Although, after looking it up, it seems like exit(0) just puts it in an infinite loop anyway. :smiley:

It also stops interrupts, and I’m not sure if it’s the same for all devices.
I had a feeling on certain devices it had a means of handling things diffferently, I can’t find exit in the source code though.

It might be possible to tweak the simulator to recognise RJMP -2 and halt accordingly.

OK, here are the Windows 10 instructions:

  1. Install Ubuntu Bash from the Windows Store (https://www.microsoft.com/store/apps/9NBLGGH4MSV6). Google the instructions, I think you have to enable developer mode
  2. Install an X-server for Windows, for example Xming (free) http://www.straightrunning.com/XmingNotes/ or Xmanager (paid) https://www.netsarang.com/products/xmg_overview.html
  3. Checkout simavr-arduboy as instructed above in Linux/Mac instructions (you can use Github desktop):

The following steps are inside the ubuntu bash. Go to simavr directory and open a bash terminal from there:

  1. Make the terminal use the X-server you installed with sudo nano $HOME/.bashrc and add export DISPLAY=:0 at the end. Exit and save with Ctrl+X, Y. Exit and reopen the terminal.
  2. Install dependencies: sudo apt-get install pkg-config freeglut3-dev mesa-utils make libmpc3 gcc gcc-avr avr-libc
  3. make
  4. Run it from the examples/board_arduboy directory with ./obj-x86_64-linux-gnu/sim_arduboy.elf path_to_hex
  5. A window will pop with the game

The Ubuntu terminal works in a similar fashion to the old cmd or powershell, so it is possible to send commands as the argument, for example bash -c "some linux command" so the integration could be seamless:

But that is for another moment.

I managed to get it going, but I had issues with the instructions as they are detailed above. I wasinstalling on a Macintosh with Sierra 10.12.6

Produced the error below:

Error: osx-cross/avr/simavr is a head-only formula
Install with brew install --HEAD osx-cross/avr/simavr

I simply installed it using the suggested command.

Produced the error below:

Cloning into ‘simavr-arduboy’…
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I changed the command to:

git clone https://github.com/dxxb/simavr-arduboy.git

… and it worked properly.

Thank you @filmote and @eried! I have updated instructions for OSX and added a link to the post with instructions for Windows 10.

This is really good. I would love to see this actively developed.

Is there any way to display the serial output?

This is really good. I would love to see this actively developed.

Thanks! But it IS being actively developed :face_with_raised_eyebrow:

Is there any way to display the serial output?

Not yet but it is on the todo list. I haven’t tried yet but I believe simavr should have most (if not all) of the bis and pieces to emulate the serial port.

:astonished: Sorry I meant contributed to (by others) !

1 Like

:smile: I’d love to see that too. People are welcome to open pull requests on GitHub to contribute code. For those who want to contribute, please discuss what they intend to do first mostly to avoid duplication of effort.


I’d love to help get it to the point where it could run on windows natively without having to do all the ‘install ubuntu and x-window server’ shenanigans.

It’s using SDL at its core, so I don’t see how it came from using a cross-platform library to not being able to run on Windows.
(I know that’s not your fault, it’s the actions of the person (or people) who wrote the original that you forked.)

Sadly doing so isn’t high on my list of priorities at the minute, I’ve got several other projects to tie-up first before I could actively contribute.

@filmote For what it’s worth, I understood what you meant by ‘actively developed’.

I would love to have a C# emulator :stuck_out_tongue:

1 Like


I pushed a new update. Some fixes to simavr and some improvements to the arduboy board. I looked into serial I/O and I saw there is a set of patches to support usbip being evaluated right now. The issue with usbip is that it’s most likely going to work on linux only.

Are you referring to simavr? Not sure if it used SDL in the past but it doesn’t now. It’s strange though for the core of a simulator to rely on SDL. What I noticed is that the code assumes GNU compiler extensions so there is very little hope to make it compile with Visual Studio.

Speaking of SDL, I want to swap the current GLUT based implementation of window handling with SDL.

Me too, it looks like simavr itself doesn’t depend on many libraries. Using cygwin, SDL libraries and an Arduino IDE installation as shortcut for installing avr-libc and avr-gcc should be enough to compile on a windows system.

Next I’ll look into enabling support for gdb debugging of the .hex image being run.

Do we use the same git command to retrieve this one?

Do we use the same git command to retrieve this one?

From the root of the git repo run: git fetch origin and then git reset --hard origin/arduboy
This will force your lock repository checkout directory to match the remote branch arduboy.

1 Like