From 13bf359670b5c5c6177ed673e2f39f7929a5bb8b Mon Sep 17 00:00:00 2001 From: MaartenBrock Date: Sun, 7 Jan 2007 16:09:46 +0000 Subject: [PATCH] * 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 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4561 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 9 ++++++++- as/link/mcs51/lkarea.c | 1 + src/SDCCmain.c | 27 ++++++++++++++++----------- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 26b9cfc2..35532979 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ -2007-01-06 Maarten Brock +2007-01-07 Maarten Brock + + * 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 * as/as_gbz80.dsp, as/z80/as_gbz80.dsp, * as/as_z80.dsp, as/z80/as_z80.dsp, diff --git a/as/link/mcs51/lkarea.c b/as/link/mcs51/lkarea.c index 58f96c1d..3fb5963c 100644 --- a/as/link/mcs51/lkarea.c +++ b/as/link/mcs51/lkarea.c @@ -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)) { diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 8e9f367f..8cb6954b 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -256,7 +256,7 @@ optionsTable[] = { { 0, OPTION_XRAM_LOC, NULL, " External Ram start location" }, { 0, OPTION_XRAM_SIZE, NULL, " External Ram size" }, { 0, OPTION_IRAM_SIZE, NULL, " Internal Ram size" }, - { 0, OPTION_XSTACK_LOC, NULL, " External Ram start location" }, + { 0, OPTION_XSTACK_LOC, NULL, " External Stack start location" }, { 0, OPTION_CODE_LOC, NULL, " Code Segment Location" }, { 0, OPTION_CODE_SIZE, NULL, " Code Segment size" }, { 0, OPTION_STACK_LOC, NULL, " 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; -- 2.30.2