
Technical discussions about the TI C55x DSPs (including the c5501, c5502, c5503, c5507, c5509, c5510 and OMAP5910).
This is in reference to the last few posts ("silly compiler question" and
"variables not working"). First off I would like to thank those that chimed in with
advice and things to check. I think I am very close to solving this problem.
Upon first attempt at writing my own C code for the DSK5510 (see post "variables not
working" for source code) I noticed that I could not always use the following command
within CCS (as demonstrated in various examples and tutorials that I had followed previously).
Debug -> Go Main
I was not (always) able to use the command "Debug -> Go Main" with my program
because the simulator would vector off into some unknown part of memory forever getting lost.
So, in solving this particular issue I brought up the CPU registers and directly set the PC
register to the beginning of the code. Of course, you must know where in memory your code is
located so I used the following command to see exactly where my code appeared to be located.
View –> Mixed Source/ASM
(typically, my code would be located at 0x000100 – but not always)
After setting the PC register I'd see the familiar yellow arrow to the left allowing me to
single step through the code making me believe that everything was working correctly.
However this was not the case, because my FOR loop did not function when I ran the program
(pressing run or F5) and upon troubleshooting (single stepping with the watch window) I could
see an issue with the variables as described in previous posts.
How did I solve this?
Once the PC register is located somewhere within my program (by manually positioning the PC
register within a memory space occupied by my program) the "Debug -> Go Main"
worked correctly. Once I used "Debug -> Go Main" then the variables functioned as
one would expect them to and the FOR loop worked exactly as predicted. Problem solved!
So, I suppose this isn't unlike the inexperienced home mechanic that sets out to repair his or
her car and during the course of doing so creates additional problems. Because "Debug
-> Go Main" did not work for me I found a work around, but this caused an unusual
problem (well, I guess it is unusual – I wouldn't know).
For now, I can get my variables to function properly, but in a rather cumbersome way since I
must first manually set the PC register and then make a point of using "Debug -> Go
Main."
I suppose the next question is this: How to I write a program that allows me to use
"Debug -> Go Main" without causing the simulator to crash?
> View -> Mixed Source/ASM > > (typically, my code would be located at 0x000100 - but not always) > Check that no memory is ever located below 0x0000C0. > > I suppose the next question is this: How to I write a program that allows > me to use "Debug -> Go Main" without causing the simulator to crash? > I think it would be a good idea to check your link output map. Any memory sections allocated below 0x0000C0 will clash with the memory-mapped register section. Writing to memory allocated in this region will overwrite register contents - including PC. This sounds like a probable cause for your issues.