PIC16 - Applied patch from Vangelis Rokas. Many fixes for the PIC16 port.
authorsdattalo <sdattalo@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 18 May 2003 18:54:44 +0000 (18:54 +0000)
committersdattalo <sdattalo@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 18 May 2003 18:54:44 +0000 (18:54 +0000)
#ifdef's were added to disable some port dependent options.

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2626 4a8a32a2-be11-0410-ad9d-d568d2c75423

21 files changed:
ChangeLog
configure
configure.in
sdccconf_in.h
src/SDCCmain.c
src/SDCCpeeph.c
src/SDCCset.c
src/SDCCset.h
src/SDCCsymt.c
src/clean.mk
src/pic/glue.c
src/pic/main.c
src/pic/ralloc.c
src/pic16/Makefile [new file with mode: 0644]
src/pic16/device.c
src/pic16/gen.c
src/pic16/glue.c
src/pic16/main.c
src/pic16/pcode.c
src/pic16/peeph.def
src/port.h

index 50ed88ce2a7688a234563ed658b6d346ea98b99c..f7036eaf5d2edcde82c602648e07d9c5be737771 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2003-05-18  Vangelis Rokas (vrokas@otenet.gr)
+
+       * configure.in: configure for pic16 port,
+           added --disable-pic16-port
+       * sdccconf_in.h: added macro OPT_DISABLE_PIC16
+       * src/SDCCmain.c: linkOptions is changed to set *,
+           added if/endif conditional macros to remove options help
+           messages from optionsTable when a port is not configured, added
+           support for the PIc16 port in the ports table, when executing
+           the compiler with no port specified on command line, a default
+           port is selected with the new macro DEFAULT_PORT which is
+           defined in port.h, in setDefaultOptions() linkOptions is removed
+           from initialization assignment, since now it is a set,
+           parseCmdLine uses setParseWithComma for linkOptions, in
+           linkEdit() linkOptions are accessed with new function indexSet()
+           which returns the i'th item of a set variable. See SDCCset.c, in
+           linkEdit() when calling buildCmdLine(), added linkOptions as
+           last argument. Now users can pass arguments to gplink via the
+           -Wl option, main() uses pic16glue() to glue up pic16 programs
+       * src/SDCCpeeph.c: various changes to support pic16
+       * src/SDCCset.c: added function  void *indexSet(set *, int)  to
+           return the i'th item of the set
+       * src/SDCCset.h: added function prototype for indexSet()
+       * src/SDCCsymt.c: in checkSClass(), added support for PIC16
+       * src/clean.mk: added pic16 in CLEANALLPORTS variable
+       * src/port.h: added TARGET_ID_PIC16,TARGET_IS_PIC16 macro,
+           added macro DEFAULT_PORT
+       * src/pic/main.c: corrected arguments of gplnk in _linkCmd
+       * src/pic16/gen.c: bug fix in genCpl(), now the correct code is
+           generated
+       * src/pic16/glue.c: commented out some error producing lines
+       * src/pic16/main.c: __config directives are commented out to stop
+            gpasm complaining and test the linkage with gplink, _linkCmd and
+            _asmCmd changed to be more gplink and gpasm friendly
+       * src/pic16/peeph.def: peep rule 3 is commented out, since it
+           produced an error when parsed, peep rule 12 is added to utilize
+           movff, but it is commented out since the pCode does not support
+           yet a command with 2 address arguments
+
 2003-05-18    <johan@balder>
 
        * src/ds390/gen.c (genArrayInit): removed obsolete and buggy ARRAYINIT
index 0f9497740b5080a133cbb3d3a35b0feca1964fff..a0b6e55aa474023292445bd76ecab6aff3e78257 100755 (executable)
--- a/configure
+++ b/configure
@@ -875,6 +875,7 @@ Optional Features:
   --disable-ds390-port    Excludes the DS390 port
   --disable-ds400-port    Excludes the DS400 port
   --disable-pic-port      Excludes the PIC port
