This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Interrupt Problem when relocating code

We are experiencing a problem of non-functioning interrupts when we execute code from location 0x4000 in on-chip flash. The part is P89C51D2. We have a boot loader located at 0x0000 and interrupts function fine within that. The boot loader will then jump to the application at 0x4000. The application seems to run fine but interrupts are never executed. Any ideas? Keil tech support is no help as of yet.

Thanks, Steve Ross

Parents
  • I found the problem, the processor will execute the interrupt at it's orignal address (0x0033 for int 6) even if you tell the compiler to locate the interrupt vector at a new address.

    If I put in the following code it will work:

    ; Jump to timer intrrupt 6
    CSEG AT 00033H
    LJMP 04033H

Reply
  • I found the problem, the processor will execute the interrupt at it's orignal address (0x0033 for int 6) even if you tell the compiler to locate the interrupt vector at a new address.

    If I put in the following code it will work:

    ; Jump to timer intrrupt 6
    CSEG AT 00033H
    LJMP 04033H

Children
  • I found the problem, the processor will execute the interrupt at it's orignal address (0x0033 for int 6) even if you tell the compiler to locate the interrupt vector at a new address.

    Yep. That's because the interrupt vectors are hardwired into the MCU core. They cannot be changed by software.

    If you instruct the compiler to relocate the interrupt vectors, it will do what you want. The program will work as though the interrupt vectors are relocated to the address you specify. However, something needs to jump to the relocated interrupt vectors. As you discovered, this is done by placing an LJMP $+offset at each interrupt vector.

    The following knowledgebase article may provide more information: http://www.keil.com/support/docs/132.htm.

    Jon