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.

TIDM-02011: Switchover for live firmware update

Part Number: TIDM-02011

Dear Champs,

I am asking this for our customer.

Looking into TIDM-02011 and the related app note "SPRUIU9" for LFU (live firmware update) without reset.

1. Does the term "Switchover" mainly mean 

Swap of PIE table

Swap of function pointers of LS0/LS1

Stack initialization

Or is there anything else?

2. In buck_main.c, there are below codes for switchover.

if(LFU_getSwap(LFU_BASE))
{
LFU_clearSwap(LFU_BASE);
}
else
{
LFU_setSwap(LFU_BASE);
}

We wonder why you need to write below? Is there any concern?

if(LFU_getSwap(LFU_BASE))
{
LFU_clearSwap(LFU_BASE);
}

Why don't you just use 

LFU_setSwap(LFU_BASE);

2. In "f28003x_bank1_flash_lnk_lfu.cmd", there is 

   .TI.noinit : > RAMLS2

What is this used for?

We don't see it's used in the .map file.

3. About stack initialization,

//
// Stack initialization
//
__TI_init_stack();

Is it used to reset the stack pointer to 0?

Is there anything else for this function?

  • Wayne,

    Replies below.

    1. Correct.

    2. Assume you are doing multiple LFUs without any device reset. Then the first time around, you would Set Swap, then on the next LFU you would Clear Swap, the next time you would Set Swap etc.

    3. .TI.noinit is for variables that are specified as NOINIT i.e. not to be initialized. That is, TYPE=NOINIT in the linker cmd file has no effect on the Compiler's LFU initialization routine. It only affects the C initialization routine on a device reset. The only time it may affect it is if TYPE=NOINIT is specified on the .TI.update section, so that should not be done.

    4. Yes.

    Thanks,

    Sira

  • Dear Sira,

    About 2,

    Let us clarify registers usage in your code.

    LFUConfig.LS01Swap

    LFUConfig.PieVectorSwap

    LFUStatus.LS01Swap

    LFUStatus.PieVectorSwap

     

    Usage 1

    0 means it's on the original location (LS0, PieVectTable 0x0000 0D00-0x0000 0EFF)

    1 means it's on the alternative location (LS1, PieVectTable Swap 0x0100 0900-0x0100 0AFF)

    0 and 1 are static.

     

    Usage 2

    0 means it has been finished swap.

    1 means to ask it to swap from LS0 to LS1 or from LS1 to LS0 ; from PieVectTable to PieVectTable Swap or from PieVectTable Swap to PieVectTable)

     

    Therefore, in your code, it means the usage 1 above rather than usage 2.

    Is our understanding correct?

  • Wayne,

    The best analogy I can give for the implementation is the GPIO Toggle feature, as opposed to Set or Clear.

    This is what I am doing in the code - Toggling the Swaps.

    Thanks,

    Sira 

  • Dear Sira,

    The description in TRM and your API names confuse us.

    In the latest driverlib API, it uses below in sysctl.h.

    //*****************************************************************************
    //
    //! Swap PIE Vector Table to alternate location and swap LS0 and LS1
    //!
    //! \param swap Whether to enable or disable swap
    //!         - true  : PIE Vector Table is swapped to alternate location.
    //!                   LS0 and LS1 is swapped
    //!         - false : PIE vector table is mapped to the original location
    //!                   LS0 and LS1 is mapped to original location
    //!
    //! \return None
    //
    //*****************************************************************************
    static inline void
    SysCtl_swapPieVectorAndLS01(bool swap)
    {
        EALLOW;
        if(swap)
        {
            HWREG(LFU_BASE + SYSCTL_O_LFUCONFIG) |=
                    (SYSCTL_LFUCONFIG_PIEVECTORSWAP | SYSCTL_LFUCONFIG_LS01SWAP);
        }
        else
        {
            HWREG(LFU_BASE + SYSCTL_O_LFUCONFIG) &=
                    ~(SYSCTL_LFUCONFIG_PIEVECTORSWAP | SYSCTL_LFUCONFIG_LS01SWAP);
        }
        EDIS;
    }

    It uses true and false, more like the usage 1 I mentioned above, and makes it clearer.

    Anyway, Thank you for your clarification.

  • Wayne,

    Ok, it's good to know this function exists in driverlib, and is less confusing to you Slight smile

    Thanks,

    Sira