+  --disable-pic16-port    Excludes the PIC16 port
   --disable-xa51-port     Excludes the XA51 port
   --disable-ucsim         Disables configuring and building of ucsim
   --disable-device-lib-build
@@ -6582,6 +6583,25 @@ _ACEOF
 
 fi
 
+# Check whether --enable-pic16-port or --disable-pic16-port was given.
+if test "${enable_pic16_port+set}" = set; then
+  enableval="$enable_pic16_port"
+
+fi;
+echo pic16 >>ports.all
+if test "$enable_pic16_port" = "no"; then
+    cat >>confdefs.h <<_ACEOF
+#define OPT_DISABLE_PIC16 1
+_ACEOF
+
+else
+    echo pic16 >>ports.build
+    cat >>confdefs.h <<_ACEOF
+#define OPT_DISABLE_PIC16 0
+_ACEOF
+
+fi
+
 # Check whether --enable-xa51-port or --disable-xa51-port was given.
 if test "${enable_xa51_port+set}" = set; then
   enableval="$enable_xa51_port"
index b66262621374bdd6727c1900ec22cc9a78962441..4cb736b35b07a5f32347689081562f9d6dd698cf 100755 (executable)
@@ -577,6 +577,17 @@ else
     AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 0)
 fi
 
+AC_ARG_ENABLE(pic16-port,
+            AC_HELP_STRING([--disable-pic16-port],
+                           [Excludes the PIC port]))
+echo pic16 >>ports.all
+if test "$enable_pic16_port" = "no"; then
+    AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC16, 1)
+else
+    echo pic16 >>ports.build
+    AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC16, 0)
+fi
+
 AC_ARG_ENABLE(xa51-port,
             AC_HELP_STRING([--disable-xa51-port],
                            [Excludes the XA51 port]))
index 04c60ac0e9efecaecef0421c0e1aa0b3a8d38e43..a34379dd6c0004400b35bfd026cf71568ccd3629 100644 (file)
@@ -66,6 +66,7 @@
 #undef OPT_DISABLE_DS400
 #undef OPT_DISABLE_TININative
 #undef OPT_DISABLE_PIC
+#undef OPT_DISABLE_PIC16
 #undef OPT_DISABLE_XA51
 
 #undef OPT_ENABLE_LIBGC
index 83d4db79b205508ced2878780294407ca668215f..b8978bb397c489c8eb5e58155f675b31651e64a8 100644 (file)
@@ -66,7 +66,7 @@ struct options options;
 int preProcOnly = 0;
 int noAssemble = 0;
 set *asmOptions = NULL;         /* set of assembler options */
-char *linkOptions[128];
+set /*char*/ *linkOptions=NULL;                /* set of linker options [128]; */
 char *libFiles[128];
 int nlibFiles = 0;
 char *libPaths[128];
