Added options --code-size and --xram-size
authorjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 29 Jan 2003 09:00:29 +0000 (09:00 +0000)
committerjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 29 Jan 2003 09:00:29 +0000 (09:00 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2188 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCglobl.h
src/SDCCmain.c

index f9dd2453970545a20c2e3faa11c95615068c7709..a7e4a5885b796f02989569862873b766d7f21d31 100644 (file)
@@ -250,6 +250,8 @@ struct options
     int idata_loc;             /* indirect address space        */
     int code_loc;              /* code location start           */
     int iram_size;             /* internal ram size (used only for error checking) */    
+    int xram_size;             /* external ram size (used only for error checking) */    
+    int code_size;             /* code size (used only for error checking) */    
   };
 
 /* forward definition for variables accessed globally */
index 56000da999e1e1b825678a20daac41b605934869..aeb55706020a23b77f02dd5b1605bdb31e4a274d 100644 (file)
@@ -122,6 +122,8 @@ char DefaultExePath[128];
 #define OPTION_SHORT_IS_8BITS  "--short-is-8bits"
 #define OPTION_TINI_LIBID      "--tini-libid"
 #define OPTION_NO_XINIT_OPT     "--no-xinit-opt"
+#define OPTION_XRAM_SIZE       "--xram-size"
+#define OPTION_CODE_SIZE       "--code-size"
 
 static const OPTION 
 optionsTable[] = {
@@ -164,9 +166,11 @@ optionsTable[] = {
     { 0,    "--dumptree",           &options.dump_tree, "dump front-end AST before generating iCode" },
     { 0,    OPTION_DUMP_ALL,        NULL, "Dump the internal structure at all stages" },
     { 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_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" },
     { 0,    OPTION_DATA_LOC,        NULL, "<nnnn> Direct data start location" },
     { 0,    OPTION_IDATA_LOC,       NULL, NULL },
@@ -903,6 +907,18 @@ parseCmdLine (int argc, char **argv)
                 continue;
            }
 
+         if (strcmp (argv[i], OPTION_XRAM_SIZE) == 0)
+           {
+                options.xram_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
+                continue;
+           }
+
+         if (strcmp (argv[i], OPTION_CODE_SIZE) == 0)
+           {
+                options.code_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
+                continue;
+           }
+
          if (strcmp (argv[i], OPTION_DATA_LOC) == 0)
            {
                 options.data_loc = getIntArg(OPTION_DATA_LOC, argv, &i, argc);
@@ -1211,6 +1227,14 @@ linkEdit (char **envp)
   if (options.iram_size)
     fprintf (lnkfile, "-a 0x%04x\n", options.iram_size);
 
+  /* if xram size specified */
+  if (options.xram_size)
+    fprintf (lnkfile, "-v 0x%04x\n", options.xram_size);
+
+  /* if code size specified */
+  if (options.code_size)
+    fprintf (lnkfile, "-w 0x%04x\n", options.code_size);
+
   if (options.debug)
     fprintf (lnkfile, "-z\n");