TI Experts-
We are fighting an intermittent DDR3 memory corruption problem. Using an array of structs with this format:
typedef struct _CHANINFO_CORE {
:
: many elements
:
HOST_TERM_INFO* term;
struct _CHANINFO_CORE* link;
:
: many elements
:
} CHANINFO_CORE;
typedef struct {
uint32_t a : 8;
uint32_t b : 8;
uint32_t c : 16;
uint32_t bitrate;
struct ip_addr remote_ip;
struct ip_addr local_ip;
uint32_t remote_port : 16;
uint32_t local_port : 16;
} HOST_TERM_INFO;
Code such as the following that evaluates pointer-to-a-pointer:
test = ChanInfo_Core[n+DNUM*NCORECHAN].link->term->a; /* NCORECHAN = 1024 */
p = (uint8_t*)&ChanInfo_Core[n+DNUM*NCORECHAN].link->term;
where the struct location and the pointed-to locations are both in DDR3 memory, intermittently (it may take hours of run-time) gives a wrong value for test, or the upper two bytes of p as zero. In previous hardware design situations, I've seen similar "2 byte" errors when DDR3 settings are not 100% correct, or the memory can't quite support full clock rate under all conditions.
We haven't yet tried separating the term and link elements by some amount of bytes (maybe greater than DDR3 burst length, or cache line size ?), or removing optimization. But at this point I'd like to ask, given this struct layout, where one struct has a pointer to another of the same type, which in turn points to another struct, is there any known compiler or silicon issue where results of a DDR3 read should not immediately be used as a pointer to another DDR3 read ?
For 64-bit DDR3 width, do pointers within a struct need to be aligned to 8-bytes and does each struct in the array need to have a size divisible by 8 to preserve pointer alignment for all entries in the array ?
Thanks.
-Jeff
Signalogic
Notes on what we're using:
-c6678 @ 1 GHz, 64-bit wide DDR3 (2 GB) @ 1333 MHz
-CGT 7.4.2 and SYSBIOS 6.34.04.22
-O2 opt level
-size of CHANINFO_CORE is 152