New AVR Simulator For Linux

simavr is a software simulator for the AVR line of microcontrollers. You might be asking why anyone would write this sort of thing considering the simulator provided with AVR Studio is a wonderful tool? Well, a lot of folks don’t run Windows and don’t wish to use that development environment even if Wine or Virtualbox could make it happen.

We haven’t tried it out ourselves yet. There is a discussion thread going that reports some positive results of using simavr with GDB and AVR Eclipse. It’s a new package, but so far it seems to have put its best foot forward. Currently there is support for ATtiny25/45/85, ATtiny13, ATmega48/88/168, andATmega164/324/644 chips. Several of the common on-chip peripherals are already supported with the others on the way.

Have you tried it out? Let us know what you think in the comments.

[IC Photo]

29 thoughts on “New AVR Simulator For Linux

  1. Well, making hackaday is quite unexpected! I hope a few dev will hook along and start adding stuff to simavr too!
    simavr is *this* close to be able to emulate a full Arduino for example; now would’nt THAT be cool ? :>

    You can follow me on twitter : @buserror

  2. It uses “IRQ”, like qemu. IRQ are a one way messaging system, where you can attach your hook, or even chain another IRQ.

    So for example, SPI declares an IRQ “OUT” and “IN”.. in Master mode it sends a byte to “OUT” and if/when receiving one on “IN” puts in into SPDR and raise the interupt for the AVR code to get it…

    So writing a SPI slave is a 2 small C function job, without having to know any of the internals of the emulator.

    All signals that could be probed, or traced have an IRQ attached to them… you can also “trace” IRQs in waveform files for viewing in gtkwave, for example…

  3. Actually, I personally can’t stand AVR Studio.It’s horribly slow, the interface is everything but intuitive or usable, breakponting is a pain and you can’t dump memory.
    Or at least I can’t find these things – which just proves point #2.

  4. @Ragnar, Alex, Anonymous, Nick
    VMWare + Linux: Valid? Sure. Slow and roundabout? Probably. Is Cygwin a better answer? That depends upon whether or not the project is open source or not, which the article neglects the mention.

  5. Anyone getting these on Ubuntu 9.10 ?

    make[1]: Entering directory `/home/tom/simavr/simavr’
    In file included from cores/sim_mega48.c:32:
    cores/sim_megax8.h:66: error: ‘LFUSE_DEFAULT’ undeclared here (not in a function)
    cores/sim_megax8.h:66: error: ‘HFUSE_DEFAULT’ undeclared here (not in a function)
    cores/sim_megax8.h:66: error: ‘EFUSE_DEFAULT’ undeclared here (not in a function)
    make[1]: *** [obj/sim_mega48.o] Error 1
    make[1]: Leaving directory `/home/tom/simavr/simavr’

  6. stupid ubuntu uses an old, unknown version of avr-libc, and an old avr-gcc.
    I don’t use ubuntu, if someone wants to make it compile and send me a patch, they are most welcome.

    /me who got rid of *.*ubuntu and went back to a working debian.

  7. @Ragnar: It’s a dumb answer because you didn’t answer his question. He asked for a Windows AVR simulator. The correct answer is to point out AVR Studio, which he probably somehow missed.

    Your answer is more like… “Hey guys, is there any office software for Linux?”

    “Oh yeah man, totally. Download VirtualBox and install XP in it, then install a pirated copy of Microsoft Office. That’s the best way to edit doc files, man.”

    Quite frankly, it leaves me scratching my head.

  8. Actually, I will have to try MS Office under Wine, since OpenOffice (various versions) always crashes on a scientific book with lots of pictures I made, when I try to save it to .doc instead of .odt. That left me scratching my head.

  9. simavr now supports running the Arduino bootloader, and can be programmed via avrdude. So it was the “hard part” of making it interract with the Arduino IDE.

    Unfortunately Arduino developers are not interested, I didn’t manage to rouse any interest so I shelved that part of the project.

    simavr goes on, with a bunch of new changes :>

  10. Hi! i’ve worked with avr-gcc and Eclipse almost 6 month ago…i’m very interested in this project and, if possible, its develop. Can I have further documentation explaining its structure and functioning?

  11. Well, it would be cool to try the thing… unfortunately it gives
    make[1]: Entering directory `/media/ZAY/ECLIPSE_PROJECTS/simavr-simavr/tests’
    AVR-CC atmega48_disabled_timer.c
    209 0 0 209 d1 atmega48_disabled_timer.axf
    AVR-CC atmega48_enabled_timer.c
    215 0 0 215 d7 atmega48_enabled_timer.axf
    AVR-CC atmega48_watchdog_test.c
    385 82 6 473 1d9 atmega48_watchdog_test.axf
    AVR-CC atmega644_adc_test.c
    2154 160 22 2336 920 atmega644_adc_test.axf
    AVR-CC atmega88_coroutine.c
    atmega88_coroutine.c: In function ‘_set_stack’:
    atmega88_coroutine.c:61: error: expected string literal before ‘)’ token
    make[1]: *** [atmega88_coroutine.axf] Error 1
    make[1]: Leaving directory `/media/ZAY/ECLIPSE_PROJECTS/simavr-simavr/tests’
    make: *** [build-tests] Error 2
    Any clue… maybe? please?:)

Leave a Reply to BusErrorCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.