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]
Ahh, at last a tea related hack! http://en.wikipedia.org/wiki/Samovar
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
@BusError: How does it do with simulated external ‘stimulus’ and hardware peripherals such as SPI, etc? I’ve been working with MPSIM for awhile and it’s served its purpose, but seems lacking.
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…
@BusError: Thanks. I’ll definitely check it out. I’ve been meaning to get into AVR work a bit. Nice to see that the dev tools are coming right along.
Can anyone recommend a windows avr simulator?
@Alex
vmware + linux
enjoy
Awesome news!
Thanks for sharing.
@Alex
AVR studio works quite well. It would be nice if they would port it to linux.
vmware+linux is a dumb answer.
Asking for an avr simulator on windows deserves a dumb answer.
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.
AVRStudio works in Wine, and it’s not a big deal to run it in a Virtual Machine with Windows. http://appdb.winehq.org/objectManager.php?sClass=application&iId=402
@Nick: how is VMWare and Linux a dumb answer. It is valid, it may not be the easiest solution, but still valid.
Anyway, there is always simlavr at http://www.nongnu.org/simulavr/ for Linux, too, you might want to have a look.
@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.
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’
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.
@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.
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.
I’d use LATEX. That keeps heads unscratched:))
BusError,
Thanks for commenting out the code to work-around the Ubuntu bugs. I pulled today and simavr built cleanly.
Best regards.
New patches are in, with something called “simduino” that is trying to work, but doesn’t *at this time*. Loads & run the bootloader tho :>
This is gonna rock :>
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 :>
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?
“Use the Source, Luke”
I got one calling chart, and there’s quite a bit of comments in the source itself, but no external documentation otherwise.
An open source arduino emulator that runs on all platforms suported by the mono runtime can be found at:
http://emulare.sourceforge.net
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?:)
Yeah I’ve been trying to get it to compile for about an hour now. anyone know whats wrong with the makefile?
Actually the gitourious repo is always a little bit late compared to the github tree; do check it out, that compile error is gone for a while!
https://github.com/buserror-uk/simavr
BTW, v1.2 has been tagged on github. Quite a few new features, new cores, bug fixes etc.