@@ -140,10 +140,14 @@ optionsTable[] = {
     { 0,    OPTION_LARGE_MODEL,     NULL, "external data space is used" },
     { 0,    OPTION_MEDIUM_MODEL,    NULL, "not supported" },
     { 0,    OPTION_SMALL_MODEL,     NULL, "internal data space is used (default)" },
+#if !OPT_DISABLE_DS390
     { 0,    OPTION_FLAT24_MODEL,    NULL, "use the flat24 model for the ds390 (default)" },
+#endif
     { 0,    "--stack-auto",         &options.stackAuto, "Stack automatic variables" },
+#if !OPT_DISABLE_DS390
     { 0,    OPTION_STACK_8BIT,      NULL, "use the 8bit stack for the ds390 (not supported yet)" },
     { 0,    "--stack-10bit",        &options.stack10bit, "use the 10bit stack for ds390 (default)" },
+#endif
     { 0,    "--xstack",             &options.useXstack, "Use external stack" },
     { 0,    OPTION_NO_GCSE,         NULL, "Disable the GCSE optimisation" },
     { 0,    OPTION_NO_LABEL_OPT,    NULL, "Disable label optimisation" },
@@ -198,11 +202,19 @@ optionsTable[] = {
     { 0,    "--profile",            &options.profile, "On supported ports, generate extra profiling information" },
     { 0,    "--fommit-frame-pointer", &options.ommitFramePtr, "Leave out the frame pointer." },
     { 0,    "--all-callee-saves",   &options.all_callee_saves, "callee will always save registers used" },
+#if !OPT_DISABLE_DS390
     { 0,    "--use-accelerator",    &options.useAccelerator,"generate code for  DS390 Arithmetic Accelerator"},
+#endif
     { 0,    "--stack-probe",               &options.stack_probe,"insert call to function __stack_probe at each function prologue"},
+#if !OPT_DISABLE_TININative
     { 0,    "--tini-libid",        NULL,"<nnnn> LibraryID used in -mTININative"},
+#endif
+#if !OPT_DISABLE_DS390
     { 0,    "--protect-sp-update",  &options.protect_sp_update,"DS390 - will disable interrupts during ESP:SP updates"},
+#endif
+#if !OPT_DISABLE_DS390 || !OPT_DISABLE_MCS51
     { 0,    "--parms-in-bank1",            &options.parms_in_bank1,"MCS51/DS390 - use Bank1 for parameter passing"},
+#endif
     { 0,    OPTION_NO_XINIT_OPT,    &options.noXinitOpt, "don't memcpy initialized xram from code"},
     { 0,    OPTION_NO_CCODE_IN_ASM, &options.noCcodeInAsm, "don't include c-code as comments in the asm file"},
     { 0,    OPTION_ICODE_IN_ASM,    &options.iCodeInAsm, "include i-code as comments in the asm file"},
@@ -268,6 +280,9 @@ static PORT *_ports[] =
 #if !OPT_DISABLE_PIC
   &pic_port,
 #endif
+#if !OPT_DISABLE_PIC16
+  &pic16_port,
+#endif
 #if !OPT_DISABLE_TININative
   &tininative_port,
 #endif
@@ -284,6 +299,9 @@ static PORT *_ports[] =
 #if !OPT_DISABLE_PIC
 extern void picglue ();
 #endif
+#if !OPT_DISABLE_PIC16
+extern void pic16glue();
+#endif
 
 /** Sets the port to the one given by the command line option.
     @param    The name minus the option (eg 'mcs51')
@@ -347,8 +365,15 @@ _findPort (int argc, char **argv)
        }
       argv++;
     }
+
   /* Use the first in the list */
-  port = _ports[0];
+#if defined(DEFAULT_PORT)
+       /* VR - 13/5/2003 DEFAULT_PORT is defined in port.h */
+       port = &DEFAULT_PORT;
+#else
+       port = _ports[0];
+#endif
+
 }
 
 /* search through the command line options for the processor */
@@ -500,7 +525,7 @@ setDefaultOptions ()
   int i;
 
   for (i = 0; i < 128; i++)
-    preArgv[i] = linkOptions[i] = relFiles[i] = libFiles[i] = libPaths[i] = NULL;
+    preArgv[i] = /*linkOptions[i] = */relFiles[i] = libFiles[i] = libPaths[i] = NULL;
 
   /* first the options part */
   options.stack_loc = 0;       /* stack pointer initialised to 0 */
@@ -1096,7 +1121,7 @@ parseCmdLine (int argc, char **argv)
              /* linker options */
              else if (argv[i][2] == 'l')
                {
-                  parseWithComma(linkOptions, getStringArg("-Wl", argv, &i, argc));
+                  setParseWithComma(&linkOptions, getStringArg("-Wl", argv, &i, argc));
                }
               /* assembler options */
              else if (argv[i][2] == 'a')
@@ -1340,9 +1365,9 @@ linkEdit (char **envp)
   }
 
   /* add the extra linker options */
-  for (i = 0; linkOptions[i]; i++)
-    fprintf (lnkfile, "%s\n", linkOptions[i]);
-
+  for (i = 0; i<elementsInSet(linkOptions); i++)
+    fprintf (lnkfile, "%s\n", (char *)indexSet(linkOptions, i));
+  
   /* other library paths if specified */
   for (i = 0; i < nlibPaths; i++)
     fprintf (lnkfile, "-k %s\n", libPaths[i]);
