* src/SDCCmain.c (optionsTable): accept --stack-size for PICs,
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 10 Oct 2006 19:59:16 +0000 (19:59 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 10 Oct 2006 19:59:16 +0000 (19:59 +0000)
* src/pic/device.c (pic14_getSharebankSize,pic14_getSharebankAddress),
* src/pic/main.c (_pic14_parseOptions),
* src/pic/main.h: mostly reverted to previous state, now use results
    from SDCCmain.c's argument parsing

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

ChangeLog
src/SDCCmain.c
src/pic/device.c
src/pic/main.c
src/pic/main.h

index 13ded01b54a2d7fd01fa55ac60d3d8c51e0a0067..d5732d6245adcb11194a9bb31409634540b1ce02 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-10-10 Raphael Neider <rneider AT web.de>
+
+       * src/SDCCmain.c (optionsTable): accept --stack-size for PICs,
+       * src/pic/device.c (pic14_getSharebankSize,pic14_getSharebankAddress),
+       * src/pic/main.c (_pic14_parseOptions),
+       * src/pic/main.h: mostly reverted to previous state, now use results
+           from SDCCmain.c's argument parsing
+
 2006-10-10 Borut Razem <borut.razem AT siol.net>
 
        * debugger/mcs51/break.[ch], debugger/mcs51/cmd.c,
@@ -13,8 +21,8 @@
        * device/include/pic18fregs.h,
        * device/lib/pic16/pics.all,
        * device/lib/pic16/libdev/pic18f[24]{620,525}.c): added support for
-         18f2620, 18f4620, 18f2525, and 18f4525 devices, thanks to
-         Gary Plumbridge and Anton Strobl
+           18f2620, 18f4620, 18f2525, and 18f4525 devices, thanks to
+           Gary Plumbridge and Anton Strobl
 
 2006-10-10 Raphael Neider <rneider AT web.de>
 
