]> git.gag.com Git - fw/sdcc/commitdiff
TSD PIC port
authorsdattalo <sdattalo@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 4 Dec 2000 07:31:12 +0000 (07:31 +0000)
committersdattalo <sdattalo@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 4 Dec 2000 07:31:12 +0000 (07:31 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@513 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCmain.c
src/pic/glue.c
src/pic/main.c
src/port.h
src/regression/Makefile

index ffb05361ba28aef9b10a3943e9ee79eb5b153cf6..9ae9871d39cb0cc80f91dd458ee4e6b1ea2399b9 100644 (file)
@@ -146,10 +146,18 @@ static PORT *_ports[] = {
 #if !OPT_DISABLE_DS390
     &ds390_port,
 #endif
+#if !OPT_DISABLE_PIC
+    &pic14_port,
+#endif
 };
 
 #define NUM_PORTS (sizeof(_ports)/sizeof(_ports[0]))
 
+/**
+   remove me - TSD a hack to force sdcc to generate gpasm format .asm files.
+ */
+extern void             pic14glue();
+
 /** Sets the port to the one given by the command line option.
     @param             The name minus the option (eg 'mcs51')
     @return            0 on success.
@@ -1391,6 +1399,9 @@ int main ( int argc, char **argv , char **envp)
 
        if (!fatalError) 
        {
+         if(IS_PIC_PORT)
+           pic14glue();
+         else
            glue();
            if (fatalError)
            {
index f06e3467888d3f1c21d614feb69d70b870242e06..59d53c9e8e7ba40cce5ae6b5df3fd29f8b3e9512 100644 (file)
@@ -191,7 +191,7 @@ static void pic14emitRegularMap (memmap * map, bool addPublics, bool arFlag)
            if (IS_AGGREGATE (sym->type))
                ival = initAggregates (sym, sym->ival, NULL);
            else
-               ival = newNode ('=', newAst (EX_VALUE, symbolVal (sym)),
+               ival = newNode ('=', newAst_VALUE(symbolVal (sym)),
                                decorateType (resolveSymbols (list2expr (sym->ival))));
            codeOutFile = statsg->oFile;
            eBBlockFromiCode (iCodeFromAst (ival));
index 7d37f3210eef18243b84faf9b02b19b1b77bb93f..7fde90c9b0d0213985dce53adee20a076d84e097 100644 (file)
@@ -14,7 +14,7 @@ static char _defaultRules[] =
 #include "peeph.rul"
 };
 
-/* list of key words used by pic14 */
+/* list of key words used by msc51 */
 static char *_pic14_keywords[] =     {
     "at",
     "bit",
@@ -46,6 +46,11 @@ void pic14_assignRegisters (eBBlock **ebbs, int count);
 
 static int regParmFlg = 0; /* determine if we can register a parameter */
 
+static void _pic14_init(void)
+{
+    asm_addTree(&asm_asxxxx_mapping);
+}
+
 static void _pic14_reset_regparm()
 {
     regParmFlg = 0;
@@ -77,6 +82,11 @@ static void _pic14_finaliseOptions(void)
      */
     if (options.model == MODEL_FLAT24)
     {
+       
+       fprintf(stderr, "*** WARNING: you should use the '-mds390' option "
+                       "for DS80C390 support. This code generator is "
+                       "badly out of date and probably broken.\n");
+       
         port->s.fptr_size = 3;
         port->s.gptr_size = 4;
         port->stack.isr_overhead++;   /* Will save dpx on ISR entry. */
@@ -91,7 +101,7 @@ static void _pic14_finaliseOptions(void)
         fReturnSize = 5;
     } 
 
-    if (options.model) {
+    if (options.model == MODEL_LARGE) {
        port->mem.default_local_map = xdata;
        port->mem.default_globl_map = xdata;
     } else {
@@ -123,11 +133,6 @@ static void _pic14_setDefaultOptions(void)
 {
 }
 
-static void _pic14_init(void)
-{
-  printf("cool init was called for pic14\n");
-
-}
 static const char *_pic14_getRegName(struct regs *reg)
 {
     if (reg)
@@ -140,7 +145,6 @@ static void _pic14_genAssemblerPreamble(FILE *of)
   fprintf(of,"\tlist\tp=16c84\n");
   fprintf(of,"\t__config _wdt_off\n");
   fprintf(of,"\ninclude \"p16c84.inc\"\n");
-
 }
 
 /* Generate interrupt vector table. */
@@ -154,18 +158,18 @@ static int _pic14_genIVT(FILE *of, symbol **interrupts, int maxInterrupts)
        return FALSE;
     }
     
-    fprintf (of, ";\tajmp\t__sdcc_gsinit_startup\n");
+    fprintf (of, "\t;ajmp\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;\t.ds\t4\n", interrupts[i]->rname);
+           fprintf(of, "\t;ljmp\t%s\n\t.ds\t4\n", interrupts[i]->rname);
        }
        else
        {
-           fprintf(of, ";\treti\n;\t.ds\t7\n");
+           fprintf(of, "\t;reti\n\t.ds\t7\n");
        }
     }
     
@@ -183,23 +187,31 @@ static const char *_linkCmd[] = {
 };
 
 static const char *_asmCmd[] = {
-    "asxpic14", "-plosgffc", "$1.asm", NULL
+ "gpasm", NULL, NULL, NULL
+
 };
 
 /* Globals */
 PORT pic14_port = {
     "pic14",
-    "MCU pic14",                       /* Target name */
+    "MCU pic",                 /* Target name */
     {
        TRUE,                   /* Emit glue around main */
+       MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
+       MODEL_SMALL
     },
     {  
-       _asmCmd,
-       "-plosgffc",            /* Options with debug */
-       "-plosgff",             /* Options without debug */
+      _asmCmd,
+       NULL,
+       NULL,
+       //"-plosgffc",          /* Options with debug */
+       //"-plosgff",           /* Options without debug */
+       0
     },
     {
-       _linkCmd
+       _linkCmd,
+       NULL,
+       ".rel"
     },
     {
        _defaultRules
@@ -220,17 +232,19 @@ PORT pic14_port = {
        "GSINIT  (CODE)",
        "OSEG    (OVR,DATA)",
        "GSFINAL (CODE)",
+       "HOME    (CODE)",
        NULL,
        NULL,
        1
     },
     { 
-       +1, 1, 4, 1, 1
+       +1, 1, 4, 1, 1, 0
     },
-    /* pic14 does not have an 8 bit mul */
+    /* pic14 has an 8 bit mul */
     {
-       0
+       1, 0
     },
+    "_",
     _pic14_init,
     _pic14_parseOptions,
     _pic14_finaliseOptions,
@@ -242,6 +256,13 @@ PORT pic14_port = {
     _pic14_genIVT ,
     _pic14_reset_regparm,
     _pic14_regparm,
-    NULL
+    NULL,
+    FALSE,
+    0,  /* leave lt */
+    0,  /* leave gt */
+    1,  /* transform <= to ! > */
+    1,  /* transform >= to ! < */
+    1,  /* transform != to !(a == b) */
+    0   /* leave == */
 };
 
index b98eee5351aedee42d9601bed17d4b20eaa4eb35..b41e0f826886fc2ededff49534291d71ef705000 100644 (file)
@@ -188,6 +188,9 @@ extern PORT avr_port;
 #if !OPT_DISABLE_DS390
 extern PORT ds390_port;
 #endif
+#if !OPT_DISABLE_PIC
+extern PORT pic14_port;
+#endif
 
 /* Test to see if we are current compiling in DS390 mode. */
 #define IS_MCS51_PORT (port == &mcs51_port)
@@ -195,5 +198,6 @@ extern PORT ds390_port;
 #define IS_Z80_PORT (port == &z80_port)
 #define IS_AVR_PORT (port == &avr_port)
 #define IS_DS390_PORT (port == &ds390_port)
+#define IS_PIC_PORT (port == &pic14_port)
 
 #endif
index 834cff10256a7cd58fb0713bea7ecd2e333a6c07..073129faf76859c896ee61d365f8ee16c0f66782 100644 (file)
@@ -66,7 +66,7 @@ all:  test
 
 # The asm files are generated by sdcc
 .c.asm:
-       $(CC) -mpic -c $*.c
+       $(CC) -mpic14 -c $*.c
 
 # The .cod files are generated by gpasm
 # these get loaded by gpsim.