]> git.gag.com Git - fw/sdcc/commitdiff
2004-01-08 Vangelis Rokas <vrokas@otenet.gr>
authorvrokas <vrokas@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 8 Jan 2004 16:08:03 +0000 (16:08 +0000)
committervrokas <vrokas@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 8 Jan 2004 16:08:03 +0000 (16:08 +0000)
* src/SDCCmain.c: removed various references to DEFAULT_PORT
* src/port.h: added flag needLinkerScript in port->linker
structure to inform whether to create a .lnk file or not,
* src/avr/main.c,
* src/ds390/main.c,
* src/hc08/main.c,
* src/mcs51/main.c,
* src/pic/main.c,
* src/pic16/main.c,
* src/xa51/main.c,
* src/z80/main.c: changed appropriately to configure
needLinkerScript flag
* src/pic/gen.c,
* src/pic16/gen.c (genAddrOf): fixed bug #863624
* src/pic/glue.c: added variable udata_section_name to
override default uninitialized data segment definition for
devices only with SHAREBANK memory (reported from Erik Epetrich)
* (pic14emitOverlay): modified to emit a commented overlay segment
directive when no overlay data exist
* (picglue): modified to emit uninitialized data segment
according to udata_section_name
* src/pic/main.c (_pic14_parseOptions): added command line
options --udata-section-name=[name] to override default
udata definition name
* modified _linkCmd and _asmCmd to include compiler passed
arguments via -W option
* src/pic16/main.c: added $l in _asmCmd, changed extension for
object file from '.rel' to '.o' in port->linker structure,
changed size of fptr from 2 to 3 in port structure

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

13 files changed:
ChangeLog
src/SDCCmain.c
src/avr/main.c
src/ds390/main.c
src/hc08/main.c
src/mcs51/main.c
src/pic/gen.c
src/pic/glue.c
src/pic/main.c
src/pic16/main.c
src/port.h
src/xa51/main.c
src/z80/main.c

index 982795b5e59b6fe5e772f93548f0e8eaa0ad3bd9..fc2981a3eac934dff1999328e07d775a46b76c78 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2004-01-08 Vangelis Rokas <vrokas@otenet.gr>
+
+       * src/SDCCmain.c: removed various references to DEFAULT_PORT
+       * src/port.h: added flag needLinkerScript in port->linker
+       structure to inform whether to create a .lnk file or not,
+       * src/avr/main.c,
+       * src/ds390/main.c,
+       * src/hc08/main.c,
+       * src/mcs51/main.c,
+       * src/pic/main.c,
+       * src/pic16/main.c,
+       * src/xa51/main.c,
+       * src/z80/main.c: changed appropriately to configure
+       needLinkerScript flag
+       * src/pic/gen.c,
+       * src/pic16/gen.c (genAddrOf): fixed bug #863624
+       * src/pic/glue.c: added variable udata_section_name to
+       override default uninitialized data segment definition for
+       devices only with SHAREBANK memory (reported from Erik Epetrich)
+       * (pic14emitOverlay): modified to emit a commented overlay segment
+       directive when no overlay data exist
+       * (picglue): modified to emit uninitialized data segment
+       according to udata_section_name
+       * src/pic/main.c (_pic14_parseOptions): added command line
+       options --udata-section-name=[name] to override default
+       udata definition name
+       * modified _linkCmd and _asmCmd to include compiler passed
+       arguments via -W option
+       * src/pic16/main.c: added $l in _asmCmd, changed extension for
+       object file from '.rel' to '.o' in port->linker structure,
+       changed size of fptr from 2 to 3 in port structure
+       
 2004-01-07  Borut Razem <borut.razem@siol.net>
 
        * support/scripts/sdcc.nsi: update PATH
index 8c58faf443805b6dde216e9b15e18a2ed4cbd9fe..d864adb91a1e0b725fbf600f380fb6beceb5637c 100644 (file)
@@ -372,13 +372,7 @@ _findPort (int argc, char **argv)
     }
 
   /* Use the first in the list */
-#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 */
@@ -408,12 +402,8 @@ printVersionInfo (void)
 
   fprintf (stderr,
           "SDCC : ");
