Hello,
I have a little problem with C6727 DSP. I compiled a small bare metal application and strange things started to happen. Finally I managed to isolate the problem, but I don't really understand the reason for that.
First of all, the very small code segment which does not work properly (or in other words, I just have something wrong...)
---------------------------------------------------------------------------------------------
10001000 01880C2A MVK.S2 0x1018,B3
10001004 0188006A MVKH.S2 0x10000000,B3
10001008 000C0362 B.S2 B3
1000100C 00008000 NOP 5
10001010 00000000 NOP
10001014 00000000 NOP
10001018 01890C2B MVK.S2 0x1218,B3
1000101C 04A80FD9 || OR.L1 0,A10,A9
10001020 08200028 || MVK.S1 0x4000,A16
10001024 00000091 B.S1 0x10001024 (PC+4 = 0x10001024)
10001028 04A00274 || STW.D1T1 A9,*+A8[0]
1000102C 08200274 STW.D1T1 A16,*+A8[0]
10001030 00006000 NOP 4
10001034 00000000 NOP
10001038 00000000 NOP
1000103C 00000000 NOP
10001040 00000000 NOP
10001044 00000000 NOP
---------------------------------------------------------------------------------------------
I set the PC in the code composer studio connected to the HW manually to 10001000. The PC branches to 10001018 as expected. But the next instruction does not execute correctly. PC branches back to 10001000 in some reason...
Second piece of code works as expected. I just moved the branch target a bit.
---------------------------------------------------------------------------------------------
10001000 0188102A MVK.S2 0x1020,B3
10001004 0188006A MVKH.S2 0x10000000,B3
10001008 000C0362 B.S2 B3
1000100C 00008000 NOP 5
10001010 00000000 NOP
10001014 00000000 NOP
10001018 00000000 NOP
1000101C 00000000 NOP
10001020 01890C2B MVK.S2 0x1218,B3
10001024 04A80FD9 || OR.L1 0,A10,A9
10001028 08200028 || MVK.S1 0x4000,A16
1000102C 00000191 B.S1 0x1000102C (PC+12 = 0x1000102c)
10001030 04A00274 || STW.D1T1 A9,*+A8[0]
10001034 08200274 STW.D1T1 A16,*+A8[0]
10001038 00006000 NOP 4
1000103C 00000000 NOP
10001040 00000000 NOP
---------------------------------------------------------------------------------------------
Here the first branch is taken to address 10001020 and everything seems to be ok. Next parallel instruction is executed correctly and PC carries on to the loop that follows.
Im very new to TI DSP and there might be something very basic (e.g. processor flags)... I run into that problem as compiling the C with gcc. Maybe its related to branch alignment?
Any help or hints would be greatly appreciated!
Thank you,
Madis