Arduino is easy to use. But it may be hard to debug. Here is a simple tutorial of debugging it in Proteus.
Arduino IDE can generate hex and elf files of the sketch in verifying process. But in default they will be built in the temporary folder of the system which is hard to be found. I found a way to change the build path of the Arduino to make it much easier to be found.
First the actual location of the preference file is described in another preference file in “arduino IDE path/lib/preferences.txt”. I think the Arduino just inherits it from processing, so the location described is the Processing’s one. But Arduino’s file is in the similar path.
Then open the right preferences file. And add the build path you want.
Then the build file of the sketch will appear here.
So we can create a Proteus project and add an ATmega328. Set the program file correctly and adjust the clock frequency to 16M.
Finally you can start you project, switch file to your sketch and set breakpoints as you wish to debug the program freely.
Update: BareboneArduino in Proteus from Cooper Maa