Electronic – arduino – Debug an Arduino project on AVR Studio 5 Simulator

arduinoavrsimulation

I'd like to debug my Arduino Atmega 2560 project on the AVR Studio 5 Simulator.
The thing is, as I understand it, Arduino code doesn't run on the Atmega chip by itself, it uses a bootloader – In my case Stk 500 v2.

So, is it possible to run it on the simulator? and if so, how?

Can I load the bootloader hex file to the simulator, then communicate the project hex to it via serial? Or is there an even easier way to do it?

Best Answer

Here is an Arduino Simulator. There's a "Pro" version, which costs $5 now but will later cost $50, as well as a free version with a time-delayed startup but otherwise full functionality.

This isn't a way to debug on the AVR Studio 5 Simulator, but it offers similar functionality within its own IDE:

screenshot from http://www.arduino.com.au/Images/SFA%20Screenshot.jpg

According to the linked website, it includes the following features:

  • Steps through the program line by line. If a new line is selected, the program will continue from that point.
  • Performs digitalWrite, digitalRead and PinMode for pins 0-21
  • analogRead for pins 0-5 and analogWrite for digital pins 0-13
  • Serial output data and input emulation for Serial, Serial1 and SoftSerial
  • Emulates LCD output
  • If,while,for loop functionality
  • Subroutines (multi-level) with arguments
  • View variables in real-time
  • Step Into, Step Over, Step Out of or AutoStep run mode
  • Ability to edit sketch or open in Arduino IDE
  • #include code
  • Undock output emulation Serial and LCD windows
  • Context-sensitive help

See the software datasheet for more information.