syntax error: token -> '__at' ; column 33

rrred
2008-05-18
2013-03-12
  • rrred

    rrred - 2008-05-18

    Hello,

    Why this code does not compile?

    unsigned char Display[40*24] __at( 0x2000 );

    I got this error:
    teste.c:1: syntax error: token -> '__at' ; column 33

    I use this command do compile:
    sdcc teste.c -mz80 --code-loc 0x0000 --no-std-crt0 --stack-loc 0x7fff

    And this is the whole program:

    unsigned char Display[40*24] __at( 0x2000 );
    void main(void){
        Display[0]=0x41;
    }

    I did a search in the forum, but could not find anything useful.

    I would appreciate any help.
    Thanks.

     
    • Maarten Brock

      Maarten Brock - 2008-05-19

      Because __at must be placed before the variable.

       
      • rrred

        rrred - 2008-05-19

        Thanks for the answer, but there must be something else...

        Is the following examples supposed to work?

        They are all from the SDCC manual, and all of them gives me errors when compiling.

        __code __at (0x7ff0) char Id[5] = ''SDCC'';

        (gives "syntax error: token -> '__at' ; column 11")

        These does not work as well:

        volatile __xdata __at (0x8000) unsigned char PORTA_8255;
        xdata at 0x7ffe unsigned int chksum;

         
        • Maarten Brock

          Maarten Brock - 2008-05-20

          Which version of SDCC are you using? Type sdcc -v to find it.

           
          • rrred

            rrred - 2008-05-20

            Hi, thanks for watching this thread.

            SDCC Snapshot version 2.8.1 #5156

            I remember to have tested this first with version 2.8, and as it did not work, I tried this newer version.

            thanks.

             
            • Maarten Brock

              Maarten Brock - 2008-05-21

              I'm sorry I didn't notice this before, but you are using a z80. The z80 does not have a harvard architecture like the 8051. You're trying examples from the manual under mcs51 storage classes and use them for the z80. That obviously does not work. So remove the __code and __xdata from your tests.

               

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks