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
You cannot move the IVT in the 8051, it is unchangeable. You could put LCALL's to your RAM-based ISR's in your ROM. Then locate the ISR's at specific addresses in RAM. - Mark P.S. I'm 99% sure about the IVT being unchangeable.
Mark is correct, the interrupt vectors for the 8051 and derivatives is fixed. If your code loads into RAM, you place LCALLS to the interrupt routines in your ROM at the vector locations in low memory.
I need to move the vector table up into RAM without moving the base address of the bootloader ROM code. Refer to the following support solution for details on one way to do this. http://www.keil.com/support/docs/132.htm Keil Support
Is there a real code example of this method? I am fairly new to this processor and a bit confused as to how to plug this all in.
Is there a real code example of this method? I am fairly new to this processor and a bit confused as to how to plug this all in. If, indeed you are fairly new, why do you deal with issues as complex as this. Get some wear on your '51 shoes, then come back to this issue. The way to get practice on the '51 is to use it as it is intended before "going excotic". Erik
Fortunately I don't have much of a choice in this matter. It's what the project requires and I happen to be the resources for it at the moment. It's good to know that it's not simple though.
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; }