2
\$\begingroup\$

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?

asked Jan 24, 2012 at 14:17
\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

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.

Kevin Vermeer
20.2k9 gold badges60 silver badges103 bronze badges
answered Jan 24, 2012 at 20:06
\$\endgroup\$
4
  • \$\begingroup\$ That's a pretty neat product! It looks like you're the author, or at least affiliated - Is that correct? If so, you should take a look at our rules for self-promotion, or consider buying advertisements: See stackexchange.com/about/contact \$\endgroup\$ Commented Jan 24, 2012 at 20:25
  • \$\begingroup\$ I sure will give it a try, but it looks like it's intended on simulating the Uno board and not the Mega 2560. Am I right? \$\endgroup\$ Commented Jan 24, 2012 at 21:16
  • \$\begingroup\$ Please note the new webpage (after the arduino.com.au domain was transferred to the Arduino team) : virtronics.com.au/Simulator-for-Arduino.html The cost is now 11ドル.99 and will increase to 14ドル.99 later this year but there is a free version with an 8 day trial period. \$\endgroup\$ Commented May 17, 2013 at 3:42
  • \$\begingroup\$ Seems to be Windows only. Which is a shame :/ \$\endgroup\$ Commented Aug 11, 2015 at 7:30
1
\$\begingroup\$

The bootloader is a separate program that runs out of a separate memory space from your main program. You can most likely safely ignore it for purposes of simulation. When you compile your sketch in the Arduino environment you can get it to show you the temporary folder where your compilation artifacts are stored.

In pre-1.0 versions of the IDE you did this by holding down the shift-key when you click the compile button. In 1.0 there is a check box under File => Preferences to "Show verbose output during: compilation" that has the same affect.

I haven't used AVR Studio 5 Simulator, but assuming it takes a HEX file as an input, you should be able to get it from that directory.

answered Jan 24, 2012 at 15:13
\$\endgroup\$
1
  • \$\begingroup\$ Hi vicatcu, thanks for your answer. I know where my .hex (and .elf) files are, but I haven't find a way to use the simulator for code complied outside of AVR Studio - and can't get my code to compile properly in AVR Studio. (See my other question) \$\endgroup\$ Commented Jan 24, 2012 at 15:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.