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.

MSP-EXP432E401Y: USB firmware update - bootloader

Part Number: MSP-EXP432E401Y
Other Parts Discussed in Thread: UNIFLASH

USB firmware update - bootloader (msp-exp432e401y launchpad)

A flash based bootloader reads the firmware from USB storage device and writes to flash. The firmware was correctly read from USB stick and written into flash by the bootloader, and was confirmed / verified by UniFlash. After exporting the image using UniFlash  to a file, it was exact the same as the firmware image on the USB stick, and the exported application (nortos) image run as expected after programing it by using UniFlah. However, the bootloader couldn't start the application by jumping to the application's address in flash (0x40000). The code to jump and start the application is as follows:

void CallApplication(uint_fast32_t ui32StartAddr)
{
/* Disable all processor interrupts. */
HWREG(NVIC_DIS0) = 0xffffffff;
HWREG(NVIC_DIS1) = 0xffffffff;
HWREG(NVIC_DIS2) = 0xffffffff;
HWREG(NVIC_DIS3) = 0xffffffff;
HWREG(NVIC_DIS4) = 0xffffffff;
//
// Set the vector table to the beginning of the app in flash.
//
HWREG(NVIC_VTABLE) = ui32StartAddr;

//
// Load the stack pointer from the application's vector table.
//
__asm(" ldr r1, [r0]\n"
" mov sp, r1\n");

//
// Load the initial PC from the application's vector table and branch to
// the application's entry point.
//
__asm(" ldr r0, [r0, #4]\n"
" bx r0\n");

}

Any help would be appreciated.

  • Hello John,

    Let me clarify a few things here to make sure I'm understanding your post correctly.

    • You are utilizing a custom bootloader that reads from an external flash an application image
    • The method of communication to this external flash is USB
    • You've been able to verify that the image you want is in the appropriate space of Flash on the MCU (aka good download to MCU)
    • The BSL is then suppose to make a call to start the application, but this is failing in an unknown manner.

    Is my understanding correct?

  • Yes. Thank you Jace. BTW, I am using Code Composer Studio Version: 10.2.0.00009

  • Hello John,

    From what I can gather, its recommended to do a reset to start your application rather than trying to call it directly in the manner you are doing. You should also ensure the following aspects are completed in your bootloader:

    BL_HW_INIT_FN_HOOK Performs application-specific low-level hardware initialization on system reset. If hooked, this function is called immediately after the bootloader code relocation completes. An application may perform any required low-level hardware initialization during this function. The system clock has not been set when this function is called. Initialization that assumes the system clock is set may be performed in the BL_INIT_FN_HOOK function instead. BL_INIT_FN_HOOK Performs application-specific initialization on system reset. If hooked, this function will be called during bootloader initialization to perform any board- or application specific initialization which is required. The function is called following a reset immediately after the selected bootloader peripheral has been configured and the system clock has been set

    There is a reset command in the default bootloader you could utilize for this. 

  • Hi Jace, I found the cause that the bootloader couldn't start the application: one step was missing. When compiling / link the application code, it needs to tell the linker by using TI Linker Command or TI Linker Command file where (in flash) to start the application, say 0x40000 in my test case. Then the bootloader jumped to the address and started the application by calling CallApplication(uint_fast32_t ui32StartAddr). Thank you.