This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problems jumping to relocated interrupt vectors

Other Parts Discussed in Thread: MSP430F6779

Hi All

We have an MSP430F6779 and I am trying to relocate the vector table as we have a Bootloader application, residing in the first 128KB block of internal flash, and the App that sits in the rest, so I need to be able to update the vectors based on which one we are using.

So far I have created the table which looks like this.

extern uint16_t _App_Proxy_Vector_Start[];  /* Proxy table address */

#define  PROXY_BASE_START  0xFB80
//
//  Macros and definitions
//
/* Value written to unused vectors */
#define UNUSED                  (0x3FFF)
/*! Macro used to calculate address of vector in Application Proxy Table */
#define APP_PROXY_VECTOR(x)     (PROXY_BASE_START + (x*2))

//
//  Constant table
//
/*! MSPBoot Vector Table: It's fixed since it can't be erased and modified.
 *  Points to a proxy vector table in Application area*/

#   ifdef __IAR_SYSTEMS_ICC__
#       pragma location="BOOT_VECTOR_TABLE"
__root const uint16_t Vector_Table[] =
#   elif defined (__TI_COMPILER_VERSION__)
#       pragma DATA_SECTION(Vector_Table, ".BOOT_VECTOR_TABLE")
#       pragma RETAIN(Vector_Table)
const uint16_t Vector_Table[] =
#   endif
{
 UNUSED,                                     // FF80
 UNUSED,                                     // FF82
 UNUSED,                                     // FF84
 UNUSED,                                     // FF86
 UNUSED,                                     // FF88
 UNUSED,                                     // FF8A
 UNUSED,                                     // FF8C
 UNUSED,                                     // FF8E
 UNUSED,                                     // FF90
 UNUSED,                                     // FF92
 UNUSED,                                     // FF94
 UNUSED,                                     // FF96
 UNUSED,                                     // FF98
 UNUSED,                                     // FF9A
 UNUSED,                                     // FF9C
 UNUSED,                                     // FF9E
 UNUSED,                                     // FFA0
 UNUSED,                                     // FFA2
 UNUSED,                                     // FFA4
 UNUSED,                                     // FFA6
 UNUSED,                                     // FFA8
 UNUSED,                                     // FFAA
 UNUSED,                                     // FFAC
 UNUSED,                                     // FFAE
 UNUSED,                                     // FFB0
 UNUSED,                                     // FFB2
 UNUSED,                                     // FFB4
 UNUSED,                                     // FFB6
 UNUSED,                                     // FFB8
 UNUSED,                                     // FFBA
 UNUSED,                                     // FFBC
 UNUSED,                                     // FFBE
 UNUSED,                                     // FFC0
 UNUSED,                                     // FFC2
 UNUSED,                                     // FFC4
 UNUSED,                                     // FFC6
 APP_PROXY_VECTOR(36),                        // FFC8 - AES
 APP_PROXY_VECTOR(37),                        // FFCA - COMP_B
 APP_PROXY_VECTOR(38),                        // FFCC - RTC
 APP_PROXY_VECTOR(39),                        // FFCE - LCD_C
 APP_PROXY_VECTOR(40),                        // FFD0 - TIMER3_A1
 APP_PROXY_VECTOR(41),                        // FFD2 - TIMER3_A0
 APP_PROXY_VECTOR(42),                        // FFD4 - PORT2
 APP_PROXY_VECTOR(43),                        // FFD6 - TIMER2_A1
 APP_PROXY_VECTOR(44),                        // FFD8 - TIMER2_A0
 APP_PROXY_VECTOR(45),                        // FFDA - PORT1
 APP_PROXY_VECTOR(46),                       // FFDC - USCI_B1
 APP_PROXY_VECTOR(47),                       // FFDE - USCI_A3
 APP_PROXY_VECTOR(48),                       // FFE0 - TIMER1_A1
 APP_PROXY_VECTOR(49),                       // FFE2 - TIMER1_A0
 APP_PROXY_VECTOR(50),                       // FFE4 - DMA
 APP_PROXY_VECTOR(51),                       // FFE6 - AUX
 APP_PROXY_VECTOR(52),                       // FFE8 - USCI_A2
 APP_PROXY_VECTOR(53),                       // FFEA - USCI_A1
 APP_PROXY_VECTOR(54),                       // FFEC - TIMER0_A1
 APP_PROXY_VECTOR(55),                       // FFEE - TIMER0_A0
 APP_PROXY_VECTOR(56),                       // FFF0 - SD24B
 APP_PROXY_VECTOR(57),                       // FFF2 - ADC10
 APP_PROXY_VECTOR(58),                       // FFF4 - USCI_B0
 APP_PROXY_VECTOR(59),                       // FFF6 - USCI_A0
 APP_PROXY_VECTOR(60),                       // FFF8 - WDT
 APP_PROXY_VECTOR(61),                       // FFFA - UNMI
 APP_PROXY_VECTOR(62),                       // FFFC - SYSNMI
};