@@ -1467,14 +1492,19 @@ linkEdit (char **envp)
   if (port->linker.cmd)
     {
       char buffer2[PATH_MAX];
-      buildCmdLine (buffer2, port->linker.cmd, dstFileName, scratchFileName, NULL, NULL);
-      buildCmdLine2 (buffer, buffer2, sizeof(buffer));
+
+       /* VR 030517 - gplink needs linker options to set the linker script,*/
+       buildCmdLine (buffer2, port->linker.cmd, dstFileName, scratchFileName, NULL, linkOptions);
+
+       buildCmdLine2 (buffer, buffer2, sizeof(buffer));
     }
   else
     {
       buildCmdLine2 (buffer, port->linker.mcmd, sizeof(buffer));
     }
 
+//  if (options.verbose)fprintf(stderr, "linker command line: %s\n", buffer);
+
   system_ret = my_system (buffer);
   /* TODO: most linker don't have a -o parameter */
   /* -o option overrides default name? */
@@ -1978,8 +2008,18 @@ main (int argc, char **argv, char **envp)
 #if !OPT_DISABLE_PIC
         picglue ();
 #endif
-      }
-      else {
+
+      } else
+      if(TARGET_IS_PIC16) {
+       /* PIC16 port misc improvements Vangelis Rokas - 6-May-2003
+         Generate .asm files for gpasm (just like PIC target) but use
+         pic16glue()
+       */
+      
+#if !OPT_DISABLE_PIC16
+       pic16glue();
+#endif
+      } else {
         glue ();
       }
 
index e052e3ea6b28ceca3a6e24b2a199c0318ab60840..9e7d672e09f1cb376d034e18c0f5bc2002ab671d 100644 (file)
@@ -52,7 +52,7 @@ static bool matchLine (char *, char *, hTab **);
 #define FBYNAME(x) int x (hTab *vars, lineNode *currPl, lineNode *endPl, \
        lineNode *head, const char *cmdLine)
 
-#if !OPT_DISABLE_PIC
+#if !OPT_DISABLE_PIC || !OPT_DISABLE_PIC16
 void  peepRules2pCode(peepRule *);
 #endif
 
@@ -1433,9 +1433,9 @@ peepHole (lineNode ** pls)
   lineNode *mtail = NULL;
   bool restart;
 
-#if !OPT_DISABLE_PIC
+#if !OPT_DISABLE_PIC || !OPT_DISABLE_PIC16
   /* The PIC port uses a different peep hole optimizer based on "pCode" */
-  if (TARGET_IS_PIC)
+  if (TARGET_IS_PIC || TARGET_IS_PIC16)
     return;
 #endif
 
@@ -1574,11 +1574,11 @@ initPeepHole ()
     }
 
 
-#if !OPT_DISABLE_PIC
+#if !OPT_DISABLE_PIC || !OPT_DISABLE_PIC16
   /* Convert the peep rules into pcode.
      NOTE: this is only support in the PIC port (at the moment)
   */
-  if (TARGET_IS_PIC) {
+  if (TARGET_IS_PIC || TARGET_IS_PIC16) {
     peepRules2pCode(rootRules);
   }
 #endif
index 5014303f18d63a0b6c2e615d5a6975b137d21fcc..f8bab7367feb245dd287cc5a7bee4c9d16680e7c 100644 (file)
@@ -402,6 +402,22 @@ elementsInSet (set * s)
   return count;
 }
 
+/*-----------------------------------------------------------------*/
+/* indexSet - returns the i'th item in set                         */
+/*-----------------------------------------------------------------*/
+void *indexSet(set * s, int index)
+{
+  set *loop=s;
+  
+  while(loop && index) {
+       index--;
+       loop = loop->next;
+  }
+
+  return (loop->item);
+}
+
+
 /*-----------------------------------------------------------------*/
 /* reverseSet - reverse the order of the items of a set            */
 /*-----------------------------------------------------------------*/
