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.

TM4C1231H6PZ: Local variable is overlaping memory address of a global variable

Part Number: TM4C1231H6PZ

Tool/software:

Hello guys,

Please help me find out why and how to prevent the following:


struct Dispositivo_BVRC BillAcceptor_SCL_Create(unsigned char UPort,unsigned char index)
{
struct Dispositivo_BVRC Ans;
Ans.ID=25;//Device_CFG_BV_SCL.ID;
Ans.Port=UPort;
Ans.Type=BillAcceptor;
Ans.Estado=AccInstalado;
return(Ans);
}

when the program enters this function, the Variable "ans" that has a defined struct called from a header file. Overlaps the memory of a global variable declared in another .c file...

Hope this is enough for you guys, I dont want to get you lost with all the other code...

The compiler version is: TI 20.2.7 LTS

  • Hi guys,

    I have found that moving the parameter of stacker size solve the problem. It is basicly that my structure was to big to live in the stacker, I changed parameter from 256 to 512 and it seems to solve the problem... But which is an appropiate value for the stacker??? Can I write 1024, 2048??? 

    Regards

  • 256 to 512 and it seems to solve the problem... But which is an appropiate value for the stacker??? Can I write 1024, 2048??? 

    Glad your problem is resolved. You ca change to higher value like 1024 but if 512 is all you need then there is no need to allocate too much stack size as it just wastes unused memory.