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.

Relocating the vector table in MSP430

Other Parts Discussed in Thread: MSP430G2553

Hi all, I have an application where I am relocating the interrupt addresses from 0xFFFE. I have changed the linker config file to reduce the flash memory size for my application and have also changed all the ISR addresses as below:

FLASH : origin = 0xC000, length = 0x1400
INT00 : origin = 0xD400, length = 0x0002
INT01 : origin = 0xD402, length = 0x0002
INT02 : origin = 0xD404, length = 0x0002
INT03 : origin = 0xD406, length = 0x0002
INT04 : origin = 0xD408, length = 0x0002
INT05 : origin = 0xD40A, length = 0x0002
INT06 : origin = 0xD40C, length = 0x0002
INT07 : origin = 0xD40E, length = 0x0002
INT08 : origin = 0xD410, length = 0x0002
INT09 : origin = 0xD412, length = 0x0002
INT10 : origin = 0xD414, length = 0x0002
INT11 : origin = 0xD416, length = 0x0002
INT12 : origin = 0xD418, length = 0x0002
INT13 : origin = 0xD41A, length = 0x0002
INT14 : origin = 0xD41C, length = 0x0002
RESET : origin = 0xD41E, length = 0x0002

The code builds fine but when I try to debug, I get the error  saying "No source available for "0xffff" " and in the console window I see the message "MSP430: Can't Run Target CPU: Could not run device (to breakpoint)".

I think the device is branching to reset vector at the usual address. How can I change this and what am I missing here? I need to do this relocation of interrupts because I will have a second application running at a higher address in flash and I intend to store that application's vectors at the usual addresses(i.e reset vector @ 0xFFFE etc..)

Is it possible to maintain two vector tables for both the programs that I will store? If yes, then what will fix the problem here?

  • Hi,

    you can't really do relaction such thing since on most MSP430, the interrupt vector table is fixed. On MSP430F5xx/6xx there is a possiblity to move the interrupt vector to RAM:

    http://processors.wiki.ti.com/index.php/MSP430_FAQ#Is_there_a_way_to_re-allocate_the_interrupt_vector_on_MSP430.3F

    On other device families, you can only use a secondary table for re-routing the table, but the original address of interrupt vector is fixed:

    http://processors.wiki.ti.com/index.php/Custom_MSP430_BSL#General_Custom_BSL_FAQ

  • Thanks for the answer Leo. Will try to go by one of the approaches you suggested. Have a nice day.

  • Is there any way to do this on a MSP430G2553 part? The controller does not have the SYSCTL register if I am not wrong. Any workaround to this?

  • Adhitya,

    The 2xx part doesn't have the capability of moving the interrupt vector table. 

    Maybe first we need to take a step back: why do you need to relocate the vector table? Could you please tell me  the reason in detail? Then maybe we can try to think of another solution.

  • Hi Leo,

    The relocation is required for the following reason:

    1. I have an application at address 0xC000 and another at address 0xD000.

    2. Application at 0xC000 is used to update application at address 0xD000 by downloading a TI-TXT file over GSM network and receiving it over UART from the GSM modem and storing it to flash memory as specified by TXT file. 

    3. Since application at 0xD000 will have interrupt table at 0xFFFE, I wanted to know where or how to store the interrupt table for my application at 0xC000. Please advise. Thanks.

  • Adhitya,

    ok this means you want to basically implement a custom BSL/bootloader. Please refer to the implementation of MSPBoot or OpenBSL for this:

    http://processors.wiki.ti.com/index.php/Custom_MSP430_BSL#Custom_MSP430_BSL_for_1xx.2F2xx.2F4xx_Devices

    The basic idea is to have the bootloader located adjacent to the hardware interrupt vector table, and use a secondary interrupt table to enable the application using the hardware interrupt.

  • Hi Leo,

    I actually already have my bootloader application written. Now if I replace its linker cmd file with the linker cmd file of the custom BSL, it should replace the BSL right? Any additional changes required. Just trying to make sure I am not missing anything here.

  • Adhitya,

    Adithya Kiran1 said:

    I actually already have my bootloader application written. Now if I replace its linker cmd file with the linker cmd file of the custom BSL, it should replace the BSL right?

    I am not really sure whether I understand your sentence above. The linker command file is a way to notify the linker how the memory organization on the hardware is arranged. The linker doesn't have any idea at all on how the memory organization looks like, but still need to know where to place the code, data, constants, vector table, etc. 

    So basically in this case, you need to divide the memory into to sections: BSL+HW vector, and APP + secondary interrupt vector. the BSL shall be placed adjacent to the HW vector to avoid unnecessary erase of the BSL code if you want to re-write the HW vector. The HW vector shall always point to secondary interrupt vector which can be updated together with your application APP code.

    I know this sounds complicated, but take a look at the MSPBoot and OpenBSL implementation. If I have some free time, I would try to write something more describing this.

  • As Leo already said, you cannot simply put the vectors somewhere else. The CPU core expects them at the original addresses.
    However, you can point the original vectors to small code snippets that fetch the real address from anywhere. Like this:

    0xFFFE: 0xF000
    0xF000: BIT &0x1000; check whether APP1 or APP2 shall be started
    0xF004: JEQ $L2
    0xF006: BRA &0xD41E: start APP1 through reset vector stored at 0xD41E
    0xF00A: $L2: BRA &0xBFFE: start APP2 through reset vector stored at 0xBFFE

    There have been several threads about how to implement a custom bootloader in main flash.

**Attention** This is a public forum