vc33 executing same instructions differently
I am facing the following problem.
I have written a code to read the values from an external device .The program I've written for this works fine as an independent project. But I need to flash boot this code and hence I am integrating it with the code to write the flash. I observe the following anomalies.
abc .word 0080A000h
In the R0 register I expect to see the value stored in the address 0x0080A000h.
But in the dis-assembly code what I find is
P.S---abc is loaded into the address location 0x008093C3.
And ofcourse it reads wrong value to R0.How can I rectify this.And why does the above code works fine in an independent project.
Another problem I find is
rd .word 00C00001h
what I mean by this code is, whatever value is stored in R0 write it into the address location 0x00c00001h.This code also works fine in the independent project, but in the integrated code what I view in the dis-assembly is the following
why didn't the instruction LDP @rd,convert to LDI 0c0h,DP in the dis-assembly code.?Help will be greatly appreciated.
I can't explain why your code is executing differently in your
"independent project", but I can tell you that the VC33 is doing exactly
what you are telling it to do, but that is not what you want. See my
> abc .word 0080A000h
> LDI @abc,AR0
> LDI *AR0,R0
> In the R0 register I expect to see the value stored in the
> address 0x0080A000h.
> But in the dis-assembly code what I find is
> LDI @93C3h,AR0
> P.S---abc is loaded into the address location 0x008093C3.
> LDI @abc,AR0
tells the assembler to load the integer at the address of "abc" into
AR0. That is what it does. Of course, "abc" doesn't mean anything to
the DSP, so the linker translates the symbol into an address, 0x8093C3.
Notice that it does not load the 'data page', or the first 8 bits of the
If R0 is not getting the correct value, you should set a breakpoint at
this line and check two things.
1) Is DP = 80? If not, then the DSP will load from the wrong address.
2) Is the value at 0x80A000 what you expect?
> rd .word 00C00001h
> LDP @rd
> STI R0,@rd
> LDI 80h,DP
> STI R0,@9C41h
> why didn't the instruction LDP @rd,convert to LDI 0c0h,DP in
> the dis-assembly code.?
LDP is an assembler shortcut for LDI x,DP. It loads the data page
register with the correct data page for the variable, in this case 0x80.
LDP is not an actual DSP instruction.
> STI R0,@rd
This instruction will store the value of R0 into "rd". If you want to
write to 0xC00001, you should use instead:
LDI @rd, AR0
STI R0, *AR0
I've noticed that your code sometimes loads data pages, and sometimes
doesn't. Is it possible that your "indpendent project" had all data
inside internal memory (0x80), and your full project does not?
Hope this helps!