CCS 4.2
28335 DSP
Sys Bios 6.31.00.18
Xdctools 3.20.05.76
C++
I am having an intermittent problem where I get strange behavior following some builds. When the problem is seen, adding asm(" NOP"); to any of my 40 C++ modules seems to circumvent the problem.I generally add it to my last compiled module.
The problem only occurs when running from RAM. Flashed code always seems to work.,
Normal Behavior:
I have a C++ Public Member function in which three static objects are declared. I expect them to be constructed once on the first call to the function.
Assembler code is generated to mark the constructor as built and skip construction on subsequent calls.
851 00000042 761F- MOVW DP,#_$P$T1$1
00000043 0000
852 00000044 920B- MOV AL,@_$P$T1$1 ; |226|
853 00000045 ED0F BF $C$L4,NEQ ; |226|
854 ; branchcc occurs ; |226|
855 00000046 56BF- MOVB @_$P$T1$1,#1,UNC ; |226|
00000047 010B
With _$P$T1$1 defined as:
294 0000000b _$P$T1$1: .usect ".ebss",1,1,0
The MOVB changes location 0x10680B from a zero to a one to mark the constructor as called. The flag is tested and construction skipped on subsequent calls.
The debugger can manually update RAM on the page at 0x106800, the specific flag at 0x10680B and also prior to the page.
This works fine for some builds, Others require the addition of a NOP to work.
Strange Behavior:
On some builds, strange behavior is seen. Two of the three static objects are constructed on each call to the member function, rather than just the first.
The problem stems from the MOVB command not modifying the RAM location 0x10680B to mark the constructor as called. The Debugger can also not manually update the RAM location 0x10680B or locations prior to 0x10680B, but it can modify location 0x10680c and above.
I have verified that the XINTF registers are unchanged as well as the PCLKCR3 register.
Attached are two link maps. The one with the NOP works normally, the one without the NOP has strange behavior.
Currently I have to build, then test to see if a NOP is needed, I would like to understand the problem and get a permanent fix that does not involve a rebuild.
Thanks in Advance
Jan
5238.Bullitt_RTC_without_nop.txt