# How can I simulate the avr code going to arduino?

**URL:** <https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403>\
**Category:** MicroMod\
**Tags:** avr-atmel\
**Created:** [September 5, 2008, 5:02pm UTC](https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403 "2008-09-05T17:02:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![josheeg](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/josheeg/32/12107_2.png) [@josheeg](https://community.sparkfun.com/u/josheeg)\
**Post date:** [September 5, 2008, 5:02pm UTC](https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403/1 "2008-09-05T17:02:10Z")

</div>

How can I simulate the avr code going to arduino?

it would need the gcc c code going to the c compiler to be saved somewhere…

then the compiler options to create debug enabeled output.

then some windows & linux software to watch the registers change and step through it in a graphical way…

:🙂 please help a tutorial would be great. 😢

---

<div class="post-metadata">

**Author:** ![leon\_heller](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/leon_heller/32/7602_2.png) [@leon\_heller](https://community.sparkfun.com/u/leon_heller)\
**Post date:** [September 5, 2008, 5:10pm UTC](https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403/2 "2008-09-05T17:10:26Z")

</div>

You can use AVR Studio for simulation.

Leon

---

<div class="post-metadata">

**Author:** ![josheeg](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/josheeg/32/12107_2.png) [@josheeg](https://community.sparkfun.com/u/josheeg)\
**Post date:** [September 5, 2008, 5:16pm UTC](https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403/3 "2008-09-05T17:16:55Z")

</div>

I agree I could use avr studio in windows but… I need more information to do it and do it in my ubuntu computer I can compile from source things

---

<div class="post-metadata">

**Author:** ![stevech](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@stevech](https://community.sparkfun.com/u/stevech)\
**Post date:** [September 5, 2008, 8:27pm UTC](https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403/4 "2008-09-05T20:27:32Z")

</div>

> josheeg:  
> I agree I could use avr studio in windows but… I need more information to do it and do it in my ubuntu computer I can compile from source things

You may have to bite the bullet and use Windows XP.

---

<div class="post-metadata">

**Author:** ![leon\_heller](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/leon_heller/32/7602_2.png) [@leon\_heller](https://community.sparkfun.com/u/leon_heller)\
**Post date:** [September 5, 2008, 9:15pm UTC](https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403/5 "2008-09-05T21:15:04Z")

</div>

You could use GDB for simulation under Linux. Studio would be much easier, of course.

Leon

---

<div class="post-metadata">

**Author:** ![josheeg](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/josheeg/32/12107_2.png) [@josheeg](https://community.sparkfun.com/u/josheeg)\
**Post date:** [September 5, 2008, 10:23pm UTC](https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403/6 "2008-09-05T22:23:23Z")

</div>

I got some help searching and simuavr & DDD seam like avrstudio. Now how to get the arduino software IDE to output the c code and compile it with debugging information etc… elf… humm anyone try this before or know of a tutorial?

---

<div class="post-metadata">

**Author:** ![inventore123](https://avatars.discourse-cdn.com/v4/letter/i/b9bd4f/32.png) [@inventore123](https://community.sparkfun.com/u/inventore123)\
**Post date:** [September 9, 2008, 7:09am UTC](https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403/7 "2008-09-09T07:09:15Z")

</div>

gdb and simulavr are the backend of AVR studio. With gdb and simulavr you can do the same things you can do with AVR studio.

Ubuntu has in its repository some ready packages. Look for gcc-avr, binutils-avr, avr-libc, avrdude, gdb-avr, simulavr. Just install them, that’s it 8)

The downside is that you don’t have a GUI, you probably need to simulate your code from the command line.

---

<div class="post-metadata">

**Author:** ![josheeg](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/josheeg/32/12107_2.png) [@josheeg](https://community.sparkfun.com/u/josheeg)\
**Post date:** [September 9, 2008, 12:23pm UTC](https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403/8 "2008-09-09T12:23:29Z")

</div>

ddd is a graphical debugger their is a fue more on it’s links page so your saying all of them would talk to eatchother if I used snaptic package maniger in ubuntu or debian?

---

<div class="post-metadata">

**Author:** ![inventore123](https://avatars.discourse-cdn.com/v4/letter/i/b9bd4f/32.png) [@inventore123](https://community.sparkfun.com/u/inventore123)\
**Post date:** [September 9, 2008, 6:24pm UTC](https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403/9 "2008-09-09T18:24:07Z")

</div>

I only have experience with gcc-avr, binutils-avr, avr-libc and avrdude.

It is surely possible to debug an AVR from the command line by using gdb-avr and simulavr, but I never tried.

About ddd, it is the first time I hear about it.

I suggest you to try installing all those packages, first try debugging with gdb from the command line, and when you get it working, try with ddd.

---

<div class="post-metadata">

**Author:** ![bakketti](https://avatars.discourse-cdn.com/v4/letter/b/b3f665/32.png) [@bakketti](https://community.sparkfun.com/u/bakketti)\
**Post date:** [September 13, 2008, 4:04pm UTC](https://community.sparkfun.com/t/how-can-i-simulate-the-avr-code-going-to-arduino/8403/10 "2008-09-13T16:04:02Z")

</div>

The end of this Linux Journal article has some command line details for using gdb and simulavr. I’ve been meaning to try… Let me know how it works!

[http://www.linuxjournal.com/article/7289](http://www.linuxjournal.com/article/7289)