index 93da8ddab2c78ac24d95f8833322cf191e5ecf90..344007cf8a70b13a8185249e37ff5e8d25bb075e 100644 (file)
@@ -67,6 +67,7 @@ set *setFromSet (set *);
 int isSetsEqual (set *, set *);
 set *subtractFromSet (set *, set *, int);
 int elementsInSet (set *);
+void *indexSet(set *, int);
 set *intersectSetsWith (set *, set *, int (*cFunc) (void *, void *), int);
 int isSetsEqualWith (set *, set *, int (*cFunc) (void *, void *));
 void *peekSet (set *);
index 80ccfc5ad12bdb2bf82d3a5223113e415ea7890a..be673e50622ad7175195b49ae8ee69e8d6115727 100644 (file)
@@ -1144,9 +1144,9 @@ checkSClass (symbol * sym, int isProto)
   /* if absolute address given then it mark it as
      volatile -- except in the PIC port */
 
-#if !OPT_DISABLE_PIC
+#if !OPT_DISABLE_PIC || !OPT_DISABLE_PIC16
   /* The PIC port uses a different peep hole optimizer based on "pCode" */
-  if (!TARGET_IS_PIC)
+  if (!TARGET_IS_PIC && !TARGET_IS_PIC16)
 #endif
 
     if (IS_ABSOLUTE (sym->etype))
index 074e9cf0782e8bfb9b141ebed46aef9a78ad8e14..d308c9b7dd294a09a3b93aeb54c1de507e5f2d88 100644 (file)
@@ -1,4 +1,4 @@
-CLEANALLPORTS = avr ds390 izt mcs51 pic z80 xa51
+CLEANALLPORTS = avr ds390 izt mcs51 pic pic16 z80 xa51
 PRJDIR = ..
 
 # Deleting all files created by building the program
index 8a94ee426107469edc78b57ece1c6b69d2df00fd..7699fbad560934da49877a8aa2246bcf190fea65 100644 (file)
@@ -789,11 +789,6 @@ picglue ()
     cdbStructBlock (0);
 
   vFile = tempfile();
-  /* PENDING: this isnt the best place but it will do */
-  if (port->general.glue_up_main) {
-    /* create the interrupt vector table */
-    pic14createInterruptVect (vFile);
-  }
 
   addSetHead(&tmpfileSet,vFile);
     
@@ -802,6 +797,11 @@ picglue ()
   /* do the overlay segments */
   pic14emitOverlay(ovrFile);
 
+  /* PENDING: this isnt the best place but it will do */
+  if (port->general.glue_up_main) {
+    /* create the interrupt vector table */
+    pic14createInterruptVect (vFile);
+  }
 
   AnalyzepCode('*');
 
index 7b91caa291b148b86c24755e21b51291b339ae9c..78cfda609d6d8e883a273c412219b05ee3d41b15 100644 (file)
@@ -327,7 +327,7 @@ _hasNativeMulFor (iCode *ic, sym_link *left, sym_link *right)
 */
 static const char *_linkCmd[] =
 {
-  "gplink", "-nf", "\"$1\"", NULL
+  "gplink", "", "\"$1.o\"", NULL
 };
 
 static const char *_asmCmd[] =
index 1614e6c94ce9dd24439f4640e7a99b464dfab0ec..b1a37641f89f4681a6fe38faa11ba014fca61c4b 100644 (file)
@@ -977,7 +977,8 @@ void packBits(set *bregs)
       breg->address >>= 3;
 
       if(!bitfield) {
-       sprintf (buffer, "fbitfield%02x", breg->address);
+       //sprintf (buffer, "fbitfield%02x", breg->address);
+       sprintf (buffer, "0x%02x", breg->address);
        //fprintf(stderr,"new bit field\n");
        bitfield = newReg(REG_SFR, PO_GPR_BIT,breg->address,buffer,1,0);
        bitfield->isBitField = 1;
diff --git a/src/pic16/Makefile b/src/pic16/Makefile
new file mode 100644 (file)
index 0000000..3b85636
--- /dev/null
@@ -0,0 +1,2 @@
+# Make all in this directory
+include ../port.mk
index 3b33b564b707fc55937cb79e0c225b8403e764ac..f5861d81ebbe6d322a67786e32c9c42a8cd1a304 100644 (file)
@@ -458,7 +458,7 @@ static int validAddress(int address, int reg_size)
     fprintf(stderr, "missing \"#pragma maxram\" setting\n");
     return 0;
   }
