Menu

xdata arrays of xdata ptrs sdcc 2.5.0 8051

Anonymous
2007-12-18
2013-03-12
  • Anonymous

    Anonymous - 2007-12-18

    Hi,

    I have found a weird quirk of sdcc. I am trying to cast some structured asm data into a c table.

    typedef struct ss {
    int a;
    int b;
    } mystruct;

    xdata int c;
    xdata mystruct d;

    ////// these two work.
    xdata void * xdata ptest2[2] = { &c, &d };
    xdata mystruct * xdata ptest[2] = { &d, &d };

    ///// this gets warnings- see below.
    xdata mystruct * xdata ptest4[2] = { ( (xdata mystruct *) &c), &d };

    ///// this compiles correctly:
    xdata void * xdata ptest4[2] = { ( (xdata void *) &c), &d };

    So in the above C is random data I am trying to cast a pointer to in an external table of pointers to external data. It appears all generate
    the correct code and tables.

    Warnings from the line with warnings:

    /build/toolchain/lin32/sdcc-2.5.0/bin/sdcc -o build/fx2DescriptorTestsMain.rel -c -I./build -I./firmware -I./firmware/fx2 -I./include -DBIGSTRINGS -Ifirmware/fx2/fx2DescriptorTests -DALLOCATE_REGISTERS firmware/fx2/fx2DescriptorTests/fx2DescriptorTestsMain.c
    firmware/fx2/fx2DescriptorTests/fx2DescriptorTestsMain.c:67: warning 18: Initializer different levels of indirections
    from type 'int xdata-xdata* '
    to type 'struct ss xdata-xdata* '
    firmware/fx2/fx2DescriptorTests/fx2DescriptorTestsMain.c:1074: warning 18: Initializer different levels of indirections
    from type 'int xdata-xdata* '
    to type 'struct ss xdata-xdata* '

    It seems like there is a bug with the casting for SDCC?

    Thanks for any enlightenment. Steve

     
    • Maarten Brock

      Maarten Brock - 2007-12-20

      Steve,

      Please try again with SDCC 2.7.x.

      Maarten

       
      • Anonymous

        Anonymous - 2007-12-20

        Hi Maarten,

        I am near the end of a project using 2.5.0. We tried moving to 2.7.0 but could not get the build to work. It allocated many more function params to direct ram and ran out of space. So we stayed with 2.5.0. When I get some time I will try 2.7. again.

        Can someone who is using 2.7 see if my posted code is still a problem?

        Thanks, Steve

         
        • Maarten Brock

          Maarten Brock - 2007-12-22

          It looks like 2.7.4 behaves exactly the same way. The code looks fine though so you can ignore this warning.

           

Log in to post a comment.