virtualization of glue() function: each port has it's own glue function,
[fw/sdcc] / src / pic / main.c
index 5c997639473249d599b91c5151222623d4ec4bc2..66b235187a86df0625dcaaaa0a60beccd0b9952c 100644 (file)
@@ -9,6 +9,7 @@
 #include "ralloc.h"
 #include "device.h"
 #include "SDCCutil.h"
+#include "glue.h"
 //#include "gen.h"
 
 
@@ -239,7 +240,6 @@ _pic14_genAssemblerPreamble (FILE * of)
   }
 
   fprintf (of, "\tlist\tp=%s\n",&name[1]);
-  fprintf (of, "\t__CONFIG 0x%x\n",getConfigWord(0x2007));
   fprintf (of, "\tradix dec");
   fprintf (of, "\ninclude \"%s.inc\"\n",name);
 }
@@ -277,8 +277,10 @@ _pic14_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
 static bool
 _hasNativeMulFor (iCode *ic, sym_link *left, sym_link *right)
 {
+/*
   sym_link *test = NULL;
   value *val;
+*/
 
   fprintf(stderr,"checking for native mult\n");
 
@@ -326,16 +328,12 @@ _hasNativeMulFor (iCode *ic, sym_link *left, sym_link *right)
 */
 static const char *_linkCmd[] =
 {
-  "aslink", "-nf", "$1", NULL
+  "gplink", "", "\"$1.o\"", NULL
 };
 
-/* Sigh. This really is not good. For now, I recommend:
- * sdcc -S -mpic14 file.c
- * the -S option does not compile or link
- */
 static const char *_asmCmd[] =
 {
-  "gpasm", "-c  -I /usr/local/share/gpasm/header", "$1.asm", NULL
+  "gpasm", "-c", "\"$1.asm\"", NULL
 
 };
 
@@ -345,8 +343,9 @@ PORT pic_port =
   TARGET_ID_PIC,
   "pic14",
   "MCU pic",                   /* Target name */
-  "p16f877",                    /* Processor */
+  "",                    /* Processor */
   {
+    picglue,
     TRUE,                      /* Emit glue around main */
     MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
     MODEL_SMALL
@@ -366,7 +365,7 @@ PORT pic_port =
     _linkCmd,
     NULL,
     NULL,
-    ".rel"
+    ".o"
   },
   {
     _defaultRules
@@ -382,14 +381,14 @@ PORT pic_port =
   {
     "XSEG    (XDATA)",
     "STACK   (DATA)",
-    "CSEG    (CODE)",
+    "code",
     "DSEG    (DATA)",
     "ISEG    (DATA)",
     "XSEG    (XDATA)",
     "BSEG    (BIT)",
     "RSEG    (DATA)",
     "GSINIT  (CODE)",
-    "OSEG    (OVR,DATA)",
+    "udata_ovr",
     "GSFINAL (CODE)",
     "HOME       (CODE)",
     NULL, // xidata
@@ -398,6 +397,7 @@ PORT pic_port =
     NULL,
     1        // code is read only
   },
+  { NULL, NULL },
   {
     +1, 1, 4, 1, 1, 0
   },