* src/port.h: added TARGET_Z80_LIKE macro
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 7 Jan 2007 16:09:46 +0000 (16:09 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 7 Jan 2007 16:09:46 +0000 (16:09 +0000)
* src/SDCCmain.c (linkEdit): use TARGET_Z80_LIKE,
  output PSEG location if --xram-loc or --xstack-loc was used
* as/link/mcs51/lkarea.c (lnksect2): set segment address afterwards

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

ChangeLog
as/link/mcs51/lkarea.c
src/SDCCmain.c

index 26b9cfc260c147de84836e1dc7dbc8fde12f5971..355329793584d28743c54ca59caa73d860a12457 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
-2007-01-06 Maarten Brock <sourceforge.brock AT dse.nl>
+2007-01-07 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * src/port.h: added TARGET_Z80_LIKE macro
+       * src/SDCCmain.c (linkEdit): use TARGET_Z80_LIKE,
+         output PSEG location if --xram-loc or --xstack-loc was used
+       * as/link/mcs51/lkarea.c (lnksect2): set segment address afterwards
+
+2007-01-07 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * as/as_gbz80.dsp, as/z80/as_gbz80.dsp,
        * as/as_z80.dsp,   as/z80/as_z80.dsp,
index 58f96c1d71dd81c418f7ea992b4099d7ceac39fe..3fb5963cdd4fbb63248e8fbbec3323128587b647 100644 (file)
@@ -1080,6 +1080,7 @@ Addr_T lnksect2 (struct area *tap, int locIndex)
         }
     }
     tap->a_size = size;
+    tap->a_addr = tap->a_axp->a_addr;
 
     if ((tap->a_flag&A_PAG) && (size > 256))
     {
index 8e9f367ffaae8c2ecbe8e201d278cc86200ab663..8cb6954b63add725be2b44154093529f8767fa5c 100644 (file)
@@ -256,7 +256,7 @@ optionsTable[] = {
     { 0,    OPTION_XRAM_LOC,        NULL, "<nnnn> External Ram start location" },
     { 0,    OPTION_XRAM_SIZE,       NULL, "<nnnn> External Ram size" },
     { 0,    OPTION_IRAM_SIZE,       NULL, "<nnnn> Internal Ram size" },
-    { 0,    OPTION_XSTACK_LOC,      NULL, "<nnnn> External Ram start location" },
+    { 0,    OPTION_XSTACK_LOC,      NULL, "<nnnn> External Stack start location" },
     { 0,    OPTION_CODE_LOC,        NULL, "<nnnn> Code Segment Location" },
     { 0,    OPTION_CODE_SIZE,       NULL, "<nnnn> Code Segment size" },
     { 0,    OPTION_STACK_LOC,       NULL, "<nnnn> Stack pointer initial value" },
@@ -645,7 +645,7 @@ processFile (char *s)
           /* is the dot in the filename, not in the path? */
           (strrchr (buffer, DIR_SEPARATOR_CHAR) < strrchr (buffer, '.')))
         {
-        *strrchr (buffer, '.') = '\0';
+          *strrchr (buffer, '.') = '\0';
         }
 
       /* get rid of any path information
@@ -658,7 +658,7 @@ processFile (char *s)
              *(fext - 1) != DIR_SEPARATOR_CHAR &&
              *(fext - 1) != ':')
         {
-        fext--;
+          fext--;
         }
 #else
       /* do this by going backwards till we
@@ -1497,7 +1497,7 @@ linkEdit (char **envp)
           exit (1);
         }
 
-      if (TARGET_IS_Z80 || TARGET_IS_GBZ80)
+      if (TARGET_Z80_LIKE)
         {
           fprintf (lnkfile, "--\n-m\n-j\n-x\n-%c %s\n",
             out_fmt, dstFileName);
@@ -1509,7 +1509,7 @@ linkEdit (char **envp)
               fprintf (lnkfile, "-Y\n");
         }
 
-      if (!(TARGET_IS_Z80 || TARGET_IS_GBZ80)) /*Not for the z80, gbz80*/
+      if (!(TARGET_Z80_LIKE)) /*Not for the z80, gbz80*/
         {
           /* if iram size specified */
           if (options.iram_size)
@@ -1537,7 +1537,7 @@ linkEdit (char **envp)
   fprintf (lnkfile,"-b %s = 0x%04x\n", c, L); \
   if (segName) { Safe_free(segName); }
 
-      if (!(TARGET_IS_Z80 || TARGET_IS_GBZ80)) /*Not for the z80, gbz80*/
+      if (!(TARGET_Z80_LIKE)) /*Not for the z80, gbz80*/
         {
 
           /* code segment start */
@@ -1557,6 +1557,13 @@ linkEdit (char **envp)
               WRITE_SEG_LOC (XDATA_NAME, options.xdata_loc);
             }
 
+          /* pdata/xstack segment start. If zero, the linker
+             chooses the best place for them */
+          if (options.xstack_loc)
+            {
+              WRITE_SEG_LOC (PDATA_NAME, options.xstack_loc);
+            }
+
           /* indirect data */
           if (IDATA_NAME)
             {
@@ -1595,7 +1602,7 @@ linkEdit (char **envp)
       /* standard library path */
       if (!options.nostdlib)
         {
-          if (!(TARGET_IS_Z80 || TARGET_IS_GBZ80 || TARGET_IS_HC08)) /*Not for the z80, gbz80*/
+          if (!(TARGET_Z80_LIKE || TARGET_IS_HC08)) /*Not for the z80, gbz80*/
             {
               switch (options.model)
                 {
@@ -1697,8 +1704,7 @@ linkEdit (char **envp)
             {
               fprintf (lnkfile, "-l mcs51\n");
             }
-          if (!(TARGET_IS_Z80 || TARGET_IS_GBZ80
-            || TARGET_IS_HC08)) /*Not for the z80, gbz80*/
+          if (!(TARGET_Z80_LIKE || TARGET_IS_HC08)) /*Not for the z80, gbz80*/
             { /*Why the z80 port is not using the standard libraries?*/
               fprintf (lnkfile, "-l %s\n", STD_LIB);
               fprintf (lnkfile, "-l %s\n", STD_INT_LIB);
@@ -1722,8 +1728,7 @@ linkEdit (char **envp)
       /*For the z80 and gbz80 ports, try to find where crt0.o is...
       It is very important for this file to be first on the linking proccess
       so the areas are set in the correct order, expecially _GSINIT*/
-      if ((TARGET_IS_Z80 || TARGET_IS_GBZ80) &&
-        !options.no_std_crt0) /*For the z80, gbz80*/
+      if ((TARGET_Z80_LIKE) && !options.no_std_crt0) /*For the z80, gbz80*/
         {
           char crt0path[PATH_MAX];
           FILE * crt0fp;