-  //  fprintf(stderr, "validAddress: Checking 0x%04x\n",address);
+//  fprintf(stderr, "validAddress: Checking 0x%04x (max=0x%04x) (reg_size = %d)\n",address, pic->maxRAMaddress, reg_size);
   if(address > pic->maxRAMaddress)
     return 0;
 
@@ -522,7 +522,7 @@ static int assignRegister(regs *reg, int start_address)
 {
   int i;
 
-  //fprintf(stderr,"%s -  %s start_address = 0x%03x\n",__FUNCTION__,reg->name, start_address);
+       //fprintf(stderr,"%s -  %s start_address = 0x%03x\n",__FUNCTION__,reg->name, start_address);
   if(reg->isFixed) {
 
     if (validAddress(reg->address,reg->size)) {
@@ -548,6 +548,7 @@ static int assignRegister(regs *reg, int start_address)
     for (i=start_address; i<=pic->maxRAMaddress; i++) {
 
       if (validAddress(i,reg->size)) {
+       fprintf(stderr, "found valid address = 0x%04x\n", i);
        reg->address = i;
        mapRegister(reg);
        return i;
index 422ad251daef9775753ca2be4c0682284931996b..d6f5eddf7aea20c3446a11a2b122973db2042320 100644 (file)
@@ -264,6 +264,8 @@ void pic16_emitcode (char *inst,char *fmt, ...)
     lineCurr->isInline = _G.inLine;
     lineCurr->isDebug  = _G.debugLine;
 
+// VR    fprintf(stderr, "lb = <%s>\n", lbp);
+
     if(pic16_debug_verbose)
       pic16_addpCode2pBlock(pb,pic16_newpCodeCharP(lb));
 
@@ -1919,10 +1921,22 @@ static void genCpl (iCode *ic)
 
     size = AOP_SIZE(IC_RESULT(ic));
     while (size--) {
+/*
         char *l = pic16_aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE);
         MOVA(l);       
         pic16_emitcode("cpl","a");
         pic16_aopPut(AOP(IC_RESULT(ic)),"a",offset++);
+*/
+       if (pic16_sameRegs(AOP(IC_LEFT(ic)), AOP(IC_RESULT(ic))) ) {
+             DEBUGpic16_emitcode("; ", "same registers");
+             pic16_emitpcode(POC_COMF,  pic16_popGet(AOP(IC_LEFT(ic)), offset));
+       } else {
+               DEBUGpic16_emitcode(";",  "not sames registers!");
+               pic16_emitpcode(POC_COMFW, pic16_popGet(AOP(IC_LEFT(ic)),offset));
+               pic16_emitpcode(POC_MOVWF, pic16_popGet(AOP(IC_RESULT(ic)),offset));
+       }
+       offset++;
+
     }
 
 
@@ -9909,6 +9923,7 @@ void genpic16Code (iCode *lic)
     pb = pic16_newpCodeChain(GcurMemmap,0,pic16_newpCodeCharP("; Starting pCode block"));
     pic16_addpBlock(pb);
 
+#if 0
     /* if debug information required */
     if (options.debug && currFunc) { 
       if (currFunc) {
@@ -9924,11 +9939,13 @@ void genpic16Code (iCode *lic)
        _G.debugLine = 0;
       }
     }
-
+#endif
 
     for (ic = lic ; ic ; ic = ic->next ) {
 
-      DEBUGpic16_emitcode(";ic","");
+//      fprintf(stderr, "; VR = %c %x\n", ic->op, ic->op);
+//      DEBUGpic16_emitcode("; VR", "");
+      DEBUGpic16_emitcode(";ic ", "\t%c 0x%x",ic->op, ic->op);
        if ( cln != ic->lineno ) {
            if ( options.debug ) {
                _G.debugLine = 1;
@@ -10160,3 +10177,4 @@ void genpic16Code (iCode *lic)
 
     return;
 }
+
index 7e7d1c7e5dbe96bd4e8a100d5fd93bf63fcf965d..f9728d6ce163bbaaa0d329330db92da4f343d09e 100644 (file)
@@ -444,6 +444,7 @@ pic16emitStaticSeg (memmap * map)
       if (!IS_STATIC (sym->etype))
        addSetHead (&publics, sym);
 
+#if 0
       /* print extra debug info if required */
       if (options.debug || sym->level == 0)
        {
@@ -466,6 +467,7 @@ pic16emitStaticSeg (memmap * map)
          fprintf (code->oFile, "%s_%d_%d", sym->name, sym->level, sym->block);
 
        }
+#endif
 
       /* if it has an absolute address */
       if (SPEC_ABSA (sym->etype))
@@ -677,6 +679,7 @@ pic16emitOverlay (FILE * afile)
          if (IS_FUNC (sym->type))
            continue;
 
+#if 0
          /* print extra debug info if required */
          if (options.debug || sym->level == 0)
            {
@@ -696,6 +699,7 @@ pic16emitOverlay (FILE * afile)
                         (sym->localof ? sym->localof->name : "-null-"));
              fprintf (afile, "%s_%d_%d", sym->name, sym->level, sym->block);
            }
+#endif
 
          /* if is has an absolute address then generate
             an equate for this no need to allocate space */
@@ -774,7 +778,7 @@ pic16glue ()
 
   /* print the global struct definitions */
   if (options.debug)
-    cdbStructBlock (0,cdbFile);
+    cdbStructBlock (0);        //,cdbFile);
 
   vFile = tempfile();
   /* PENDING: this isnt the best place but it will do */
index 8b3f3ae91551f5f4f29c99cd857338f07013df3e..57cf4e3fedd6dc4cacdd1e354bb75aa623773cca 100644 (file)
@@ -17,7 +17,7 @@ static char _defaultRules[] =
 #include "peeph.rul"
 };
 
-/* list of key words used by msc51 */
+/* list of key words used by pic16 */
 static char *_pic16_keywords[] =
 {
   "at",
@@ -240,6 +240,8 @@ _pic16_genAssemblerPreamble (FILE * of)
 
   fprintf (of, "\tlist\tp=%s\n",&name[1]);
   fprintf (of, "\tinclude \"%s.inc\"\n",name);
+
+#if 0
   fprintf (of, "\t__config _CONFIG1H,0x%x\n",pic16_getConfigWord(0x300001));
   fprintf (of, "\t__config _CONFIG2L,0x%x\n",pic16_getConfigWord(0x300002));
   fprintf (of, "\t__config _CONFIG2H,0x%x\n",pic16_getConfigWord(0x300003));
@@ -251,6 +253,8 @@ _pic16_genAssemblerPreamble (FILE * of)
   fprintf (of, "\t__config _CONFIG6H,0x%x\n",pic16_getConfigWord(0x30000b));
   fprintf (of, "\t__config _CONFIG7L,0x%x\n",pic16_getConfigWord(0x30000c));
   fprintf (of, "\t__config _CONFIG7H,0x%x\n",pic16_getConfigWord(0x30000d));
+#endif
+
   fprintf (of, "\tradix dec\n");
 }
 
@@ -336,7 +340,7 @@ _hasNativeMulFor (iCode *ic, sym_link *left, sym_link *right)
 */
 static const char *_linkCmd[] =
 {
-  "aslink", "-nf", "$1", NULL
+  "gplink", "\"$1.o\"", "-o $1", "$l", NULL
 };
 
 /* Sigh. This really is not good. For now, I recommend:
@@ -345,7 +349,7 @@ static const char *_linkCmd[] =
  */
 static const char *_asmCmd[] =
 {
-  "gpasm", "-c  -I /usr/local/share/gpasm/header", "$1.asm", NULL
+  "gpasm", "-c  -I /usr/local/share/gputils/header", "\"$1.asm\"", NULL
 
 };
 
index b0a6645af6fd3c41c157682353c90e220fc39302..5c84c367f6cadedd3942497cc56c5aa9d7f8a45a 100644 (file)
@@ -79,7 +79,7 @@ static pBlock *pb_dead_pcodes = NULL;
 /* Hardcoded flags to change the behavior of the PIC port */
 static int peepOptimizing = 1;        /* run the peephole optimizer if nonzero */
 static int functionInlining = 1;      /* inline functions if nonzero */
-int pic16_debug_verbose = 0;                /* Set true to inundate .asm file */
+int pic16_debug_verbose = 1;                /* Set true to inundate .asm file */
 
 static int GpCodeSequenceNumber = 1;
 static int GpcFlowSeq = 1;
index c0e7b81cf4c37711fb73852a13ad8f595717fbc3..1d8a27505eaa83794ba47e62299ced883857e22b 100644 (file)
 // Also, notice that this snippet is not valid if
 // it follows another skip
 
+
 replace restart {
         _NOTBITSKIP_   %1
        _BITSKIP_       %2
@@ -161,16 +162,16 @@ replace restart {
 } if NZ
 
 // peep 3
-replace restart {
-       decf    %1,f
-       movf    %1,w
-       btfss   _STATUS,z
-       goto    %2
-} by {
-       ;     peep 3 - decf/mov/skpz to decfsz
-       decfsz  %1,f
-        goto   %2
-}
+//replace restart {
+/      decf    %1,f
+///    movf    %1,w
+//     btfss   _STATUS,z
+//     goto    %2
+//} by {
+//     ;     peep 3 - decf/mov/skpz to decfsz
+//     decfsz  %1,f
+//      goto   %2
+//}
 
 
 replace restart {
@@ -283,3 +284,14 @@ replace restart {
         ;     peep 11 - Removed redundant move
         movf    %1,w
 }
+
+
+// From: Vangelis Rokas (vrokas@otenet.gr)
+
+//replace {
+//     movf    %1,W
+//     movwf   %2
+//} by {
+//     ;       peep 12 - Use movff to move source to dest
+//     movff   %1, %2
+//}
index cc747fd73d49177a2c4228fefe69f99f7e7424ca..63500d49736aab51222af37b35b9f665d0ae123d 100644 (file)
@@ -14,6 +14,7 @@
 #define TARGET_ID_AVR      4
 #define TARGET_ID_DS390    5
 #define TARGET_ID_PIC      6
+#define TARGET_ID_PIC16           7
 #define TARGET_ID_XA51     9
 #define TARGET_ID_DS400           10
 
@@ -27,6 +28,7 @@
 #define TARGET_IS_DS390 (port->id==TARGET_ID_DS390)
 #define TARGET_IS_DS400 (port->id==TARGET_ID_DS400)
 #define TARGET_IS_PIC   (port->id==TARGET_ID_PIC)
+#define TARGET_IS_PIC16        (port->id==TARGET_ID_PIC16)
 #define TARGET_IS_XA51 (port->id==TARGET_ID_XA51)
 
 #define MAX_BUILTIN_ARGS       16
@@ -280,6 +282,9 @@ extern PORT ds390_port;
 #if !OPT_DISABLE_PIC
 extern PORT pic_port;
 #endif
+#if !OPT_DISABLE_PIC16
+extern PORT pic16_port;
+#endif
 #if !OPT_DISABLE_TININative
 extern PORT tininative_port;
 #endif
@@ -290,4 +295,6 @@ extern PORT xa51_port;
 extern PORT ds400_port;
 #endif
 
+#define DEFAULT_PORT   pic16_port
+
 #endif /* PORT_INCLUDE*/