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)
162 extern char *processor_base_name(void);
165 _pic14_genAssemblerPreamble (FILE * of)
167 char * name = processor_base_name();
172 fprintf(stderr,"WARNING: No Pic has been selected, defaulting to %s\n",name);
175 fprintf (of, "\tlist\tp=%s\n",&name[1]);
176 fprintf (of, "\t__config _wdt_off\n");
177 fprintf (of, "\ninclude \"%s.inc\"\n",name);
180 /* Generate interrupt vector table. */
182 _pic14_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
186 if (options.model != MODEL_FLAT24)
188 /* Let the default code handle it. */
192 fprintf (of, "\t;ajmp\t__sdcc_gsinit_startup\n");
194 /* now for the other interrupts */
195 for (i = 0; i < maxInterrupts; i++)
199 fprintf (of, "\t;ljmp\t%s\n\t.ds\t4\n", interrupts[i]->rname);
203 fprintf (of, "\t;reti\n\t.ds\t7\n");
210 /** $1 is always the basename.
211 $2 is always the output file.
213 $l is the list of extra options that should be there somewhere...
214 MUST be terminated with a NULL.
216 static const char *_linkCmd[] =
218 "aslink", "-nf", "$1", NULL
221 /* Sigh. This really is not good. For now, I recommend:
222 * sdcc -S -mpic14 file.c
223 * the -S option does not compile or link
225 static const char *_asmCmd[] =
227 "gpasm", "-c -I /usr/local/share/gpasm/header", "$1.asm", NULL
236 "MCU pic", /* Target name */
237 NULL, /* Processor */
239 TRUE, /* Emit glue around main */
240 MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
248 //"-plosgffc", /* Options with debug */
249 //"-plosgff", /* Options without debug */
252 NULL /* no do_assemble function */
264 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
265 1, 2, 2, 4, 1, 2, 1, 1, 4, 4
266 /* TSD - I changed the size of gptr from 3 to 1. However, it should be
267 2 so that we can accomodate the PIC's with 4 register banks (like the
293 /* pic14 has an 8 bit mul */
300 _pic14_finaliseOptions,
301 _pic14_setDefaultOptions,
302 pic14_assignRegisters,
305 _pic14_genAssemblerPreamble,
306 NULL, /* no genAssemblerEnd */
308 NULL, // _pic14_genXINIT
309 _pic14_reset_regparm,
317 1, /* transform <= to ! > */
318 1, /* transform >= to ! < */
319 1, /* transform != to !(a == b) */
321 FALSE, /* No array initializer support. */
322 0, /* no CSE cost estimation yet */
323 NULL, /* no builtin functions */
324 GPOINTER, /* treat unqualified pointers as "generic" pointers */
325 1, /* reset labelKey to 1 */
326 1, /* globals & local static allowed */