This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

28335 Alignment Problem ??

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

0488.Bullitt_RTC_with_nop.txt

 

  • Jan Stefan said:
    The Debugger can also not manually update the RAM location 0x10680B or locations prior to 0x10680B, but it can modify location 0x10680c and above.

    Jan,

    The fact that the debugger also can not update these locations makes me think there is an issue with the hardware connections on the XINTF.   It is a strange address to see the issue, though. 

    Regards,

    Lori

  • Thanks for responding!

    The problem seems gone for the time being, but I have faith it will come back.

    I ASSUMED the NOP corrected a problem rather than hiding it when the symptom changed.

    I also ASSUMED the FLASH configuration works because the symptom went away.

    Both assumptions could be suspect. 

    I may try to configure my RAM map to place code and data into different memory blocks in RAM. That way I can put code after data and  adding a NOP to the code should not move data alignment.   That may help isolate the cause. Currently the .text section sits ahead of the data in the external RAM.

    That test is awkward as I would need to divide my External RAM into 2 blocks(RTSC config) and that could impact the production FLASH configuration.

    I will post again if anything useful is discovered.

    Jan