From 4aaeb0f34f305307c495ba6ce9c25eb492f131c1 Mon Sep 17 00:00:00 2001 From: vrokas Date: Thu, 8 Jan 2004 16:08:03 +0000 Subject: [PATCH] 2004-01-08 Vangelis Rokas * 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 --- ChangeLog | 32 ++++++++++++++++++++++++++++++++ src/SDCCmain.c | 15 ++++----------- src/avr/main.c | 3 ++- src/ds390/main.c | 3 ++- src/hc08/main.c | 3 ++- src/mcs51/main.c | 3 ++- src/pic/gen.c | 6 ++++++ src/pic/glue.c | 15 +++++++++++---- src/pic/main.c | 27 ++++++++++++++++++++++++--- src/pic16/main.c | 7 ++++--- src/port.h | 2 ++ src/xa51/main.c | 3 ++- src/z80/main.c | 3 ++- 13 files changed, 95 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 982795b5..fc2981a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2004-01-08 Vangelis Rokas + + * 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 * support/scripts/sdcc.nsi: update PATH diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 8c58faf4..d864adb9 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -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 .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"); diff --git a/src/avr/main.c b/src/avr/main.c index b5f958ca..25cbdb0f 100644 --- a/src/avr/main.c +++ b/src/avr/main.c @@ -194,7 +194,8 @@ PORT avr_port = { _linkCmd, NULL, NULL, - ".rel"}, + ".rel", + 1}, { _defaultRules}, { diff --git a/src/ds390/main.c b/src/ds390/main.c index cbedd000..43918804 100644 --- a/src/ds390/main.c +++ b/src/ds390/main.c @@ -886,7 +886,8 @@ PORT ds400_port = _linkCmd, NULL, NULL, - ".rel" + ".rel", + 1 }, { _defaultRules diff --git a/src/hc08/main.c b/src/hc08/main.c index 86e75757..938b8f8f 100644 --- a/src/hc08/main.c +++ b/src/hc08/main.c @@ -352,7 +352,8 @@ PORT hc08_port = _linkCmd, NULL, NULL, - ".rel" + ".rel", + 1 }, { _defaultRules diff --git a/src/mcs51/main.c b/src/mcs51/main.c index 0bf2d114..9a18499e 100644 --- a/src/mcs51/main.c +++ b/src/mcs51/main.c @@ -291,7 +291,8 @@ PORT mcs51_port = _linkCmd, NULL, NULL, - ".rel" + ".rel", + 1 }, { _defaultRules diff --git a/src/pic/gen.c b/src/pic/gen.c index f8b48f8d..5eb4d55c 100644 --- a/src/pic/gen.c +++ b/src/pic/gen.c @@ -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++; } diff --git a/src/pic/glue.c b/src/pic/glue.c index 03760ffd..c0077533 100644 --- a/src/pic/glue.c +++ b/src/pic/glue.c @@ -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 */ diff --git a/src/pic/main.c b/src/pic/main.c index b3515d09..dcb0aca0 100644 --- a/src/pic/main.c +++ b/src/pic/main.c @@ -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 diff --git a/src/pic16/main.c b/src/pic16/main.c index 71cf8b2b..0eed2092 100644 --- a/src/pic16/main.c +++ b/src/pic16/main.c @@ -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 */ diff --git a/src/port.h b/src/port.h index 3f1745ec..9281f663 100644 --- a/src/port.h +++ b/src/port.h @@ -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; diff --git a/src/xa51/main.c b/src/xa51/main.c index 3ef77a26..4a6ffc81 100755 --- a/src/xa51/main.c +++ b/src/xa51/main.c @@ -259,7 +259,8 @@ PORT xa51_port = _linkCmd, NULL, NULL, - ".rel" + ".rel", + 1 }, { _defaultRules diff --git a/src/z80/main.c b/src/z80/main.c index 82b8a78d..f0a96039 100644 --- a/src/z80/main.c +++ b/src/z80/main.c @@ -656,7 +656,8 @@ PORT gbz80_port = NULL, LINKCMD, NULL, - ".o" + ".o", + 1 }, { _gbz80_defaultRules -- 2.47.2