We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Dear all, The linker gives following error:
*** ERROR L107: ADDRESS SPACE OVERFLOW SPACE: DATA SEGMENT: ?DT?TIMER0_ISR?TIMER LENGTH: 0002H
I have a global buffer. If i declare it idata then the linker does not give any error. But the sprintf function gives garbage values. I am unable to understand the problem.
The following is the piece of code:
dtptr = &buff; strlen = sprintf(dtptr, "%d", PrbTemperature*1000); UART_TxArray(dtptr, strlen);
PrbTemperature is a float. dtptr, buff[7] and strlen are unsigned char.
kindly assist.
strlen() is a function available in the C standard library - are you saying that you have added own variables with same name?
Next thing - why do you have a float? You sure you really need a float to handle that temperature? Have you considered fixed point integers? That removes the need for linking in floating point support.
Another thing - you do &buff. You realize that the name buff itself represents the address of the first element of the buff[] array.
Have you verified that sprintf() gives your expected printout if you throw away some code/data so you don't have to change that buffer to idata? By the way - is it buff[] that you change to idata?
1. strlen is a variable that i have declared in my function. 2. I think float is required. or may be i can manipulate temperature by multiplying it with 1000 or 100. (other way round which i can think of, but dnt want to use. I am not confident about its working for all values of temperature) 3. I wrote &buff just because i want the compiler to know that i am giving the address of an array and not a variable (foolishness) 4. ya, i am defining buff as idata.
regards, Dhaval
ya. the values returned from the sprintf in the buffer are correct (not garbage).
strlen = sprintf(dtptr, "%d", (uint16_t)(PrbTemperature*1000));
even after modifying to this, i get garbage the values as seen on terminal. the values are given in the next post