AnsweredAssumed Answered

Unwanted Variable Memory Overlap?!

Question asked by Andreas Thurm on Jul 12, 2012
Latest reply on Jul 19, 2012 by bigmac



currently I'm using CW for MCU 10.2 Eclipse and realize variable memory overlap when using float support.


The following code fragment is used:


for (;:smileywink: {


tempRohwert = HMDaten[2] << 6 | ( HMDaten[3] & 0x3f );

tempMesswert= 165.0 / (2^14) * tempRohwert - 40.0;



I realized when stepping thru the I2C functions for the second time, the

variable InpLenM (from I2C1.c) gets corrupted (set to nonzero) , which leads I2C1_Sendchar(0);  to fail because of



if((InpLenM)||(I2C1_SerFlag&(CHAR_IN_TX|WAIT_RX_CHAR|IN_PROGRES))) { /* Is the bus busy */
    return ERR_BUSOFF;                 /* If yes then error */




I found that a variable (Kspec form rtsch08.c) from the floating point routines use the same memory position (0x0083 in my case) as InpLenM which leads to data modification.


What is wrong here? What leads the to that situation? Whats the reason for that unwanted shared memory usage?



Ideas are very welcome,