Im trying to determine the best way to deal with the Interrupt vector tables in a system where the main code will be downloaded into ram and a bootloader will be in the ROM. I need to move the vector table up into RAM without moving the base address of the bootloader ROM code. Thanks Mark
I did a similar thing when I had to update my firmware over usb. In my case one interwupt was used in the update code and regular firmware and the code hat to respond as fast as possible. in ASM I used the following: (note the RET instead of RETI)
extrn DATA (USB_VECT) extrn DATA (V24_VECT) CSEG at 00003h PUSH USB_VECT+1 PUSH USB_VECT+0 RET CSEG at 00023 PUSH V24_VECT+1 PUSH V24_VECT+0 RET end and in c #pragma NOIV void V24Irq(void) interrupt SIO_VECTOR { ... } void USBIrq(void) interrupt IE0_VECTOR { ... }
UINT16 usb_vect _at_ 0x20; UINT16 sio_vect _at_ 0x22; void initirq(void) { usb_vect = (UINT8 code *) &UsbIrq; sio_vect = (UINT8 code *) &V24Irq; EA=1; }