Hi
Short: TM320F28335, reading eCAN Msg Box by copying union MDH (part of MBOX struct) fails with CGT 6.4.5
Reason: generated code seems not to work
Edit: PREAD is "read from program memory" command? But the read address is data and defined in page 1 in cmd file.
This C-Code (see difference: 1st line with access of .all, 2nd line access of union)
PtrMsg->MDL.all = PtrMBox->MDL.all;
PtrMsg->MDH = PtrMBox->MDH;
generates (with CGT 6.1.10 / 6.2.11) this asm:
PtrMsg->MDL.all = PtrMBox->MDL.all;
MOVL ACC, *+XAR5[4]
MOVL *+XAR4[4], ACC
PtrMsg->MDH = PtrMBox->MDH;
MOVL ACC, *+XAR5[6]
MOVL *+XAR4[6], ACC
This does copy the content of addres 0x6146 (MBOX content of msg box 8) to my local union. -> all OK!
With CGT 6.4.5 the same C code leads to this asm
PtrMsg->MDL.all = PtrMBox->MDL.all;
MOVL ACC, *+XAR5[4]
MOVL *+XAR4[4], ACC
PtrMsg->MDH = PtrMBox->MDH;
ADDB XAR1, #6 ; this makes point XAR1 to correct destination in my local union
ADDB XAR7, #6; this makes XAR7 point to correct source 0x6146 which is mbox data
RPT #1
|| PREAD *XAR1++, *XAR7; this read fails! no data copied from 0x6146 to my local union
Question: Why?
Thank you & regards
Roger
MBOX is found in TI headers for c2000 (DSP2833x_ECan.h)
struct MBOX {
union CANMSGID_REG MSGID;
union CANMSGCTRL_REG MSGCTRL;
union CANMDL_REG MDL;
union CANMDH_REG MDH;
};