Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE
Hi I was looking ahead to the weekend, when my code started to fail in a wired way.
During initialization I assign the same address to a member of two structs, both of the same type.
But during debugging I saw that one of the members did not get the new value, at the same time another struct close by got a strange value....
I narrowed it down to the compiler calculationg a wrong address, for one of the memebers.
The C-code snippet.

The related assembly, as shown in the debugger

And the same assembly highlighted, bacause the collers in CCS dark-mode is a bit broken ;-)

And a snippet of the memory layout

The assembly for write to the first struct is:
`08cf80: A83C MOVL @0x3c, XAR4`
with the DP = 0x5f4, the `@0x3c` points to address 0x17d3c, which matched the structs mambers location in memory.
But the assembly for write to the second struct is:
`08cf81: A804 MOVL @0x4, XAR4`
with the still being DP = 0x5f4, the `@0x4` points to address 0x17d04, which don't match the structs member, but instead writes to the area where the variables `_localSyslogDoneQueueNextReadIdx` and `level`. As you can also see the debugger highlighted in the momory view.
As far as I can see the correct assembly should have been:
`08cf81: A844 MOVL @0x44, XAR4`
It's close to the weekend, so I did not have the time to setup a demo project, also I don't know what triggered this bug, so it might be difficult (read: take a lot of time).
My compiler seetings:
cl2000" --cmd_file="diagnostic_options.opt" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -O1 --fp_mode=relaxed --obj_directory="Src" --cmd_file="syscfg/board.opt" --cmd_file="syscfg/device_cmd.opt" --cmd_file="syscfg/c2000ware_libraries.opt" --define=FLASH_LAYOUT=LOW -DLNK_TIME= "Main.c"
cmd_file="diagnostic_options.opt":
--diag_error 10247
--diag_warning 183
--diag_warning 195
--diag_warning 225
--diag_warning 2709
--diag_suppress 10205
--diag_suppress 383
-pdr
-pdv
-pden
cmd_file="syscfg/board.opt":
-I"C:/ti/c2000Ware/C2000Ware_5_01_00_01/device_support/f2837xd/common/include/"
-I"C:/ti/c2000Ware/C2000Ware_5_01_00_01/driverlib/f2837xd/driverlib/"
-DCPU2
cmd_file="syscfg/device_cmd.opt"
-DCMDTOOL
-DRUN_IN_FLASH
cmd_file="syscfg/c2000ware_libraries.opt" is empty
And for completenes here is the state of the registers,

Edit: Forgot the compiler version:
cl2000 -version
TMS320C2000 C/C++ Compiler v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 C/C++ Parser v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 EABI C/C++ Parser v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 C/C++ File Merge v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 C/C++ Optimizer v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 G3 C/C++ Codegen v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 Assembler v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 Embed Utility v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 C Source Interlister v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 Linker v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 Absolute Lister v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 Strip Utility v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 XREF Utility v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 C++ Demangler v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 Hex Converter v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 Name Utility v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 Object File Display v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
TMS320C2000 Archiver v22.6.0.LTS
Build Number 1WF5K-2LI-RZASS-TAQ-C08D