-  for (i = 0; i < NUM_PORTS; i++) {
+  for (i = 0; i < NUM_PORTS; i++)
     fprintf (stderr, "%s%s", i == 0 ? "" : "/", _ports[i]->target);
-#ifdef DEFAULT_PORT
-       fprintf(stderr, "%s", (&DEFAULT_PORT == _ports[i])?"*":"");
-#endif
-  }
   
   fprintf (stderr, " " SDCC_VERSION_STR
 #ifdef SDCC_SUB_VERSION_STR
@@ -1297,6 +1287,8 @@ linkEdit (char **envp)
   int system_ret;
   const char *s;
 
+
+  if(port->linker.needLinkerScript) {
   /* first we need to create the <filename>.lnk file */
   SNPRINTF (scratchFileName, sizeof(scratchFileName),
            "%s.lnk", dstFileName);
@@ -1538,6 +1530,7 @@ linkEdit (char **envp)
 
   fprintf (lnkfile, "\n-e\n");
   fclose (lnkfile);
+  }    /* if(port->linker.needLinkerScript) */
 
   if (options.verbose)
     printf ("sdcc: Calling linker...\n");
index b5f958cab46ea8abe66d15c373f8839fef5c2db9..25cbdb0ff7019643b7f468baf9a1a5d361f77d34 100644 (file)
@@ -194,7 +194,8 @@ PORT avr_port = {
         _linkCmd,
          NULL,
         NULL,
-        ".rel"},
+        ".rel",
+        1},
        {
         _defaultRules},
        {
index cbedd000d2af0131c52343ec98191aa02c510f79..43918804dd21308cb5cbc0662174d4590b7d2573 100644 (file)
@@ -886,7 +886,8 @@ PORT ds400_port =
     _linkCmd,
     NULL,
     NULL,
-    ".rel"
+    ".rel",
+    1
   },
   {
     _defaultRules
index 86e75757910960334e85cc174a2f8c2daf4284e0..938b8f8f51ebd4b6957c9921c2af2e6a5075dea1 100644 (file)
@@ -352,7 +352,8 @@ PORT hc08_port =
     _linkCmd,
     NULL,
     NULL,
-    ".rel"
+    ".rel",
+    1
   },
   {
     _defaultRules
index 0bf2d1141a723e8dafd6201865d7e172ce89c694..9a18499e38f42c04ad68dcf4dcb851f600af7c34 100644 (file)
@@ -291,7 +291,8 @@ PORT mcs51_port =
     _linkCmd,
     NULL,
     NULL,
-    ".rel"
+    ".rel",
+    1
   },
   {
     _defaultRules
index f8b48f8d243ca284937b96dfdb9a542947fccc0e..5eb4d55c454a84e3abd4fb10f41e7a7cdbad4353 100644 (file)
@@ -9194,8 +9194,14 @@ static void genAddrOf (iCode *ic)
   offset = 0;
 
   while (size--) {
+       /* fixing bug #863624, reported from (errolv) */
+       emitpcode(POC_MOVLW, popGetImmd(OP_SYMBOL(left)->rname, offset, 0, IS_FUNC(OP_SYM_TYPE(left))));
+       emitpcode(POC_MOVWF, popGet(AOP(result), offset));
+       
+#if 0
     emitpcode(POC_MOVLW, popGet(AOP(left),offset));
     emitpcode(POC_MOVWF, popGet(AOP(result),offset));
+#endif
     offset++;
   }
 
index 03760ffd2837c565c232568fef151b84caad8dd9..c007753353c15070c71159495b0287a43ffedf62 100644 (file)
@@ -68,6 +68,8 @@ extern void printChar (FILE * ofile, char *s, int plen);
 void  pCodeInitRegisters(void);
 int getConfigWord(int address);
 
+char *udata_section_name="udata";              // FIXME Temporary fix to change udata section name -- VR
+
 /*-----------------------------------------------------------------*/
 /* aopLiteral - string from a literal value                        */
 /*-----------------------------------------------------------------*/
@@ -643,8 +645,13 @@ pic14emitOverlay (FILE * afile)
 {
   set *ovrset;
 
-  if (!elementsInSet (ovrSetSets))
-    fprintf (afile, "\t%s\n", port->mem.overlay_name);
+/*  if (!elementsInSet (ovrSetSets))*/
+
+  /* the hack below, fixes translates for devices which
+   * only have udata_shr memory */
+  fprintf (afile, "%s\t%s\n",
+       (elementsInSet(ovrSetSets)?"":";"),
+       port->mem.overlay_name);
 
   /* for each of the sets in the overlay segment do */
   for (ovrset = setFirstItem (ovrSetSets); ovrset;
@@ -861,9 +868,9 @@ picglue ()
   copyFile (asmFile, sfr->oFile);
 
   fprintf (asmFile, "%s", iComments2);
-  fprintf (asmFile, "; udata\n");
+  fprintf (asmFile, "; %s\n", udata_section_name);
   fprintf (asmFile, "%s", iComments2);
-  fprintf (asmFile, "\tudata\n");
+  fprintf (asmFile, "\t%s\n", udata_section_name);
   copyFile (asmFile, data->oFile);
 
   /* Put all variables into a cblock */
index b3515d09d77c8f1b95b14dd4db5e0eaad261a8b0..dcb0aca0b107f5633b6ab04dca61dc7abb345c6b 100644 (file)
@@ -141,12 +141,32 @@ _process_pragma(const char *sz)
   return 1;
 }
 
+extern char *udata_section_name;
+
 static bool
 _pic14_parseOptions (int *pargc, char **argv, int *i)
 {
+  char buf[128];
+
   /* TODO: allow port-specific command line options to specify
    * segment names here.
    */
+
+       /* This is a temporary hack, to solve problems with some processors
+        * that do not have udata section. It will be changed when a more
+        * robust solution is figured out -- VR 27-11-2003 FIXME
+        */
+       strcpy(buf, "--udata-section-name");
+       if(!strncmp(buf, argv[ *i ], strlen(buf))) {
+               if(strlen(argv[ *i ]) <= strlen(buf)+1) {
+                       fprintf(stderr, "WARNING: no `%s' entered\n", buf+2);
+                       exit(-1);
+               } else {
+                       udata_section_name = strdup( strchr(argv[*i], '=') + 1 );
+               }
+               return 1;
+       }
+   
   return FALSE;
 }
 
@@ -354,12 +374,12 @@ oclsExpense (struct memmap *oclass)
 */
 static const char *_linkCmd[] =
 {
-  "gplink", "", "\"$1.o\"", NULL
+  "gplink", "-o $2", "\"$1.o\"", "$l", NULL
 };
 
 static const char *_asmCmd[] =
 {
-  "gpasm", "-c", "\"$1.asm\"", NULL
+  "gpasm", "$l", "-c", "\"$1.asm\"", NULL
 
 };
 
@@ -391,7 +411,8 @@ PORT pic_port =
     _linkCmd,
     NULL,
     NULL,
-    ".o"
+    ".o",
+    0
   },
   {
     _defaultRules
index 71cf8b2b07292b92ec095259b3a614c289eb2083..0eed2092696a7c76b8a8ca563778885f65461a4a 100644 (file)
@@ -635,7 +635,7 @@ static const char *_linkCmd[] =
  */
 static const char *_asmCmd[] =
 {
-  "gpasm", "-c  -I/usr/local/share/gputils/header", "\"$1.asm\"", NULL
+  "gpasm", "$l", "-c", "\"$1.asm\"", NULL
 
 };
 
@@ -665,7 +665,8 @@ PORT pic16_port =
     _linkCmd,                  /* linker command and arguments */
     NULL,                      /* alternate macro based form */
     NULL,                      /* no do_link function */
-    ".rel"                     /* extension for object files */
+    ".o",                      /* extension for object files */
+    0                          /* no need for linker file */
   },
   {
     _defaultRules
@@ -677,7 +678,7 @@ PORT pic16_port =
     2,         /* int */
     4,         /* long */
     2,         /* ptr */
-    2,         /* fptr, this should be changed to 3 for far pointers (see Microchip) */
+    3,         /* fptr, far pointers (see Microchip) */
     2,         /* gptr */
     1,         /* bit */
     4,         /* float */
index 3f1745ec867db93432b90590d0a9ec883243375d..9281f6630556edb75938515a690f7899060ce194 100644 (file)
@@ -104,6 +104,8 @@ typedef struct
        void (*do_link) (void);
         /** Extension for object files (.rel, .obj, ...) */
        const char *rel_ext;
+       /** 1 if port needs the .lnk file, 0 otherwise */
+       const int needLinkerScript;
       }
     linker;
 
index 3ef77a26dcbb9a3fd1625b5517b7ba5ed08eb518..4a6ffc8183c9c6826f11a4b9b4e2be5a3aa3209e 100755 (executable)
@@ -259,7 +259,8 @@ PORT xa51_port =
     _linkCmd,
     NULL,
     NULL,
-    ".rel"
+    ".rel",
+    1
   },
   {
     _defaultRules
index 82b8a78d5d23084df9efe554dbf6348ea984e350..f0a96039b74d447d2866d200e87c74d1adb4089c 100644 (file)
@@ -656,7 +656,8 @@ PORT gbz80_port =
     NULL,
     LINKCMD,
     NULL,
-    ".o"
+    ".o",
+    1
   },
   {
     _gbz80_defaultRules