Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


Pointer to __code string in __xdata

  • I'm using SDCC inside the SiLabs IDE on Windows 7 targeting a C8051F120.

    I'm trying to create a pointer to a string that is stored in code memory and I would like the pointer to be in XDATA memory. Everything that I have tried just gets me an error:

    xdata char code * msgid;

    error 146: two or more storage classes in declaration for 'type_specifier declaration_specifiers - skipped'

    Is there a way to specify where a pointer is to be stored as well as what it points to?

    I've just started on this project and already I've got severe memory problems, so I'm trying to figure out how to move things out of the default data memory. I've got some structures and text strings in __code, but I haven't been able to figure out how to tell the compiler that I want the object pointed to to be in code while also specifying where the pointer is to end up.

    Any help on this would be appreciated.

  • code char *xdata msgid;


    • Thank you very much. That's just what I needed.

  • Maarten Brock
    Maarten Brock

    I would think this is well explained in the manual in: Pointers to MCS51/DS390 specific memory spaces

    • Sorry, I guess that I was being blind and I missed that section.