Fri 25 Feb 2011 02:01:26 AM UTC, original submission:
Hi,
I started using simulavr today, and after a successful bootstrap, configure and make, I started to try the simulator for a project I'm working with Arduino code.
I found the trace option extremely useful for debugging interrupt-driven tasks in the AVR uC, but it was not working ok. Some times, when it reached a branch instruction (BRBC and the like), the trace output stopped, and a new trace file was created a few seconds later. However, that new file suffered from the same problems, i.e. it was unexpectedly terminated right before a branch instruction. (I was able to find this comparing the trace output and the compiler's output)
The test suit passed all ok, so I found a problem in the trace code in decoder_trace.cpp. While decoding the BRBC and BRBS instructions, the names are located in arrays using the "bitmask" variable as an index. However, the "bitmask" variable is set by a bit shift in decoder.cpp, and is not a suitable index for the array.
I wrote a macro that fixes that, but I'm sure you might find a better, optimized solution. I'm attaching a diff of the original and modified files.
I hope this helps you in the development of this wonderful tool!
Thanks,
Patricio
PS: I also added an #include in avrerror.cpp to make it compile, and appears on the same diff.
|