+2006-04-28 Raphael Neider <rneider AT web.de>
+
+ * src/pic/gen.c (genFunction): set global pic14_hasInterrupt on
+ definition of an interrupt handler,
+ * src/pic/glue.c (pic14_emitInterruptHandler): moved output of
+ interrupt handler stuff from picglue() to separate routine,
+ (picglue): enabled definition of intr handlers in files w/o main()
+
2006-04-26 Maarten Brock <sourceforge.brock AT dse.nl>
* support/librarian/sdcclib.c: moved include <limits.h> up to enable
2006-04-24 Raphael Neider <rneider AT web.de>
- * src/pic/device.c (pic14_assignConfigWordValue): remember assignments to
- config word, "pic14_"-prefixed some extern functions
+ * src/pic/device.c (pic14_assignConfigWordValue): remember assignments
+ to config word, "pic14_"-prefixed some extern functions
(pic14_emitConfigWord): emit __config directive(s) if assignment to
config word has been found
* src/pic/device.h: added prototypes
* src/pic/pcode.c: added "pic14_"-prefix where needed
- * src/pic/ralloc.c (IS_CONFIG_ADDRESS,pic14_assignRegisters): cosmetic fixup
- * src/pic/glue.c (pic14_constructAbsMap): handle assignments to config words,
+ * src/pic/ralloc.c (IS_CONFIG_ADDRESS,pic14_assignRegisters): cosmetic
+ fixup
+ * src/pic/glue.c (pic14_constructAbsMap): handle assignments to config
+ words,
(pic14emitRegularMap): ignore config words,
(pic14createInterruptVect): moved generating __config directives away
(picglue): have __config directives emitted
static int labelOffset=0;
extern int debug_verbose;
+extern int pic14_hasInterrupt;
//static int optimized_for_speed = 0;
/* max_key keeps track of the largest label number used in
emitpcode(POC_CLRF, popCopyReg(&pc_pclath));/* during an interrupt PCLATH must be cleared before a goto or call statement */
pBlockConvert2ISR(pb);
+ pic14_hasInterrupt = 1;
#if 0
if (!inExcludeList("acc"))
pic14_emitcode ("push","acc");
int pic14_getSharebankAddress(void);
char *udata_section_name=0; // FIXME Temporary fix to change udata section name -- VR
+int pic14_hasInterrupt = 0; // Indicates whether to emit interrupt handler or not
/*-----------------------------------------------------------------*/
/* aopLiteral - string from a literal value */
}
+void
+pic14_emitInterruptHandler (FILE * asmFile)
+{
+ if (pic14_hasInterrupt)
+ {
+
+ fprintf (asmFile, "%s", iComments2);
+ fprintf (asmFile, "; interrupt and initialization code\n");
+ fprintf (asmFile, "%s", iComments2);
+ // Note - for mplink may have to enlarge section vectors in .lnk file
+ // Note: Do NOT name this code_interrupt to avoid nameclashes with
+ // source files's code segment (interrupt.c -> code_interrupt)
+ fprintf (asmFile, "c_interrupt\t%s\t0x4\n", CODE_NAME);
+
+ /* interrupt service routine */
+ fprintf (asmFile, "__sdcc_interrupt\n");
+ copypCode(asmFile, 'I');
+ }
+}
+
/*-----------------------------------------------------------------*/
/* glue - the final glue that hold the whole thing together */
/*-----------------------------------------------------------------*/
/* copy the interrupt vector table */
if (mainf && IFFUNC_HASBODY(mainf->type)) {
copyFile (asmFile, vFile);
-
- fprintf (asmFile, "%s", iComments2);
- fprintf (asmFile, "; interrupt and initialization code\n");
- fprintf (asmFile, "%s", iComments2);
- fprintf (asmFile, "code_interrupt\t%s\t0x4\n", CODE_NAME); // Note - for mplink may have to enlarge section vectors in .lnk file
-
- /* interrupt service routine */
- fprintf (asmFile, "__sdcc_interrupt\n");
- copypCode(asmFile, 'I');
-
+ }
+
+ /* create interupt ventor handler */
+ pic14_emitInterruptHandler (asmFile);
+
+ if (mainf && IFFUNC_HASBODY(mainf->type)) {
/* initialize data memory */
fprintf (asmFile, "code_init\t%s\n", CODE_NAME); // Note - for mplink may have to enlarge section vectors in .lnk file
fprintf (asmFile,"__sdcc_gsinit_startup\n");