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.

Compiler/CC1310: Initialized variables not set properly

Part Number: CC1310

Tool/software: TI C/C++ Compiler

Hi Everyone,

   I feel like I am missing something stupid here but I can't determine what is happening.  I am using CCS v8.0 and the TI compiler.

I have the following snippet of code:

int8_t traceBuf[4096];
int8_t *tracePtr = traceBuf;
int8_t logStr[64];

void trace(char *buf)
{
    char   timeStr[32];
    int8_t len = sprintf(timeStr, " %d-", timeMs());
    if ((tracePtr + len) < &traceBuf[4095])

When I set a breakpoint on that last line and look at the value of tracePtr it is 0x00000109.  I've seen other values as well.

In the linkmap I see the following:

20000208 traceBuf
20004bf4 tracePtr

Farther down in the code I try writing to *tracePtr and, of course, it crashes.

I've got another similarly-defined counter variable that should be initialized to 0 and it always starts out with some wild value.

This is just plain old C code.  Am I missing something?

Victor