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.
13 static char _defaultRules[] =
18 /* list of key words used by msc51 */
19 static char *_pic14_keywords[] =
46 void pCodeInitRegisters(void);
48 void pic14_assignRegisters (eBBlock ** ebbs, int count);
50 static int regParmFlg = 0; /* determine if we can register a parameter */
55 asm_addTree (&asm_asxxxx_mapping);
60 _pic14_reset_regparm ()
66 _pic14_regparm (sym_link * l)
68 /* for this processor it is simple
69 can pass only the first parameter in a register */
78 _pic14_parseOptions (int *pargc, char **argv, int *i)
80 /* TODO: allow port-specific command line options to specify
87 _pic14_finaliseOptions (void)
90 port->mem.default_local_map = data;
91 port->mem.default_globl_map = data;
93 /* Hack-o-matic: if we are using the flat24 model,
94 * adjust pointer sizes.
96 if (options.model == MODEL_FLAT24)
99 fprintf (stderr, "*** WARNING: you should use the '-mds390' option "
100 "for DS80C390 support. This code generator is "
101 "badly out of date and probably broken.\n");
103 port->s.fptr_size = 3;
104 port->s.gptr_size = 4;
105 port->stack.isr_overhead++; /* Will save dpx on ISR entry. */
107 port->stack.call_overhead++; /* This acounts for the extra byte
108 * of return addres on the stack.
109 * but is ugly. There must be a
113 fReturn = fReturn390;
117 if (options.model == MODEL_LARGE)
119 port->mem.default_local_map = xdata;
120 port->mem.default_globl_map = xdata;
124 port->mem.default_local_map = data;
125 port->mem.default_globl_map = data;
128 if (options.stack10bit)
130 if (options.model != MODEL_FLAT24)
133 "*** warning: 10 bit stack mode is only supported in flat24 model.\n");
134 fprintf (stderr, "\t10 bit stack mode disabled.\n");
135 options.stack10bit = 0;
139 /* Fixup the memory map for the stack; it is now in
140 * far space and requires a FPOINTER to access it.
143 istack->ptrType = FPOINTER;
150 _pic14_setDefaultOptions (void)
155 _pic14_getRegName (struct regs *reg)
163 _pic14_genAssemblerPreamble (FILE * of)
165 fprintf (of, "\tlist\tp=16c84\n");
166 fprintf (of, "\t__config _wdt_off\n");
167 fprintf (of, "\ninclude \"p16c84.inc\"\n");
170 /* Generate interrupt vector table. */
172 _pic14_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
176 if (options.model != MODEL_FLAT24)
178 /* Let the default code handle it. */
182 fprintf (of, "\t;ajmp\t__sdcc_gsinit_startup\n");
184 /* now for the other interrupts */
185 for (i = 0; i < maxInterrupts; i++)
189 fprintf (of, "\t;ljmp\t%s\n\t.ds\t4\n", interrupts[i]->rname);
193 fprintf (of, "\t;reti\n\t.ds\t7\n");
200 /** $1 is always the basename.
201 $2 is always the output file.
203 $l is the list of extra options that should be there somewhere...
204 MUST be terminated with a NULL.
206 static const char *_linkCmd[] =
208 "aslink", "-nf", "$1", NULL
211 static const char *_asmCmd[] =
213 "gpasm", NULL, NULL, NULL
222 "MCU pic", /* Target name */
224 TRUE, /* Emit glue around main */
225 MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
232 //"-plosgffc", /* Options with debug */
233 //"-plosgff", /* Options without debug */
246 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
247 1, 1, 2, 4, 1, 2, 1, 1, 4, 4
248 /* TSD - I changed the size of gptr from 3 to 1. However, it should be
249 2 so that we can accomodate the PIC's with 4 register banks (like the
273 /* pic14 has an 8 bit mul */
280 _pic14_finaliseOptions,
281 _pic14_setDefaultOptions,
282 pic14_assignRegisters,
285 _pic14_genAssemblerPreamble,
287 _pic14_reset_regparm,
293 1, /* transform <= to ! > */
294 1, /* transform >= to ! < */
295 1, /* transform != to !(a == b) */