SourceForge has been redesigned. Learn more.
Close

Problem regarding allocating memory in stack

arulnambi
2013-05-24
2013-06-06
  • arulnambi

    arulnambi - 2013-05-24

    Hello all,
    I started using SDCC compiler for last few months. I am finding following problem whenever I do some manipulation with big arrays or structures. Could someone provide me info why I get these type of error message. I get these errors though declare all my varibales in XDATA.

    ?ASlink-Error-Could not get 4 consecutive bytes in internal RAM for area DSEG.
    ?ASlink-Error-Could not get 4 consecutive bytes in internal RAM for area OSEG.
    ?ASlink-Error-Could not get 8 consecutive bytes in internal RAM for area OSEG.
    ?ASlink-Error-Could not get 4 consecutive bytes in internal RAM for area OSEG.

    If someone had this problem and solved please provide me details. Thank you in advance.

     
  • Maarten Brock

    Maarten Brock - 2013-05-25

    This means you ran out of data memory. And it probably is because the code needs many temporaries that get stored in DSEG or OSEG. It can help to change to --stack-auto as the stack can use idata too, but beware of stack overflow.

     
  • arulnambi

    arulnambi - 2013-05-31

    Thank you Maarten !!!

    I still go with --stack-small model. I changed many of custom library functions developed by me to have as less local variables & function parameters. I got rid of this error for the moment and I consume DATA size 113 Bytes (+143 Bytes Stack). I feel this problem comes excess use of functions such as sprintf and other string manipulation function as well.
    I don't want to risk with idata. If you know some other optimisation method to reduce data memory, please let me know. Thanks in advance !!!

     
  • Maarten Brock

    Maarten Brock - 2013-06-06

    You can manually place larger (global/static) variables (esp. arrays & structs) in __idata/__pdata/__xdata.
    __idata is cheapest in code and performance, but costs stack space and is limited.
    __pdata is a bit larger but less efficient.
    __xdata is the largest but least efficient.

     
    Last edit: Maarten Brock 2013-06-06

Log in to post a comment.