added support for the asix ax110xx chips

mamalala1
2007-11-30
2013-03-12
  • mamalala1
    mamalala1
    2007-11-30

    hi all,

    just made a small patch to sdcc & the ds390 code to support the asix ax110xx cpu's.
    they are 8051/80390 chips. the change is to add a code sequence to the
    startup stuff that the compiler generates and a small change to the
    irq-vector generation.

    background: the cpu always starts in 8051 mode and needs acon=0x02 to get into ds390
    mode. since the native ds390 target generates only 390 code, the chip does not
    startup.

    the patch adds the switch --use-asix to insert the needed sequence and set the
    cpu in 80390 mode.

    it is generated against a snapshot tarball from the cvs, namely from
    sdcc-src-20071129-4972.tar.bz2

    maybe there is a different solutioon for that, but it works for me that way ;)

    hope its usefull,
    greets,

    chris

     
    • mamalala1
      mamalala1
      2007-11-30

      forgot the patch, here it is:

      diff -crB sdcc/ChangeLog sdcc-asix/ChangeLog
      *** sdcc/ChangeLog      2007-11-17 20:23:59.000000000 +0100
      --- sdcc-asix/ChangeLog 2007-11-30 05:16:07.136379144 +0100
      ***************
      *** 1,3 ****
      --- 1,8 ----
      + 2007-11-30 Christian Klippel <ck AT mamalala.net>
      +
      +       * src/ds390/main.c: added ax110xx target to ds390 (option --use-asix)
      +       * src/SDCCglobl.h: added ax110xx target to ds390 (option --use-asix)
      +
        2007-11-17 Raphael Neider <rneider AT web.de>

              * src/pic/main.c (_asmCmd): include debug arguments (-g as $3)
      diff -crB sdcc/src/ds390/main.c sdcc-asix/src/ds390/main.c
      *** sdcc/src/ds390/main.c       2007-06-18 20:24:42.000000000 +0200
      --- sdcc-asix/src/ds390/main.c  2007-11-30 05:12:58.453530081 +0100
      ***************
      *** 21,26 ****
      --- 21,27 ----
        #define OPTION_STACK_8BIT       "--stack-8bit"
        #define OPTION_FLAT24_MODEL     "--model-flat24"
        #define OPTION_STACK_SIZE       "--stack-size"
      + #define OPTION_USE_ASIX         "--use-asix"

        static OPTION _ds390_options[] =
          {
      ***************
      *** 33,38 ****
      --- 34,40 ----
            { 0, "--use-accelerator",   &options.useAccelerator, "generate code for ds390 arithmetic accelerator"},
            { 0, "--protect-sp-update", &options.protect_sp_update, "will disable interrupts during ESP:SP updates"},
            { 0, "--parms-in-bank1",    &options.parms_in_bank1, "use Bank1 for parameter passing"},
      +     { 0, OPTION_USE_ASIX,       &options.use_asix, "generate code for the asix chip" },
            { 0, NULL }
          };

      ***************
      *** 253,258 ****
      --- 255,265 ----
              fputs ("ma\t=\t0xD3\n", of);
              fputs ("mb\t=\t0xD4\n", of);
              fputs ("mc\t=\t0xD5\n", of);
      +       if(options.use_asix)
      +         {
      +           fputs ("ta\t=\t0xEB\n", of);
      +           fputs ("acon\t=\t0x9D\n", of);
      +         }
              fputs ("F1\t=\t0xD1\t; user flag\n", of);
              if (options.parms_in_bank1) {
                  int i ;
      ***************
      *** 290,295 ****
      --- 297,311 ----
              return TRUE;
            }

      +   if(options.use_asix)
      +     {
      +       fprintf (stderr,
      +              "*** warning: targeting for asix\n");
      +       dbuf_printf (oBuf, ".flat24 off\n");
      +       dbuf_printf (oBuf, "\tljmp\t__reset_vect\n");
      +       dbuf_printf (oBuf, ".flat24 on\n");
      +     }
      +   else
          dbuf_printf (oBuf, "\tajmp\t__reset_vect\n");

          /* now for the other interrupts */
      ***************
      *** 305,310 ****
      --- 321,336 ----
                }
            }

      +   if(options.use_asix)
      +     {
      +       dbuf_printf (oBuf, ".flat24 off\n");
      +       dbuf_printf (oBuf, "__reset_vect:\n");
      +       dbuf_printf (oBuf, "\tmov ta,#0xAA\n");
      +       dbuf_printf (oBuf, "\tmov ta,#0x55\n");
      +       dbuf_printf (oBuf, "\tmov acon,#0x02\n");
      +       dbuf_printf (oBuf, ".flat24 on\n");
      +     }
      +   else
          dbuf_printf (oBuf, "__reset_vect:\n\tljmp\t__sdcc_gsinit_startup\n");

          return TRUE;
      diff -crB sdcc/src/SDCCglobl.h sdcc-asix/src/SDCCglobl.h
      *** sdcc/src/SDCCglobl.h        2007-07-27 22:23:22.000000000 +0200
      --- sdcc-asix/src/SDCCglobl.h   2007-11-30 05:06:54.000000000 +0100
      ***************
      *** 291,296 ****
      --- 291,297 ----
            int unsigned_char;          /* use unsigned for char without signed/unsigned modifier */
            char *code_seg;             /* segment name to use instead of CSEG */
            char *const_seg;            /* segment name to use instead of CONST */
      +     bool use_asix;         /* since xram_size=0 is a possibility */
            /* sets */
            set *calleeSavesSet;        /* list of functions using callee save */
            set *excludeRegsSet;        /* registers excluded from saving */

       
    • Borut Ražem
      Borut Ražem
      2007-12-01

      Please submit a sdcc parch request at https://sourceforge.net/tracker/?group_id=599&atid=300599 so that it won't get lost.

      Borut