In the linker I have this:

_App_Proxy_Vector_Start = 0xFB80; /* Proxy interrupt table */


For now I have allocated the jumps to these ISRs by putting them in the linker, such as:

INT58 : origin = 0xFBF4, length = 0x0002

USCI_B0 : { * ( .int58 ) } > INT58 type = VECT_INIT

I am using the peripheral libraries to do my communications with EEPROM, SPI, etc.

I can see the interrupt fire, this is SPI (B0), and it jumps to the address from the table for the routine and you can see it in flash at (0xe050), which is the correct location for the interrupt routine function, defined as:

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_B0_VECTOR
__interrupt
#elif defined(__GNUC__)
__attribute__((interrupt(USCI_B0_VECTOR)))
#endif
void USCI_B0_ISR(void)
{
    switch(__even_in_range(UCB0IV,4))
    {
    //Vector 2 - RXIFG
    case 2:
        //USCI_B0 TX buffer ready?
        while(!EUSCI_B_SPI_getInterruptStatus(EUSCI_B0_BASE,
                                              EUSCI_B_SPI_TRANSMIT_INTERRUPT | EUSCI_B_SPI_RECEIVE_INTERRUPT))
        {
            ;
        }

        //Delay between transmissions for slave to process information
        __delay_cycles(40);

        break;
    default: break;
    }
}

The problem is, it does not jump to it. It will jump to 0x00. The assembly instruction it runs is

00fbf4: E050 E0AA           XOR.B   0xdca0,PC then

0000                BRA     @PC

Then jumps to 0x0000

Does anybody have any ideas what is going wrong?

We are using the large data and large code model which we need to access addresses over 64-bit.

Thanks.

  • An interrupt vector table entry contains the address of the interrupt handling code. It does not contain the adress of a pointer that contains the address of the interrupt handling code.

    Your code does not relocate the interrupt vector table; it's still at the normal address, FF80-FFFF.
    (I would have expected the code to set SYSRIVECT.)

  • Clemens is correct. Your vector table should have the addresses to a table of jumps to the actual vectors.
  • Thanks for the quick responses.

    In response to setting the SYSRIVECT, I thought this was only set if you moved the table to the top of RAM? But RAM lives at the following on our device and this isn't a RAM implementation:

    RAM : origin = 0x1C00, length = 0x8000

    I used the vector table in the following discussion as my basis:

    e2e.ti.com/.../324839

    Is it my definition of APP_PROXY_VECTOR that is an issue?

    I tried using the following:

    #define APP_PROXY_VECTOR(x) ((uint16_t)&_App_Proxy_Vector_Start[x*2])

    But I get the several of the following warnings

    "../Application/VectorTable.c", line 97: warning #770-D: conversion from pointer to smaller integer
    "../Application/VectorTable.c", line 97: warning #70-D: integer conversion resulted in truncation

    Thanks again.
  • Yes, SYSRIVECT is for a RAM table.

    The vector table in the discussion you linked to works differently; the table is mapped at the 64K boundary, and the entries point to code.

  • Hi Again.

    I have it working now. You're right, I just had the addresses to the ISRs but not the branch to the ISRs.

    I added the following table to an area of flash:

    __asm (" .sect .APP_PROXY_VECTORS");
    __asm (" .retain .APP_PROXY_VECTORS");
    __asm (" .global ProxyVectorTable");
    __asm ("ProxyVectorTable:");
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(0) AES */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(1) COMP_B */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(2) RTC */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(3) LCD_C */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(4) TIMER3_A1 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(5) TIMER3_A0 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(6) PORT2 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(7) TIMER2_A1 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(8) TIMER2_A0 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(9) PORT1 */
    __asm (" BRA #USCIB1_ISR;"); /* APP_PROXY_VECTOR(10) USCI_B1 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(11) USCI_A3 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(12) TIMER1_A1 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(13) TIMER1_A0 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(14) DMA */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(15) AUX */
    __asm (" BRA #USCI_A2_ISR;"); /* APP_PROXY_VECTOR(16) USCI_A2 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(17) USCI_A1 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(18) TIMER0_A1 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(19) TIMER0_A0 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(20) SD24B */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(21) ADC10 */
    __asm (" BRA #USCI_B0_ISR;"); /* APP_PROXY_VECTOR(22) USCI_B0 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(23) USCI_A0 */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(24) WDT */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(25) UNMI */
    __asm (" BRA #Dummy_Isr;"); /* APP_PROXY_VECTOR(26) SYSNMI */

    I had to align this table and the vector table to the correct size and removed the unused vectors before it too.

    Thanks.

**Attention** This is a public forum