Error from coverting from Kiel to SDCC

Help
MikeEdmond
2007-05-31
2013-03-12
  • MikeEdmond

    MikeEdmond - 2007-05-31

    Hello

    I've just switched from Kiel compilier to SDCC and have managed to convert everything except for this error.

    The code was fine in Kiel

    char xdata * xdata RT0stringpointers[ 8 ] = {&RT0inputstring0,&RT0inputstring1,&RT0inputstring2,&RT0inputstring3,&RT0inputstring4,&RT0inputstring5,&RT0inputstring6,&RT0inputstring7};

    It is the array of pointers to input strings in a buffer that the serial port writes.

    I get the error out 

    H:/Control/Micro_Controllers/Code_devlopment/newcompiler/COMS_version_1.c:61: error 47: indirections to different types assignment 
    from type 'char [8] xdata-xdata* '
    to type 'char xdata-xdata* '

    I've a fair bit with switching the xdata around before and after the char and nothing works.

    If I take the xdata words out it compiles but then the get the error can't find 116 bytes in RAM

    Thanks
    Mike

     
    • Anonymous

      Anonymous - 2007-05-31

      Mike,

      I would assume that the RTinputstring... variables are not char arrays placed in XRAM.
      I'll write down some examples to make things clearer:

      /*******************************************************/
      /* this is an initialized char[4] array placed in XRAM */
      /*******************************************************/
      char xdata string1[4] = "AAA";

      /*********************************************************/
      /* this is an uninitialized char[4] array placed in XRAM */
      /*********************************************************/
      char xdata string2[4];

      /*******************************************************/
      /* this is an initialized char[4] array placed in IRAM */
      /*******************************************************/
      char idata string3[4] = "CCC";

      /****************************************************************/
      /* this is an initialized (xdata char *) array with 2 elements. */
      /* "foo1" is located in XRAM and holds pointers to char arrays  */
      /* which must reside in XRAM space.                             */
      /****************************************************************/
      xdata char * xdata foo1[2] = {string1, string2};

      /****************************************************************/
      /* this is an initialized (xdata char *) array with 2 elements. */
      /* "foo2" is located in IRAM and holds pointers to char arrays  */
      /* which must reside in XRAM space.                             */
      /****************************************************************/
      xdata char * idata foo2[2] = {string1, string2};

      /****************************************************************/
      /* this is an initialized (xdata char *) array with 2 elements. */
      /* "foo3" is located in XRAM and holds pointers to char arrays  */
      /* which must reside in XRAM space.                             */
      /* However, because of the declaration of string3, this will    */
      /* result in a compile error.                                   */
      /****************************************************************/
      xdata char * xdata foo3[2] = {string1, string3};

      If you omit the various "xdata" and "data" storage class modifiers, the defaults used depend on the memory model you have selected (have a look at chapter 3.4 of the SDCC manual).

      Happy hacking,

      Markus Klama
      ELCAT GmbH

       
    • Maarten Brock

      Maarten Brock - 2007-05-31

      How are RT0inputstringX defined? Are they character arrays? Then they are already pointers and you should remove the &.

      Maarten

       

Log in to post a comment.