This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Address space overflow and garbage values while using 'sprintf'

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.

Parents
  • this is what i see on my terminal:

    Input Set-point Temperature
    20201
    ëGAÈ20264
    îGAï20298
    ðGB
    20309
    ïGB 20336
    ðGB20176
    óGB'19968
    òGB219977
    òGB>20239
    õGBN20425
    õGBT20433
    öGBZ20447
    õGBi20443
    õGBr20464
    ùGB€20443
    ùGBˆ20165
    úGB"20087
    ùGBŸ20260
    úGB«20542
    ûGB®20572
    ûGB¸20549
    üGB¿20565
    ûGBÅ20585
    üGBÌ20579
    ýGB×20342
    þGBä20220
    ÿGBê20275
    20597
    20702

    The numbers are correctly displayed except that they are prefixed with some garbage values which i am unaware of how they creep in.
    and this is the change made in the code:

    strlen = sprintf(dtptr, "%d", (uint16_t)(PrbTemperature*1000));
    

Reply
  • this is what i see on my terminal:

    Input Set-point Temperature
    20201
    ëGAÈ20264
    îGAï20298
    ðGB
    20309
    ïGB 20336
    ðGB20176
    óGB'19968
    òGB219977
    òGB>20239
    õGBN20425
    õGBT20433
    öGBZ20447
    õGBi20443
    õGBr20464
    ùGB€20443
    ùGBˆ20165
    úGB"20087
    ùGBŸ20260
    úGB«20542
    ûGB®20572
    ûGB¸20549
    üGB¿20565
    ûGBÅ20585
    üGBÌ20579
    ýGB×20342
    þGBä20220
    ÿGBê20275
    20597
    20702

    The numbers are correctly displayed except that they are prefixed with some garbage values which i am unaware of how they creep in.
    and this is the change made in the code:

    strlen = sprintf(dtptr, "%d", (uint16_t)(PrbTemperature*1000));
    

Children