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.

C2000/TMS320F28069: Writing to wrong memory location

Other Parts Discussed in Thread: TMS320F28069

We have an issue with the code generation tools for Piccolo 28069 (TI v6.0.1).  The issue shows up when using compiler optimization 2 or larger. I generated a short program to reproduce the issue. From the macro generated code, I removed statements and operations as long as the issue shows. Please contact me for a solution or workaround.

Thanks

Andreas

 

Compiler & Platform:

  •  C2000 C/C++ CODE GENERATION TOOLS 6.0.1
  • Piccolo TMS320F28069

------------------------------------------------------------------------------------

Test program:

#include <string.h>

typedef struct
{
    unsigned short hdr;
    unsigned short payload[2];
} pkt_t ;

void main(void)
{
    pkt_t pkt;
    memset(&pkt,0,sizeof(pkt_t));
    __byte((int*)pkt.payload, 0) = (0x0 & __byte((int*)pkt.payload, 0));
}

------------------------------------------------------------------------------------------------------

Output:

_main:
        ADDB      SP,#4                 ; [CPU_U]
        MOVZ      AR4,SP                ; [CPU_U] |14|
        SUBB      XAR4,#3               ; [CPU_U] |14|
        RPT       #2
||     MOV       *XAR4++,#0            ; [CPU_] |14|
        MOVB      AL,#0                 ; [CPU_]
        MOVB      *+XAR5[0],AL.LSB      ; [CPU_] |15|
        SUBB      SP,#4                 ; [CPU_U]
        LRETR     ; [CPU_]

--------------------------------------------------------------------------------------------------------------

Problem:

  • XAR5 does not get initialized before use. Value written to wrong memory location.