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.

Change reset vector using TI-RTOS

Other Parts Discussed in Thread: MSP430F6779, SYSBIOS

Hi All

We are using an MSP430F6779 with TI-RTOS. We want to load a Bootloader into the first sector of internal flash and have the application at 0x2C000 and into the other 3 sectors. We are using CCS as well.

The problem is that we are using the TI-RTOS and we need to edit the reset vector in here to move it to our 0x2C000 address.

Is there a way to edit the configuration file to jump to this location instead.

We also have a product using TI-RTOS for a TM4C device, and you can easily relocate the application. We want to know if there is similar easy way for our MSP430 device.

Thanks.

  • Hi Mark,

      This is a good question. Unfortunately the MSP430 architecture does not support a Base Vector Register like in some ARM processors (Tiva/MSP432 for example). And also the ISR's must be defined in the lower 64 KB address space as the interrupt vectors are only 16 bit addresses.

    As you can see there are some limitations, but there are a couple of things that you can try:

    1. Implement the RAM interrupt vector table,"On the 5xx/6xx family devices, it is possible to re-allocate the interrupt vectors to the RAM by setting the SYSRIVECT of the SYSCTL register" take a look at this:  http://processors.wiki.ti.com/index.php/MSP430_FAQ#Is_there_a_way_to_re-allocate_the_interrupt_vector_on_MSP430.3F

    With this implementation you could have 2 vector tables and depending on which code you are running (application or boot code), you will need to copy the vectors into RAM. Unfortunately all the ISR's must reside in your lower 64KB, so you may need to re-arrange your memory map.

    2. Create a vector re-direction table in your boot loader, something similar to what we have in the MSPBoot  please take a look at section 2.2.3 "Interrupt vectors in Flash Devices" (www.ti.com/lit/pdf/SLAA600). With this implementation your Application ISR's could reside outside of the lower 64KB.

      Hopefully this helps.

        Regards,

         David

  • Thanks David

    I'll give these a go.

    Cheers.
  • Hi David

    I do have further questions with this, now that I have implemented option 2.

    Based on the MSPBoot Documentation, I have implemented the following:

    My application will live at 0x2C000 and onwards. My Bootloader lives in here:

    FLASH : origin = 0xC000, length = 0x3980

    In my Bootloader code I have set the interrupt vectors to point to a proxy table by doing the following:

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

    #define PROXY_BASE_START 0xBF90
    //
    // 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))
    #define APP_PROXY_VECTOR(x) ((uint16_t)&_App_Proxy_Vector_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
    {
    APP_PROXY_VECTOR(0), // FFC8 - AES
    APP_PROXY_VECTOR(1), // FFCA - COMP_B
    APP_PROXY_VECTOR(2), // FFCC - RTC
    APP_PROXY_VECTOR(3), // FFCE - LCD_C
    APP_PROXY_VECTOR(4), // FFD0 - TIMER3_A1
    APP_PROXY_VECTOR(5), // FFD2 - TIMER3_A0
    APP_PROXY_VECTOR(6), // FFD4 - PORT2
    APP_PROXY_VECTOR(7), // FFD6 - TIMER2_A1
    APP_PROXY_VECTOR(8), // FFD8 - TIMER2_A0
    APP_PROXY_VECTOR(9), // FFDA - PORT1
    APP_PROXY_VECTOR(10), // FFDC - USCI_B1
    APP_PROXY_VECTOR(11), // FFDE - USCI_A3
    APP_PROXY_VECTOR(12), // FFE0 - TIMER1_A1
    APP_PROXY_VECTOR(13), // FFE2 - TIMER1_A0
    APP_PROXY_VECTOR(14), // FFE4 - DMA
    APP_PROXY_VECTOR(15), // FFE6 - AUX
    APP_PROXY_VECTOR(16), // FFE8 - USCI_A2
    APP_PROXY_VECTOR(17), // FFEA - USCI_A1
    APP_PROXY_VECTOR(18), // FFEC - TIMER0_A1
    APP_PROXY_VECTOR(19), // FFEE - TIMER0_A0
    APP_PROXY_VECTOR(20), // FFF0 - SD24B
    APP_PROXY_VECTOR(21), // FFF2 - ADC10
    APP_PROXY_VECTOR(22), // FFF4 - USCI_B0
    APP_PROXY_VECTOR(23), // FFF6 - USCI_A0
    APP_PROXY_VECTOR(24), // FFF8 - WDT
    APP_PROXY_VECTOR(25), // FFFA - UNMI
    APP_PROXY_VECTOR(26), // FFFC - SYSNMI
    };

    This will put a proxy table in the vector table, with the addresses BF90 to BFFC (as it is 4 bytes * 27 for branch and ISR address), located in the vector table at FFC8 to FFFE

    My proxy vector table looks like this and is in the boootloader code, for the ISRs in Bootloader that I need to access peripherals:

    __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 */

    This all works fine in the Bootloader.

    My question is this:

    Based on the MSPBoot documentation and the project examples, the linker file for the application (App1) puts the INT vectors in locations F990 to F99C. I'm struggling to see how this relates to anything as the proxy table is at FB90 and onwards in the MSPBoot example. Which makes me ask the following question as I cannot see how it relates.

    What do I need to do in my application to get it to jump to the ISR's that live in the application code? These will be in a different location to the Bootloader application ISRs and the proxy table points to the Bootloader ones.

    Also how do I make my Bootloader jump to 0x2C000 to run the application code, once it is flashed in by the bootloader?

    Thanks Again.
  • Hi Again

    A small update. I've noticed that this example project is wrong and the G2452_I2C example project is more like it. I can see there is also a proxy table created in here for the App at the same address as the Bootloader, so I should be ok with this part now.

    Another issue is that we are using the TI-RTOS, so do I have to change my proxy table in the application to reference:

    ti_sysbios_family_msp430_Hwi45_p2
    ti_sysbios_family_msp430_Hwi46
    etc....

    Instead of the direct ISR routines?

    Thanks again.
  • Hi Mark,

    I believe that should be the case, I'll let the TI-RTOS experts (I'm part of the MSP team) comment in regards to this.

    Regards,

    David
  • Mark,

    This looks like the same issue as was resolved in your other thread.  If so, could you please mark this one as answered, as well?

    Steve

  • Hi

    This thread was answered in the following thread:

    e2e.ti.com/.../462437

    I cannot mark this thread as answered for some reason!
     
    Thanks