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 pic14 */
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_reset_regparm()
54 static int _pic14_regparm( link *l)
56 /* for this processor it is simple
57 can pass only the first parameter in a register */
65 static bool _pic14_parseOptions(int *pargc, char **argv, int *i)
67 /* TODO: allow port-specific command line options to specify
73 static void _pic14_finaliseOptions(void)
75 /* Hack-o-matic: if we are using the flat24 model,
76 * adjust pointer sizes.
78 if (options.model == MODEL_FLAT24)
80 port->s.fptr_size = 3;
81 port->s.gptr_size = 4;
82 port->stack.isr_overhead++; /* Will save dpx on ISR entry. */
84 port->stack.call_overhead++; /* This acounts for the extra byte
85 * of return addres on the stack.
86 * but is ugly. There must be a
95 port->mem.default_local_map = xdata;
96 port->mem.default_globl_map = xdata;
98 port->mem.default_local_map = data;
99 port->mem.default_globl_map = data;
102 if (options.stack10bit)
104 if (options.model != MODEL_FLAT24)
107 "*** warning: 10 bit stack mode is only supported in flat24 model.\n");
108 fprintf(stderr, "\t10 bit stack mode disabled.\n");
109 options.stack10bit = 0;
113 /* Fixup the memory map for the stack; it is now in
114 * far space and requires a FPOINTER to access it.
117 istack->ptrType = FPOINTER;
122 static void _pic14_setDefaultOptions(void)
126 static void _pic14_init(void)
128 printf("cool init was called for pic14\n");
131 static const char *_pic14_getRegName(struct regs *reg)
138 static void _pic14_genAssemblerPreamble(FILE *of)
140 fprintf(of,"\tlist\tp=16c84\n");
141 fprintf(of,"\t__config _wdt_off\n");
142 fprintf(of,"\ninclude \"p16c84.inc\"\n");
146 /* Generate interrupt vector table. */
147 static int _pic14_genIVT(FILE *of, symbol **interrupts, int maxInterrupts)
151 if (options.model != MODEL_FLAT24)
153 /* Let the default code handle it. */
157 fprintf (of, ";\tajmp\t__sdcc_gsinit_startup\n");
159 /* now for the other interrupts */
160 for (i = 0; i < maxInterrupts; i++)
164 fprintf(of, ";\tljmp\t%s\n;\t.ds\t4\n", interrupts[i]->rname);
168 fprintf(of, ";\treti\n;\t.ds\t7\n");
175 /** $1 is always the basename.
176 $2 is always the output file.
178 $l is the list of extra options that should be there somewhere...
179 MUST be terminated with a NULL.
181 static const char *_linkCmd[] = {
182 "aslink", "-nf", "$1", NULL
185 static const char *_asmCmd[] = {
186 "asxpic14", "-plosgffc", "$1.asm", NULL
192 "MCU pic14", /* Target name */
194 TRUE, /* Emit glue around main */
198 "-plosgffc", /* Options with debug */
199 "-plosgff", /* Options without debug */
208 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
209 1, 1, 2, 4, 1, 2, 3, 1, 4, 4
230 /* pic14 does not have an 8 bit mul */
236 _pic14_finaliseOptions,
237 _pic14_setDefaultOptions,
238 pic14_assignRegisters,
241 _pic14_genAssemblerPreamble,
243 _pic14_reset_regparm,