I am working on an entry for the Luminary Micro Stellaris design contest. The contest rules require you to use the the Keil tools that come with the LM eval board. This limits the entries to C programs. I started with a Forth program and converted it to C. This went without too much trouble and the conversion was fairly easy. I did find it a bit harder to debug under C using a standard debugger, but there were not many issues that could not be resolved without too much pain. Mainly it was a lot easier in Forth to test each word or routine separately rather than as part of a whole. The C debug tools just don't make it easy to test routines separately.
The real trouble began when I started writing new code in C that was somewhat real time. As I used the debugger it became apparent that this was not going to be so easy. Since the routines had to be tested as part of the whole, I had to let the interrupts run, so I was never too sure of the state of the environment while I was debugging. Still, I didn't have any major problems until I noticed something odd.
I was using the "Locals" watch window for most of the variables since this was automatic. But once in awhile some of the local variables would seem to take on absurd values. I could not find anything in my code that was doing it. I dug into the disassembly listing and found that local variables and the parameter passing was being done in registers rather than on the stack. So when another routine was called, the variables were moved to other registers to free up the standard parameter regs. At this point the debugger would lose track and report the new value in the old register as the variable that had been moved to the new register. I could use a standard watch window to show the correct value, but this was a PITA since every routine had its own copy of this variable and I would have to type it in again when exiting or entering another routine. This is a pretty major bug in the Keil tools in my opinion. I don't know if this is limited to the ARM or the CM3 or if it is common to their combined ARM and Keil tool set.
I also found that in at least one case a local variable could not be monitored at all! It did not show up in the "Locals" window and I could not add it to a regular watch window. This was not possible to work around without changing the code and made a tricky bug very, very hard to find.
All in all I am not a fan of the Keil tools at this point and I don't think I am very happy with embedded C development. I have done tons of embedded development in the past and I never realized how limited the tools were. I always thought of the problem as being an unavoidable part of the development process. Factoring code to small routines and testing them interactively is so much easier to debug and in Forth is so much easier to write.
Am I the only one to have trouble with the Keil tools? Am I working with an old release? This is the version directly off the eval board CD.
The contest rules say the submission has to be done using the Keil tools. But that does not mean I have to use the tools while I am debugging. I have access to the IAR tools, but I don't know that the eval board is supported with these tools. Anyone know if there is a board support library for the LM3S811 eval board under IAR?