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.

MSPM0G3507: About the evaluation board,how to realize the jump between the two APPs?

Other Parts Discussed in Thread: MSPM0G3507

Hi,team:

I using MSPM0G3507 evaluation board. we plan to run APP1 in the first 16k space of the flash and APP2 in the back space. The customer has two questions:

1. How to jump between two APPs while they are running?like this:

This is the function of the jump:

void run_app(uint32 appxaddr)
{
//if (((*(vu32*)appxaddr) & 0x20000000 ) == 0x20000000) 
{
//SCB->VTOR = (vu32)0x4000;
jump2app=(iapfun)*(vu32*)(appxaddr+4);

__set_MSP(*(vu32*)appxaddr);
//__disable_irq();
jump2app();
}
}

and interrupt vector table also need to make the corresponding offset:SCB->VTOR = FLASH_BASE | 0x10000;

2. Since APP2 does not start running FROM flash address 0, what modifications and settings need to be made to the compiler keil5 and APP2 codes? Can you provide these development materials or sample code?like this:



Thanks a lot!

  • Hello,

    Please see the following E2E post for some answers to your question: https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1279297/mspm0g1107-if-the-mcu-need-to-support-2-apps-how-to-realize-the-jump-between-the-two-apps-how-to-set-up-the-compiler-and-app-code

    You would for sure need to do interrupt vector forwarding and change that per application. That being said, we currently don't have example code/documentation on how to do this independently, but we do have two applications that include this feature on a secondary measure that you can utilize to accomplish your goal.  

    First, is the Secondary BSL example, which places a customizable bootloader into application flash. In this instance the secondary BSL would be your APP1 and the loaded image would be your APP2. So you can look at the mechanisms in there to do what you need. 

    Secondary BSL example

    BSL UG, Section 6 Secondary BSL

    The other option would be to look at our BIM (Boot Image Manager) implementation which  gives you exactly what you need, plus additional security features. You could potentially strip this down to something simpler to fit your needs. 

    BIM Documentation

    BIM Example

  • Hi,Jace H,

           According to your suggestion, I am trying to jump the APP by BIM, but the program cannot jump normally, and a hardware error will be displayed during simulation。

           Here is the jump part of the code

    #include "bootutil/bootutil.h"
    #include "bootutil/image.h"
    #include "bootutil/security_cnt.h"
    struct boot_rsp bootRsp_APP;

    static void start_app(uint32_t *vector_table)
    {
    /* The following code resets the SP to the value specified in the
    * provided vector table, and then the Reset Handler is invoked.

    /* Reset the SP with the value stored at vector_table[0] */
    __asm volatile(
    "LDR R3,[%[vectab],#0x0] \n"
    "MOV SP, R3 \n" ::[vectab] "r"(vector_table));

    /* Set the Reset Vector to the new vector table (Will be reset to 0x000) */
    SCB->VTOR = (uint32_t) vector_table;

    /* Jump to the Reset Handler address at vector_table[1] */
    ((void (*)(void))(*(vector_table + 1)))();
    }


    /* do_boot is called in the event of a successful verification of an image */
    static void do_boot(struct boot_rsp *rsp,uint32 appxaddr)
    {
    /* SCB->VTOR = 0x0 + rsp->br_image_off + rsp->br_hdr->ih_hdr_size;
    * Currnetly the image is run from internal flash.
    * Base address of this application is 0x0000
    */
    uint32_t vector_table = appxaddr + rsp->br_image_off + rsp->br_hdr->ih_hdr_size;

    start_app((uint32_t *) vector_table);
    }

    I'm calling a function (do_boot(&bootRsp_APP,0x00000000);)to jump。

    Is my setting correct? Do I need additional configuration?thanks

  • Hi,Jace H,

           About BSL upgrade procedures,I would like to confirm whether the BSL is fixed configuration?like STM32,The bootloader is solidified, we can only customize the bootloader。thanks

  • lxy,

    I'm not sure what you mean by tis question. The Bootloader aka BSL is in ROM on the device and cannot be customized. It does have an option for "plugins" stored in Flash for if you want to change a peripheral interface for example. This same mechanism also allows you to do a secondary BSL, stored in Flash, that is fully customizable and replaces onboard BSL. This is the example I linked to you. 

  • Hi,Jace H,

         Our requirement is to make a guided upgrade program APP1 according to our upgrade process. If it is a fixed upgrade process, it is not suitable for us to use. Therefore, we want to make clear whether the internal BSL can be modified into what we want。In addition, the above reply failed to debug BIM, may I ask how to modify it?thanks a lot。

  • lxy,

    The secondary BSL example provided can be modified however you want. What we currently provide is a copy of the BSL that's in ROM so you can modify.

    For BIM, all of the documentation available is provided in the links above. There is additional documentation on the github link on how to modify BIM to suit your needs. 

    Both of these examples provided showcase a way to jump between two applications in Flash, but would need understanding and modification from your side to implement in the way you want.  Unfortunately, that is outside the scope of support that I can provide. In the future we will have more simple examples of switching between to compiled applications.  

  • Hi,Jace H,

           This BSL copy example ,How much space can I use here? Is it in 16K size?

           For BIM,Do you have any more details。

          Are there any other mass-produced chips with the same core as this one chip MSPM0G3507? I'd like to find out more about it。thaks a lot。

           

  • For Secondary BSL, current size is ~8kB with standard optimizations.

    BIM documentation was linked to above.