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[] = {
45 void pic14_assignRegisters (eBBlock **ebbs, int count);
47 static int regParmFlg = 0; /* determine if we can register a parameter */
49 static void _pic14_init(void)
51 asm_addTree(&asm_asxxxx_mapping);
54 static void _pic14_reset_regparm()
59 static int _pic14_regparm( link *l)
61 /* for this processor it is simple
62 can pass only the first parameter in a register */
70 static bool _pic14_parseOptions(int *pargc, char **argv, int *i)
72 /* TODO: allow port-specific command line options to specify
78 static void _pic14_finaliseOptions(void)
80 /* Hack-o-matic: if we are using the flat24 model,
81 * adjust pointer sizes.
83 if (options.model == MODEL_FLAT24)
86 fprintf(stderr, "*** WARNING: you should use the '-mds390' option "
87 "for DS80C390 support. This code generator is "
88 "badly out of date and probably broken.\n");
90 port->s.fptr_size = 3;
91 port->s.gptr_size = 4;
92 port->stack.isr_overhead++; /* Will save dpx on ISR entry. */
94 port->stack.call_overhead++; /* This acounts for the extra byte
95 * of return addres on the stack.
96 * but is ugly. There must be a
100 fReturn = fReturn390;
104 if (options.model == MODEL_LARGE) {
105 port->mem.default_local_map = xdata;
106 port->mem.default_globl_map = xdata;
108 port->mem.default_local_map = data;
109 port->mem.default_globl_map = data;
112 if (options.stack10bit)
114 if (options.model != MODEL_FLAT24)
117 "*** warning: 10 bit stack mode is only supported in flat24 model.\n");
118 fprintf(stderr, "\t10 bit stack mode disabled.\n");
119 options.stack10bit = 0;
123 /* Fixup the memory map for the stack; it is now in
124 * far space and requires a FPOINTER to access it.
127 istack->ptrType = FPOINTER;
132 static void _pic14_setDefaultOptions(void)
136 static const char *_pic14_getRegName(struct regs *reg)
143 static void _pic14_genAssemblerPreamble(FILE *of)
145 fprintf(of,"\tlist\tp=16c84\n");
146 fprintf(of,"\t__config _wdt_off\n");
147 fprintf(of,"\ninclude \"p16c84.inc\"\n");
150 /* Generate interrupt vector table. */
151 static int _pic14_genIVT(FILE *of, symbol **interrupts, int maxInterrupts)
155 if (options.model != MODEL_FLAT24)
157 /* Let the default code handle it. */
161 fprintf (of, "\t;ajmp\t__sdcc_gsinit_startup\n");
163 /* now for the other interrupts */
164 for (i = 0; i < maxInterrupts; i++)
168 fprintf(of, "\t;ljmp\t%s\n\t.ds\t4\n", interrupts[i]->rname);
172 fprintf(of, "\t;reti\n\t.ds\t7\n");
179 /** $1 is always the basename.
180 $2 is always the output file.
182 $l is the list of extra options that should be there somewhere...
183 MUST be terminated with a NULL.
185 static const char *_linkCmd[] = {
186 "aslink", "-nf", "$1", NULL
189 static const char *_asmCmd[] = {
190 "gpasm", NULL, NULL, NULL
197 "MCU pic", /* Target name */
199 TRUE, /* Emit glue around main */
200 MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
207 //"-plosgffc", /* Options with debug */
208 //"-plosgff", /* Options without debug */
220 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
221 1, 1, 2, 4, 1, 2, 3, 1, 4, 4
243 /* pic14 has an 8 bit mul */
250 _pic14_finaliseOptions,
251 _pic14_setDefaultOptions,
252 pic14_assignRegisters,
255 _pic14_genAssemblerPreamble,
257 _pic14_reset_regparm,
263 1, /* transform <= to ! > */
264 1, /* transform >= to ! < */
265 1, /* transform != to !(a == b) */