Emulator?

How about an Arduino emulator and compiler that could be used within another IDE like, say, Eclipse? The idea would be to allow Arduino sketches to be written and debugged in that environment (with access to first class debugging facilities), and then simply uploaded to the board using the basic IDE. It would make development of non-simple sketches a whole lot easier.

Emulators get really complicated when they have to somehow simulate events external to a circuit.
And to some extent, most debuggers are beyond the comprehension of the target audience. (Every debugger I've seen is essentially similar, and relies a lot on the person behind the screen having a reasonable knowledge of things like variable scope, stack frames, function linkage...)

But yeah, something like this would be nice, even if (especially if?) it managed to implement a simplified subset of debugging and simulation... (good research project for someone's Master's thesis?)

Atmel's simulators and Atmel's debuggers are the closest tools you'll find for this, you'll need to use AVR Studio for this stuff.

Or you can use something with OpenOCD and GNU's GDB and work in Eclipse.

With both these methods, you'll need to ditch Arduino's IDE and compile the core files manually into every project.

Asking for these features to be added into the Arduino IDE is like asking Lego to include a lathe in every box.

Asking for these features to be added into the Arduino IDE is like asking Lego to include a lathe in every box.

He he, great analogy :slight_smile:


Rob

I like the analogy too.

you'll need to ditch Arduino's IDE and compile the core files manually into every project.

Actually, the IDE already includes "-g" (GDB debugging support) in each compile command. In theory, you could start up a gdb on the resulting .elf file and debug away using the gnu simulator (simulavr) ...

I have higher hopes for a sort of source-level simulator (there's at least one out there already: http://hacknmod.com/hack/100-software-based-arduino-simulator/ ), but I don't know how well they'll hold up to the sort of mix of "Arduino library" and "bare metal C manipulation" that is pretty common in Arduino Applications. (digitalWrite(pin, val) is easy to simulate. PORTB |= 1<<4 is less so...

The debugging I was interested in primarily is just to be able to step through the code and see what is going on, view the local variable state and so on.

That can be easilly done using AvrStudio that as a built-in Simulator for all the Avr micro-controllers, but I dont know how to use GDB, but it looks like a powerfull tool.