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.
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.)
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.
**Attention** This is a public forum