src/SDCCglobl.h, src/SDCCpeeph.c, src/mcs51/main.c, src/mcs51/peeph.def: Added option...
[fw/sdcc] / src / mcs51 / main.c
index 2307724fcf8286e9b5d548ca79e0165b520960ba..5f378965e9976fb07f1cdfbfc097134af1525cf6 100644 (file)
@@ -8,6 +8,7 @@
 #include "main.h"
 #include "ralloc.h"
 #include "gen.h"
+#include "dbuf_string.h"
 #include "../SDCCutil.h"
 
 static char _defaultRules[] =
@@ -15,6 +16,18 @@ static char _defaultRules[] =
 #include "peeph.rul"
 };
 
+#define OPTION_STACK_SIZE       "--stack-size"
+
+static OPTION _mcs51_options[] =
+  {
+    { 0, OPTION_STACK_SIZE,  &options.stack_size, "Tells the linker to allocate this space for stack", CLAT_INTEGER },
+    { 0, "--parms-in-bank1", &options.parms_in_bank1, "use Bank1 for parameter passing"},
+    { 0, "--pack-iram",      NULL, "Tells the linker to pack variables in internal ram (default)"},
+    { 0, "--no-pack-iram",   &options.no_pack_iram, "Tells the linker not to pack variables in internal ram"},
+    { 0, "--acall-ajmp",     &options.acall_ajmp, "Use acall/ajmp instead of lcall/ljmp" },
+    { 0, NULL }
+  };
+
 /* list of key words used by msc51 */
 static char *_mcs51_keywords[] =
 {
@@ -175,26 +188,26 @@ _mcs51_genAssemblerPreamble (FILE * of)
 
 /* Generate interrupt vector table. */
 static int
-_mcs51_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
+_mcs51_genIVT (struct dbuf_s * oBuf, symbol ** interrupts, int maxInterrupts)
 {
   int i;
 
-  fprintf (of, "\tljmp\t__sdcc_gsinit_startup\n");
+  dbuf_printf (oBuf, "\tljmp\t__sdcc_gsinit_startup\n");
 
   /* now for the other interrupts */
   for (i = 0; i < maxInterrupts; i++)
     {
       if (interrupts[i])
         {
-          fprintf (of, "\tljmp\t%s\n", interrupts[i]->rname);
+          dbuf_printf (oBuf, "\tljmp\t%s\n", interrupts[i]->rname);
           if ( i != maxInterrupts - 1 )
-            fprintf (of, "\t.ds\t5\n");
+            dbuf_printf (oBuf, "\t.ds\t5\n");
         }
       else
         {
-          fprintf (of, "\treti\n");
+          dbuf_printf (oBuf, "\treti\n");
           if ( i != maxInterrupts - 1 )
-            fprintf (of, "\t.ds\t7\n");
+            dbuf_printf (oBuf, "\t.ds\t7\n");
         }
     }
   return TRUE;
@@ -789,7 +802,7 @@ PORT mcs51_port =
   "_",
   _mcs51_init,
   _mcs51_parseOptions,
-  NULL,
+  _mcs51_options,
   NULL,
   _mcs51_finaliseOptions,
   _mcs51_setDefaultOptions,