The Quest for an AVR simulator

Do you really need a dragon ?

54_6Just a word on words…

In this post, I will often use the term simulator, as does most litterature on this topic, where the term emulator, In My Humble Opinion, should rather be used. It is because we are at a border, between pure software emulation, and electrical simulation of a board. To pass through this border, the boolean state of some bit should become a modelized electrical state of a pin.

But, AVR simulator are mainly “simulating” boolean states, using a discrete time model…

On this point, I apologize in advance for any lexical inconvience.

The concerns

When I started my try to implement a thread scheduler for 8bit AVR, and for another project after that, it quickly became an essential urge to setup a step-by-step debugger, and rather using an emulation tool :

Step-by-step Debugger :

  1. to grant fine control on program execution flow, dumping device state (memory and registers),

Emulator :

  1. to avoid flashing many times physical device with buggy-work-in-progess code,
  2. spare money of buying an AVR dragon (which allows OnChip Debugging of a physical device using avr-gdb),
  3. Use a computer, nothing more needed (AVR thread scheduling, at this step, is still at a purely theorical stage — no need to imply physical devices for now).


Browsing for it on the Web

Here is a merely complete state of the art on this topic. Ask on freenode’s #avr, if you want, I or any guy there should answer the same…

  1. Atmel Studio : it’s a proprietary tool, published by Atmel. It includes a simulator, and a debugger. The customised GUI allows to display any register or memory map, where each modified byte is highlighted. Sadly, it is runs only under windows, since build on Visual Studio. A shame, knowing that underling compiling toolchain is GCC anyway…
  2. SimulAVR : an OSS tool written in C++, and packaged as a simulator executable, but providing a really awesome framework.
    • Tcl and Python bindings are available.
    • Repository is available on github (I appreciated to be able to fork it in one click to start to integrate one or two modifs/fixes in my own repo),
    • It is designed to be interfaced with avr-gdb. ;
    • It allows dumping trace of the execution (as a sequencial log of instruction), but also VCD files usable with gtkwave,
    • For the record, Arch user, PKGBUILD is not in the AUR, but easily foundable on the web.
  3. simavr : Another awesome OSS project, written in C. It provides mainly the same features that simulAVR, but :

    • It comes with a collection of directives defined as macro to specify simulation parameters directly into an ELF custom section,
    • It is written in C. The code is awesomly clean,
    • It is integrated in Arch Linux as a Community package.
  4. AVRora : Crossed this one during my quest, but I don’t like this project : it is stalled since 12/2008, it seems to be wrtten in Java. But as existing, it is worth to quoted, and maybe to play with a bit.





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s