A few tips for debugging Keil ARM code in Proteus without
the Proteus VSM Keil Driver.
By default Keil produces DWARF3 debug information but Proteus expects DWARF2.
In Keil, Open Options, click the C/C++ tab and type --dwarf2 in the 'Misc Controls' box, now click the Asm tab and type --dwarf2 to 'Misc Controls' box. Click OK and rebuild your file, you now have DWARF2 debug information in the AXF file.
In Proteus you need to load the AXF file into the ARM processor model. Proteus will not show the AXF file as it shows only .hex and .elf files but you can still load it in by typing the name, i.e. bbb.axf (or you could rename bbb.axf to bbb.elf). Don't load the hex file; no debug with hex file
Now in Proteus click the Pause/Run button, if the the source doesn't show then select ARM Source Code in the Debug drop down list. You can now step through your C code, set breakpoints, etc., much more fun
Set a breakpoint on your wait() function, run to the breakpoint and then step over the wait() function; Proteus shows only 8ms elapsed, maybe too fast to animate so change your loop to 100,000, now wait() is 80ms.