index df97f51128c663943e0ddda21d1c76d3db7209f9..bda46576b197790ece30512e87766d0db353215a 100644 (file)
@@ -262,8 +262,10 @@ optionsTable[] = {
     { 0,    OPTION_STACK_LOC,       NULL, "<nnnn> Stack pointer initial value" },
     { 0,    OPTION_DATA_LOC,        NULL, "<nnnn> Direct data start location" },
     { 0,    OPTION_IDATA_LOC,       NULL, NULL },
+#if !OPT_DISABLE_DS390 || !OPT_DISABLE_MCS51 || !OPT_DISABLE_PIC
+    { 0,    OPTION_STACK_SIZE,      NULL,"MCS51/DS390/PIC - Tells the linker to allocate this space for stack"},
+#endif
 #if !OPT_DISABLE_DS390 || !OPT_DISABLE_MCS51
-    { 0,    OPTION_STACK_SIZE,      NULL,"MCS51/DS390 - Tells the linker to allocate this space for stack"},
     { 0,    OPTION_PACK_IRAM,       NULL,"MCS51/DS390 - Tells the linker to pack variables in internal ram (default)"},
     { 0,    OPTION_NO_PACK_IRAM,    &options.no_pack_iram,"MCS51/DS390 - Tells the linker not to pack variables in internal ram"},
 #endif
index 9cfdb553340199570258ee84ce1c77914e7bfa2e..5546e1f182b73fac97d9aa5a7984d7c92cae52b2 100644 (file)
@@ -1026,11 +1026,11 @@ int pic14_getHasSecondConfigReg(void)
  *-----------------------------------------------------------------*/
 int pic14_getSharebankSize(void)
 {
-       if (pic14_options.stackSize <= 0) {
+       if (options.stack_size <= 0) {
                // default size: 16 bytes
                return 16;
        } else {
-               return pic14_options.stackSize;
+               return options.stack_size;
        }
 }
 
@@ -1044,7 +1044,7 @@ int pic14_getSharebankSize(void)
 int pic14_getSharebankAddress(void)
 {
        int sharebankAddress = 0x7f;
-       if (pic14_options.stackLocation != 0) {
+       if (options.stack_loc != 0) {
            // permanent (?) workaround for pic16f84a-like devices with hardly
            // any memory:
            // 0x00-0x0B SFR
@@ -1052,7 +1052,7 @@ int pic14_getSharebankAddress(void)
            // 0x50-0x7F unimplemented (reads as 0),
            // 0x80-0x8B SFRs (partly mapped to 0x0?)
            // 0x8c-0xCF mapped to 0x0C-0x4F
-           sharebankAddress = pic14_options.stackLocation + pic14_getSharebankSize() - 1;
+           sharebankAddress = options.stack_loc + pic14_getSharebankSize() - 1;
        } else {
            /* If total RAM is less than 0x7f as with 16f84 then reduce
             * sharebankAddress to fit */
index 71d8ad89c0f17a31ce8c62a5b2e477b88a7ef36d..37a2b40a82bd9f0b80f70d6c15ccb3041cc64765 100644 (file)
@@ -53,14 +53,14 @@ static char *_pic14_keywords[] =
 pic14_options_t pic14_options;
 
 #define ARG_STACKLOC   "--stack-loc"
-#define ARG_STACKSIZ   "--stack-siz"
+#define ARG_STACKSIZ   "--stack-size"
 
 extern int debug_verbose;      /* from pcode.c */
 static OPTION _pic14_poptions[] = {
        { 0 , "--debug-xtra", &debug_verbose, "show more debug info in assembly output" },
        { 0 , "--no-pcode-opt", &pic14_options.disable_df, "disable (slightly faulty) optimization on pCode" },
-       { 0 , ARG_STACKLOC, &pic14_options.stackLocation, "sets the lowest address of the argument passing stack" },
-       { 0 , ARG_STACKSIZ, &pic14_options.stackSize, "sets the size if the argument passing stack (default: 16, minimum: 4)" },
+       { 0 , ARG_STACKLOC, NULL, "sets the lowest address of the argument passing stack" },
+       { 0 , ARG_STACKSIZ, NULL, "sets the size if the argument passing stack (default: 16, minimum: 4)" },
        { 0 , NULL, NULL, NULL }
 };
 
@@ -159,7 +159,6 @@ static bool
 _pic14_parseOptions (int *pargc, char **argv, int *i)
 {
        char buf[128];
-       int len;
        
        /* TODO: allow port-specific command line options to specify
        * segment names here.
@@ -180,37 +179,6 @@ _pic14_parseOptions (int *pargc, char **argv, int *i)
                return 1;
        }
 
-       len = strlen(ARG_STACKLOC);
-       if (!strncmp(ARG_STACKLOC, argv[ *i ], len)) {
-               if (argv[*i][len] != '=' || argv[*i][len+1] == 0) {
-                   printf("ERROR: no number entered for %s=num\n", ARG_STACKLOC);
-                   exit(EXIT_FAILURE);
-               }
-               // extract number from "--stack-loc=0x70"
-               pic14_options.stackLocation = strtol(argv[ *i ] + len + 1, NULL, 0);
-
-               if (errno) {
-                   printf("ERROR: Could not parse number after %s=num\n", ARG_STACKLOC);
-                   exit(EXIT_FAILURE);
-               }
-               return 1;
-       }
-
-       len = strlen(ARG_STACKLOC);
-       if (!strncmp(ARG_STACKSIZ, argv[*i], len)) {
-               if (argv[*i][len] != '=' || argv[*i][len+1] == 0) {
-                   printf("ERROR: no number entered for %s=num\n", ARG_STACKSIZ);
-                   exit(EXIT_FAILURE);
-               }
-               // extract number from "--stack-size=16"
-               pic14_options.stackSize = strtol(argv[ *i ] + len + 1, NULL, 0);
-               if (errno) {
-                   printf("ERROR: Could not parse number after %s=num\n", ARG_STACKLOC);
-                   exit(EXIT_FAILURE);
-               }
-               return 1;
-       }
-
        return FALSE;
 }
 
index b84b42a808ab2eaaa633604bc7139e6a991ad8fa..da5f40a1d26ae24593aa3e27bb2aebb935aa2e10 100644 (file)
@@ -4,8 +4,6 @@
 typedef struct {
   unsigned int isLibrarySource:1;
   int disable_df;
-  int stackLocation;
-  int stackSize;
 } pic14_options_t;
 
 extern pic14_options_t pic14_options;