Go Down

Topic: Arduino Simulator (Read 6182 times) previous topic - next topic

stealthtransam

Is there a good debugger or simulator to single step though your arduino code virtually?  I would like to see the information going in and out of each register.  This would be really helpful when debugging code that is close to maxing out the MEGA. 

Graynomad

It's quite unusual to need to look at the working registers when using C (which I assume you are). IO regs are a different matter though, it's very useful to look at them.

Anyway AFAIK there are no simulators for Arduino, there are some for AVR chips in general but I think you'd have to be developing you code with AVR Studio.

There are some monitors, do a search for "monitor" on the forum.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

daitangio

I'd like to suggest an unit-based testing approach.
I have tried some emuletors (like emulino and so on) and I think them are unable to track the whole system in its complexity.
It is better to test the single part of your C code with some unit testing.
If the single part do not work alone, there is no chance you can get them working right together :)

Test driven development is your best friend in embedded stuff, in my own opinion:
http://en.wikipedia.org/wiki/Test-driven_development

Take a look to the Aiko library: https://github.com/geekscape/Aiko it has a lot of unit tests and it is easy to understand.

VBB

You can try VirtualBreadboard, www.virtualbreadboard.com

There is no single step debugging yet, but its on its way very soon.

daitangio


You can try VirtualBreadboard, www.virtualbreadboard.com

There is no single step debugging yet, but its on its way very soon.

I have tried it but I find difficult to include other files and external libreries.
do you have released a new version?

VBB

VirtualBreadboard (www.virtualbreadboard.com ) now supports Single Step Debugging, Breakpoints, step over, stepout, local variable views, stackframe views.

>I have tried it but I find difficult to include other files and external libreries.

yes, true that there is not 100% arduino coverage especially for 3rd party arduino libraries.

You are limited to including "arduino" cpp files, ie not pure C++.

What you can do though is stub-out custom libraries with test return values by adding your own C++ stubbed implementation of the custom 3rd party library you are wanting to use. This is inline with the unit test approach earlier in this thread. Basically you write your own emulation layer of how the 3rd party library will behave. This emulation can be just as stubbed return value or a complete functional emulation.

So the VBB simulations can still be very useful even with unsupported libraries especially with the debugger which just takes Arduino development to another plane of existance IMO :-)




schseema

There are two Arduino simulator apps for iPhone/iPad in Tunes store at

http://itunes.apple.com/us/app/arduino-simulator-learn-diy/id438426863?mt=8

http://itunes.apple.com/us/app/arduino-simulator-full-pack/id447001317?mt=8

Presently the capabilities are limited and are evolving.
Some info on capabilites is at http://schogini.com/tutorials/arduino/#C3

Amazing... same question in different sub forums, by different people. I replied there too, give it a go.

http://arduino.cc/forum/index.php/topic,69931.0.html

Eu não sou o teu criado. Se respondo no fórum é para ajudar todos mediante a minha disponibilidade e disposição. Responder por mensagem pessoal iria contra o propósito do fórum e por isso evito-o.
Se realmente pretendes que eu te ajude por mensagem pessoal, então podemos chegar a um acordo e contrato onde me pagas pela ajuda que eu fornecer e poderás então definir os termos de confidencialidade do meu serviço. De forma contrária toda e qualquer ajuda que eu der tem de ser visível a todos os participantes do fórum (será boa ideia, veres o significado da palavra fórum).
Nota também que eu não me responsabilizo por parvoíces escritas neste espaço pelo que se vais seguir algo dito por mim, entende que o farás por tua conta e risco.

Dito isto, mensagens pessoais só se forem pessoais, ou seja, se já interagimos de alguma forma no passado ou se me pretendes convidar para uma churrascada com cerveja (paga por ti, obviamente).

justjed

There's Simulavr. Also, not arduino, but Atmel AVR sim. I haven't tried it, so I don't know how capable it is. But I'd love to hear from anyone who has.
... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier

Virtronics

#9
Dec 03, 2011, 11:15 am Last Edit: Dec 26, 2011, 04:36 am by Shields_Arduino Reason: 1
We are developing a new Simulator here  http://www.arduino.com.au/Simulator-for-Arduino.html

So far the simulator can single step through simple program's and registers can be viewed by clicking On the variables button. It should be fully operational soon. Any comments or new sketches to run through the simulator would be appreciated.

On the downside, the simulator cannot do for statements, subroutines or second level conditional statements yet. It can do most of the rest and should be ok for simple sketches.
www.virtronics.com.au

sbright33

Please let me know when it can do all the language elements in the reference page.
Which ones are missing now?
I'm interested!
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Virtronics

#11
Feb 09, 2012, 01:35 am Last Edit: Feb 09, 2012, 01:37 am by Shields_Arduino Reason: 1
Hi, thanks for the interest.

At present, all language elements except for the elements below are supported. All the if/for/while/switch/else statements have been tested multiple times and are fairly solid now. The last few versions have been mainly on the language processing since the feedback was that this needed improving. The feedback now is to improve the Uno/Mega pictures and finish all the digital pins and maybe make the Mega picture smaller.

Math
min() max() abs() constrain() map() pow() sqrt() // Note constrain() is implemented
Trigonometry
sin() cos() tan()
Bits and Bytes
lowByte() highByte() bitRead() bitWrite() bitSet() bitClear() bit()

Since this program can consume a lot of time, we have decided to only upgrade when milestones are reached so the next upgrade is planned for late this month of next month depending on interest. Minor fixes will be done where possible. The Free version can be downloaded from here. The Free version is now v0.94C and supports the <time.h> addon library (updated yesterday).
www.virtronics.com.au

arjo129

#12
Feb 09, 2012, 02:12 am Last Edit: Feb 09, 2012, 02:29 am by arjo129 Reason: 1
Any one here familiar with paravirtuallization? Instead of emulating the CPU, one actually writes the functions to function over the existing CPU. This kind of thing is probably more appropriate in something like arduino (They do this with FreeRTOS and other RTOSes). Note: One should include memory limits in such a paravirtuallization mechanism. Any way I'll start something for the arduino (possibly based on fritzing?)

sbright33

What are the limits on the free version?  100 lines?  Delay on loading?
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Virtronics

Yes, the limits on the free version are a 60s timer on opening a sketch (or editing it) and a Code limit of 100 lines. the 100 line limit was chosen since most of the example sketches are under 100 lines.

Apart from that, the free version and Pro version are identical.
www.virtronics.com.au

Go Up