2003-10-09 Theodore A. Roth * src/avrcore.c: Print out some diagnostics to see what vector has been raised and if it is been vectored to. * src/gdb.h: Add irq_raise method to struct GdbComm. * src/gdbserver.c: Catch signals >= 96 and translate into irq triggers. * src/main.c: Set irq_raise method to avr_core_irq_raise. Index: src/avrcore.c =================================================================== RCS file: /cvsroot/simulavr/simulavr/src/avrcore.c,v retrieving revision 1.67 diff -u -p -r1.67 avrcore.c --- src/avrcore.c 3 Oct 2003 18:24:33 -0000 1.67 +++ src/avrcore.c 9 Oct 2003 19:24:58 -0000 @@ -820,6 +820,7 @@ IntVect *avr_core_irq_get_pending( AvrCo /** \brief Raises an irq by adding it's data to the irq_pending list. */ void avr_core_irq_raise( AvrCore *core, int irq ) { + avr_message( "Raising irq # %d\n", irq ); core->irq_pending = irq_list_add( core->irq_pending, &core->irq_vtable[irq] ); } @@ -1026,6 +1027,9 @@ static void avr_core_check_interrupts( A avr_core_stack_push( core, pc_bytes, pc ); avr_core_sreg_set_bit( core, SREG_I, 0 ); + + avr_message( "Vectoring to irq at addr:%d offset:%d\n", + irq->addr*2, core->irq_offset*2 ); avr_core_PC_set( core, irq->addr+core->irq_offset ); Index: src/gdb.h =================================================================== RCS file: /cvsroot/simulavr/simulavr/src/gdb.h,v retrieving revision 1.12 diff -u -p -r1.12 gdb.h --- src/gdb.h 12 Sep 2003 20:58:28 -0000 1.12 +++ src/gdb.h 9 Oct 2003 19:24:58 -0000 @@ -62,6 +62,8 @@ typedef void (*CommFuncReset) (void *use typedef void (*CommFuncIORegFetch) (void *user_data, int addr, uint8_t *val, char *reg_name, size_t reg_name_size); +typedef void (*CommFuncIrqRaise) (void *user_data, int irq); + /* This structure allows the target to supply handler functions to the gdb interact for performing various tasks. */ @@ -99,6 +101,8 @@ struct GdbComm { CommFuncReset reset; CommFuncIORegFetch io_fetch; + + CommFuncIrqRaise irq_raise; }; extern void gdb_interact( GdbComm_T *comm, int port, int debug_on ); Index: src/gdbserver.c =================================================================== RCS file: /cvsroot/simulavr/simulavr/src/gdbserver.c,v retrieving revision 1.44 diff -u -p -r1.44 gdbserver.c --- src/gdbserver.c 12 Sep 2003 20:58:28 -0000 1.44 +++ src/gdbserver.c 9 Oct 2003 19:24:58 -0000 @@ -1039,6 +1039,17 @@ static void gdb_continue_with_signal( Gd comm->reset( comm->user_data ); gdb_send_reply( fd, "S05" ); return; + default: + /* Gdb user issuing the 'signal ' command where signum is + >= 96 is interpreted as a request to trigger an interrupt + vector. The vector to trigger is signo-96. */ + if (signo >= 96) + { + if (comm->irq_raise) + { + comm->irq_raise( comm->user_data, signo-96 ); + } + } } /* Modify pkt to look like what gdb_continue() expects and send it to Index: src/main.c =================================================================== RCS file: /cvsroot/simulavr/simulavr/src/main.c,v retrieving revision 1.33 diff -u -p -r1.33 main.c --- src/main.c 12 Sep 2003 20:58:28 -0000 1.33 +++ src/main.c 9 Oct 2003 19:24:58 -0000 @@ -112,6 +112,8 @@ static GdbComm_T global_gdb_comm[1] = {{ (CommFuncReset)avr_core_reset, /* reset */ (CommFuncIORegFetch)avr_core_io_fetch, /* io_fetch */ + + (CommFuncIrqRaise)avr_core_irq_raise, /* irq_raise */ }}; /*