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.

Static Variable Declaration Causes to Reset Global Variable

Hi,

In F2837xD_TempSensorConv.c file "int32 tempSensor_tempSlope", "Uint16 tempSensor_tempOffset" variables are declared.

I read the core temperature using the functions in "TempSensorConv.c". It works normally, but if I add a new static variable inside the main.c "tempSensor_tempSlope" variable value becomes 2.147.483.648 and "tempSensor_tempOffset" value 65535 automatically. I have already defined some static variables, they are ok, but I cannot add anymore. I checked .map file .ebbs section. ebss section is located at RAMGS1-4 in the linker and there are plenty room for new variables.

Is there any idea, what could cause this?

  • Hello,

    What revision is your device? Are you saying that getTempSlope() and getTempOffset() are returning unexpected values, or are the slope and offset variables taking on these values at some other point in the application?

    Thanks,
    Whitney
  • Hi,
    I'm using silicon revision C, my own design board.
    getTempSlope() and getTempOffset() are returning true values and at some other point in the application, slope and offset variables taking those values. If I add a new static variable within main.c file this problem occurs. There are already some static variables in the main.c but if I define static variables in another .c file there is no problem.
  • If you step through the code can you see at what point they change? Would you be able to attach the modified code to a post so I can see what specific changes you made and see if I have the same issue?

    Thanks,

    Whitney