Atmel's Flash_api for Keil to SDCC Part 2

Help
Zappa
2005-03-22
2013-03-12
  • Zappa

    Zappa - 2005-03-22

    Atmel's flash api is almost ported from keil to SDCC, but I need some help with this last function. Keil has a support for DPTR and I'm not quite sure what would be  the best way to replace lines that are using DPTR?

    Uchar __api_wr_eeprom_page (Uint16 add_eeprom, Uint16 add_xram, Uchar nb_data) small
    {
        bit ea_save;
      ea_save = EA;
      EA=0;
      // write column latch
      DPTR = add_xram;    
      AUXR1++;        /* DPTR=DPTR1 */
      DPTR = add_eeprom;
      AUXR1++;
      for (;nb_data;nb_data--)
      {
        ACC=*((Uchar xdata*)DPTR);
        AUXR1++;
        EECON |= 0x02;
        *((Uchar xdata*)DPTR) = ACC;
        DPL++;
        EECON--;
        AUXR1++;
        DPTR++;
      }

      EECON = 0x50; // write 5x, clear 2nd LSb
      EECON^= 0x50; // write Ax        
      // restore
      EA=ea_save;  // restore interrupt state
      return 1;
    }

    Rgds, tsappa

     
    • Maarten Brock

      Maarten Brock - 2005-03-23

      I see 2 options:
      1) forget about the dual dptr and rewrite for normal pointers (e.g. Uchar xdata* ptr1; Uchar xdata* ptr2)
      2) rewrite in inline assembly.
      There's no automatic solution I think

      Greets,
      Maarten

       
    • Zappa

      Zappa - 2005-03-27

      Thanks again Maarten. I got it work with normal pointers. So, now atmel's flash api is compiled with sdcc and it seems to work also. I can share it if somebody is interested.

      Rgds, Tero

       
    • Maarten Brock

      Maarten Brock - 2005-03-28

      I guess if someone is interested it will be Thorsten Godau. He runs the SDCC Open Knowledge Base at http://sdccokr.dl9sec.de/ with lots of sample code.

       

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks