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.

MSPM0G1519: BSL entry from app

Part Number: MSPM0G1519
Other Parts Discussed in Thread: LP-MSPM0G3519, MSPM0G3519

Hi Team,

Posting on behalf of our customer.

I'll share this E2E post with our customer so they can reply when needed.

I'd like to invoke the BSL of my MSPM0G1519 from within the firmware application. 

According to the `bsl_software_invoke_app_demo_can` example provided for the LP-MSPM0G3519, this should be doable by running the following `invokeBSLAsm` function. On my device however the device immediately resets into the app instead of entering BSL. When debugging it, it looks like it enters the Hard Fault Handler immediately before the reset.

__STATIC_INLINE void invokeBSLAsm(void)
{
    /* Erase SRAM completely before jumping to BSL */
    __asm(
#if defined(__GNUC__)
        ".syntax unified\n" /* Load SRAMFLASH register*/
#endif
        "ldr     r4, = 0x41C40018\n" /* Load SRAMFLASH register*/
        "ldr     r4, [r4]\n"
        "ldr     r1, = 0x03FF0000\n" /* SRAMFLASH.SRAM_SZ mask */
        "ands    r4, r1\n"           /* Get SRAMFLASH.SRAM_SZ */
        "lsrs    r4, r4, #6\n"       /* SRAMFLASH.SRAM_SZ to kB */
        "ldr     r1, = 0x20300000\n" /* Start of ECC-code */
        "adds    r2, r4, r1\n"       /* End of ECC-code */
        "movs    r3, #0\n"
        "init_ecc_loop: \n" /* Loop to clear ECC-code */
        "str     r3, [r1]\n"
        "adds    r1, r1, #4\n"
        "cmp     r1, r2\n"
        "blo     init_ecc_loop\n"
        "ldr     r1, = 0x20200000\n" /* Start of NON-ECC-data */
        "adds    r2, r4, r1\n"       /* End of NON-ECC-data */
        "movs    r3, #0\n"
        "init_data_loop:\n" /* Loop to clear ECC-data */
        "str     r3, [r1]\n"
        "adds    r1, r1, #4\n"
        "cmp     r1, r2\n"
        "blo     init_data_loop\n"
        /* Force a reset calling BSL after clearing SRAM */
        "str     %[resetLvlVal], [%[resetLvlAddr], #0x00]\n"
        "str     %[resetCmdVal], [%[resetCmdAddr], #0x00]"
        : /* No outputs */
        : [ resetLvlAddr ] "r"(&SYSCTL->SOCLOCK.RESETLEVEL),
        [ resetLvlVal ] "r"(DL_SYSCTL_RESET_BOOTLOADER_ENTRY),
        [ resetCmdAddr ] "r"(&SYSCTL->SOCLOCK.RESETCMD),
        [ resetCmdVal ] "r"(
            SYSCTL_RESETCMD_KEY_VALUE | SYSCTL_RESETCMD_GO_TRUE)
        : "r1", "r2", "r3", "r4");
}

What am I doing wrong?

Regards,

Danilo

  • Hi Danilo,
    Can you confirm if the customer is using the same example we have in our SDK for this invocation? Based on what I can see in the example code, the customer will need to use a CAN to invoke the BSL in software. 

    Best Regards,

    Diego Abad

  • Hi Danilo,

    I have tested the SDK example, some comments on this part:

    1. The demo is for Launchpad, so it use HFXT with 40MHz might not suitbale for customer hardware.

    2. The GPIO trigger method setting is not correct for the board, it does not use PB3 as S2 button and does not set pull-up resistor.

    -> This requires a fix and I will raise a internal ticket.

    I suggest customer can try the uart demo (or refer to uart demo to modify the can demo) for software invoke function.

    bsl_software_invoke_app_demo_uart_LP_MSPM0G3519_nortos_ticlang

    B.R.

    Sal

  • Additionally, the function invokeBSLAsm(void) is used to fix BSL_ERR_01.

    For M0Gx51x device, this BSL_ERR_01 does not impact, and users can use below API to directly trigger BSL I believe:

    DL_SYSCTL_resetDevice(DL_SYSCTL_RESET_BOOTLOADER_ENTRY);

    You can also try this as an alternative method. 

    B.R.

    Sal

  • Hi Diego and Sal,

    I've shared this thread to our customer and ask him to reply here.

    Thank you for your support!

    Regards,

    Danilo

**Attention** This is a public forum