X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCmain.c;h=3b5324f6f60b3e93a91f756b782945f8cadc5a0c;hb=399531764ce77f640d4ba9dffed78b059363d422;hp=0a68ebb8401f26634fa38a6c66e82a9b37714f70;hpb=074adb199c4ec2a893012872d5020427a262f59c;p=fw%2Fsdcc diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 0a68ebb8..3b5324f6 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -306,7 +306,7 @@ static const char *_baseValues[] = { NULL }; -static const char *_preCmd = "{cpp} -nostdinc -Wall -std=c99 -DSDCC=1 {cppextraopts} \"{fullsrcfilename}\" \"{cppoutfilename}\""; +static const char *_preCmd = "{cpp} -nostdinc -Wall -std=c99 {cppextraopts} \"{fullsrcfilename}\" \"{cppoutfilename}\""; PORT *port; @@ -376,7 +376,6 @@ static void _setProcessor (char *_processor) { port->processor = _processor; - fprintf(stderr,"Processor: %s\n",_processor); } static void @@ -413,7 +412,7 @@ _findPort (int argc, char **argv) } /* Use the first in the list */ - port = _ports[0]; + port = _ports[0]; } /* search through the command line options for the processor */ @@ -999,14 +998,14 @@ parseCmdLine (int argc, char **argv) if (strcmp (argv[i], OPTION_XRAM_SIZE) == 0) { - options.xram_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc); + options.xram_size = getIntArg(OPTION_XRAM_SIZE, argv, &i, argc); options.xram_size_set = TRUE; continue; } if (strcmp (argv[i], OPTION_CODE_SIZE) == 0) { - options.code_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc); + options.code_size = getIntArg(OPTION_CODE_SIZE, argv, &i, argc); continue; } @@ -1579,13 +1578,22 @@ linkEdit (char **envp) switch (options.model) { case MODEL_SMALL: - c = "small"; + if (options.stackAuto) + c = "small-stack-auto"; + else + c = "small"; break; case MODEL_MEDIUM: - c = "medium"; + if (options.stackAuto) + c = "medium-stack-auto"; + else + c = "medium"; break; case MODEL_LARGE: - c = "large"; + if (options.stackAuto) + c = "large-stack-auto"; + else + c = "large"; break; case MODEL_FLAT24: /* c = "flat24"; */ @@ -1778,7 +1786,7 @@ linkEdit (char **envp) set *tempSet=NULL, *libSet=NULL; strcpy(buffer3, linkerScriptFileName); - if(TARGET_IS_PIC16 || TARGET_IS_PIC) { + if(/*TARGET_IS_PIC16 ||*/ TARGET_IS_PIC) { /* use $l to set the linker include directories */ tempSet = appendStrSet(libDirsSet, "-I\"", "\""); @@ -1955,6 +1963,16 @@ preProcess (char **envp) const char *s; set *inclList = NULL; + if (NULL != port->linker.rel_ext) + { +#define OBJ_EXT_STR "-obj-ext=" +#define OBJ_EXT_LEN ((sizeof OBJ_EXT_STR) - 1) + char *buf = Safe_alloc(strlen(port->linker.rel_ext) + (OBJ_EXT_LEN + 1)); + strcpy(buf, OBJ_EXT_STR); + strcpy(&buf[OBJ_EXT_LEN], port->linker.rel_ext); + addSet(&preArgvSet, buf); + } + /* if using external stack define the macro */ if (options.useXstack) addSet(&preArgvSet, Safe_strdup("-DSDCC_USE_XSTACK")); @@ -1997,6 +2015,14 @@ preProcess (char **envp) break; } + /* add SDCC version number */ + { + char buf[20]; + SNPRINTF(buf, sizeof(buf), "-DSDCC=%d%d%d", + SDCC_VERSION_HI, SDCC_VERSION_LO, SDCC_VERSION_P); + addSet(&preArgvSet, Safe_strdup(buf)); + } + /* add port (processor information to processor */ addSet(&preArgvSet, Safe_strdup("-DSDCC_{port}")); addSet(&preArgvSet, Safe_strdup("-D__{port}")); @@ -2025,7 +2051,6 @@ preProcess (char **envp) if (options.verbose) printf ("sdcc: Calling preprocessor...\n"); - buildCmdLine2 (buffer, sizeof(buffer), _preCmd); if (preProcOnly) { @@ -2072,13 +2097,6 @@ setBinPaths(const char *argv0) SNPRINTF(buf, sizeof buf, "%s" PREFIX2BIN_DIR, p); addSetHead(&binPathSet, Safe_strdup(buf)); } - -#if 0 - if (options.printSearchDirs) { - printf("programs:\n"); - fputStrSet(stdout, binPathSet); - } -#endif } /* Set system include path */ @@ -2122,13 +2140,6 @@ setIncludePath(void) addSetHead(&includeDirsSet, p2); } } - -#if 0 - if (options.printSearchDirs) { - printf("includedir:\n"); - fputStrSet(stdout, includeDirsSet); - } -#endif } /* Set system lib path */ @@ -2153,13 +2164,6 @@ setLibPath(void) if ((p = getenv(SDCC_LIB_NAME)) != NULL) addSetHead(&libDirsSet, p); - -#if 0 - if (options.printSearchDirs) { - printf("libdir:\n"); - fputStrSet(stdout, libDirsSet); - } -#endif } /* Set data path */ @@ -2196,13 +2200,6 @@ setDataPaths(const char *argv0) addSet(&dataDirsSet, Safe_strdup(DATADIR)); #endif -#if 0 - if (options.printSearchDirs) { - printf("datadir:\n"); - fputStrSet(stdout, dataDirsSet); - } -#endif - setIncludePath(); setLibPath(); } @@ -2325,7 +2322,7 @@ main (int argc, char **argv, char **envp) #ifdef JAMIN_DS390 if (strcmp(port->target, "mcs51") == 0) { printf("DS390 jammed in A\n"); - _setPort ("ds390"); + _setPort ("ds390"); ds390_jammed = 1; } #endif @@ -2343,8 +2340,12 @@ main (int argc, char **argv, char **envp) options.stack10bit=0; } #endif + parseCmdLine (argc, argv); + if (options.verbose && NULL != port->processor) + printf("Processor: %s\n", port->processor); + initValues (); setBinPaths(argv[0]); @@ -2426,6 +2427,9 @@ main (int argc, char **argv, char **envp) !options.c1mode && (fullSrcFileName || peekSet(relFilesSet) != NULL)) { + if (options.verbose) + printf ("sdcc: Calling linker...\n"); + if (port->linker.do_link) port->linker.do_link (); else