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.

MSPM0G3107:

Part Number: MSPM0G3107

Tool/software:

how to write main() into bootloder, i want custom bootloader

  • Hi Saras,

    I can't understand your description here. Could you give more details, thanks.

    B.R.

    Sal

  • I am working on FOTA without bootloader. I write an Application1 code at 0x0000000. This application1 receive data over UART and write into flash at 0x00002000(which is my application2). Now I want to jump from app1 to app2. what are the steps required.


  • MEMORY
    {
        FLASH           (RX)  : origin = 0x00000000, length = 0x00020000
        SRAM            (RWX) : origin = 0x20200000, length = 0x00008000
        BCR_CONFIG      (R)   : origin = 0x41C00000, length = 0x000000FF
        BSL_CONFIG      (R)   : origin = 0x41C00100, length = 0x00000080
    }

    SECTIONS
    {
        .intvecs:   > 0x00000000
        .text   : palign(8) {} > FLASH
        .const  : palign(8) {} > FLASH
        .cinit  : palign(8) {} > FLASH
        .pinit  : palign(8) {} > FLASH
        .rodata : palign(8) {} > FLASH
        .ARM.exidx    : palign(8) {} > FLASH
        .init_array   : palign(8) {} > FLASH
        .binit        : palign(8) {} > FLASH
        .TI.ramfunc   : load = FLASH, palign(8), run=SRAM, table(BINIT)

        .vtable :   > SRAM
        .args   :   > SRAM
        .data   :   > SRAM
        .bss    :   > SRAM
        .sysmem :   > SRAM
        .stack  :   > SRAM (HIGH)

        .BCRConfig  : {} > BCR_CONFIG
        .BSLConfig  : {} > BSL_CONFIG
    }
     
    this is my cmd
  • for jumping I am using following code


        uint32_t newAppStackPointer = *((uint32_t *)(MAIN_BASE_ADDRESS));
        uint32_t newAppResetHandler = *((uint32_t *)(MAIN_BASE_ADDRESS + 4));

        NVIC_DisableIRQ(UART0_INT_IRQn);

        // Disable interrupts
        __disable_irq();

        // Set Main Stack Pointer (MSP) to the new app's value
        __set_MSP(newAppStackPointer);

        // Optional: Deinitialize peripherals, disable SysTick, disable interrupts, etc.

        // Jump to the new app's Reset Handler
        AppEntryFunction appEntry = (AppEntryFunction)newAppResetHandler;
        appEntry();
  • Hi Sarawati,

    See the recommendation in our SDK example code:

    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.
         *
         * Per ARM Cortex specification:
         *
         *           ARM Cortex VTOR
         *
         *
         *   Offset             Vector
         *
         * 0x00000000  ++++++++++++++++++++++++++
         *             |    Initial SP value    |
         * 0x00000004  ++++++++++++++++++++++++++
         *             |         Reset          |
         * 0x00000008  ++++++++++++++++++++++++++
         *             |          NMI           |
         *             ++++++++++++++++++++++++++
         *             |           .            |
         *             |           .            |
         *             |           .            |
         *
         * */
    
        /* 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)))();
    }

    Link: https://dev.ti.com/tirex/explore/node?node=A__ACTHfq7Nnk5GvMBsiZuiIw__MSPM0-SDK__a3PaaoK__LATEST&placeholder=true 

    B.R.

    Sal