Part Number: MSPM0G3519
Hi all,
I am trying to do something that seems rather straight forward and simple, which is to invoke the ROM BSL and then to communicate with it UART0 @9600 baud rate. I do this in the following steps:
Modify Syscfg for Configuration NVM (via empty project) for the following settings:
Enable BSL
Disable BSL Invoke Pin Check
Flash this empty Syscfg project via erase MAIN and NONMAIN memory
Flash my business logic firmware via erase MAIN memory
Invoke BSL in firmware for firmware update
Interact with invoked ROM BSL via firmware update software
So the issue I am having is the UART BSL invoke example works just fine with the above steps. I can connect and unlock the bootloader via my windows test BSL software. However, copying the invoke function (invokeBSLAsm shown below) into my actual firmware seems to invoke the BSL but it does not respond to any commands. I could really use some help here because I am absolutely stuck and don't know how to proceed. I have studied the TI MSPM0 Bootloader document (slau887a.pdf). I also attached analyzer captures of the UART to/from the BSL for both the working TI example and my failing application. A hint is that the "From BSL" line goes low at BSL invoke in the working example while it stays high in my not-working firmware. Curiously, it seems to take two connect tries (labeled 1 and 2) to connect to the BSL in the working TI example, the first to "wake up" BSL and the second BSL connect command to get a response. Please help as I am totally stuck.
<Successful UART BSL Invoke TI Example Project>
(zoomed out view to show invoke, connect 1 and connect 2>

(zoomed in at 1 and 2)


<Failed Invoke My Firmware Project>

<Invoke function used in both successful example and failed firmware>
__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 */
#if SRAM_ECC_PRESENT
"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"
#endif
/* 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");
}