2 pic14 specific general functions.
4 Note that mlh prepended _pic14_ on the static functions. Makes
5 it easier to set a breakpoint using the debugger.
12 static char _defaultRules[] =
17 /* list of key words used by msc51 */
18 static char *_pic14_keywords[] =
46 void pic14_assignRegisters (eBBlock ** ebbs, int count);
48 static int regParmFlg = 0; /* determine if we can register a parameter */
53 asm_addTree (&asm_asxxxx_mapping);
57 _pic14_reset_regparm ()
63 _pic14_regparm (sym_link * l)
65 /* for this processor it is simple
66 can pass only the first parameter in a register */
75 _pic14_parseOptions (int *pargc, char **argv, int *i)
77 /* TODO: allow port-specific command line options to specify
84 _pic14_finaliseOptions (void)
87 port->mem.default_local_map = data;
88 port->mem.default_globl_map = data;
90 /* Hack-o-matic: if we are using the flat24 model,
91 * adjust pointer sizes.
93 if (options.model == MODEL_FLAT24)
96 fprintf (stderr, "*** WARNING: you should use the '-mds390' option "
97 "for DS80C390 support. This code generator is "
98 "badly out of date and probably broken.\n");
100 port->s.fptr_size = 3;
101 port->s.gptr_size = 4;
102 port->stack.isr_overhead++; /* Will save dpx on ISR entry. */
104 port->stack.call_overhead++; /* This acounts for the extra byte
105 * of return addres on the stack.
106 * but is ugly. There must be a
110 fReturn = fReturn390;
114 if (options.model == MODEL_LARGE)
116 port->mem.default_local_map = xdata;
117 port->mem.default_globl_map = xdata;
121 port->mem.default_local_map = data;
122 port->mem.default_globl_map = data;
125 if (options.stack10bit)
127 if (options.model != MODEL_FLAT24)
130 "*** warning: 10 bit stack mode is only supported in flat24 model.\n");
131 fprintf (stderr, "\t10 bit stack mode disabled.\n");
132 options.stack10bit = 0;
136 /* Fixup the memory map for the stack; it is now in
137 * far space and requires a FPOINTER to access it.
140 istack->ptrType = FPOINTER;
147 _pic14_setDefaultOptions (void)
152 _pic14_getRegName (struct regs *reg)
160 _pic14_genAssemblerPreamble (FILE * of)
162 fprintf (of, "\tlist\tp=16c84\n");
163 fprintf (of, "\t__config _wdt_off\n");
164 fprintf (of, "\ninclude \"p16c84.inc\"\n");
167 /* Generate interrupt vector table. */
169 _pic14_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
173 if (options.model != MODEL_FLAT24)
175 /* Let the default code handle it. */
179 fprintf (of, "\t;ajmp\t__sdcc_gsinit_startup\n");
181 /* now for the other interrupts */
182 for (i = 0; i < maxInterrupts; i++)
186 fprintf (of, "\t;ljmp\t%s\n\t.ds\t4\n", interrupts[i]->rname);
190 fprintf (of, "\t;reti\n\t.ds\t7\n");
197 /** $1 is always the basename.
198 $2 is always the output file.
200 $l is the list of extra options that should be there somewhere...
201 MUST be terminated with a NULL.
203 static const char *_linkCmd[] =
205 "aslink", "-nf", "$1", NULL
208 static const char *_asmCmd[] =
210 "gpasm", NULL, NULL, NULL
219 "MCU pic", /* Target name */
221 TRUE, /* Emit glue around main */
222 MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
229 //"-plosgffc", /* Options with debug */
230 //"-plosgff", /* Options without debug */
242 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
243 1, 1, 2, 4, 1, 2, 1, 1, 4, 4
244 /* TSD - I changed the size of gptr from 3 to 1. However, it should be
245 2 so that we can accomodate the PIC's with 4 register banks (like the
269 /* pic14 has an 8 bit mul */
276 _pic14_finaliseOptions,
277 _pic14_setDefaultOptions,
278 pic14_assignRegisters,
281 _pic14_genAssemblerPreamble,
283 _pic14_reset_regparm,
289 1, /* transform <= to ! > */
290 1, /* transform >= to ! < */
291 1, /* transform != to !(a == b) */