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.

CCS/TMS570LS3137: How to change the TMS570LS3137 Single-application Bootloader to Dual-application Bootloader

Part Number: TMS570LS3137


Tool/software: Code Composer Studio

Hi,

I'm using Code Composer Studio(CCS) 9.3.0.00012, the hardware I use is TMS570LS31x HDK board.
I use the UART Bootloader project provided by QJ Wang.(Special thanks to QJ Wang's help!)
Here's the URL: e2e.ti.com/.../869521

This UART Bootloader project can only update and store an application in Flash by default.
And I want to modify it to Dual-application Bootloader, which can update and store two applications.
The main menu of the Dual-application Bootloader can update or launch the specified application.

I have compared the official TI manual "UART Bootloader for Hercules TMS570LS31x MCU" and the source code of the UART Bootloader, but I don't know what to do.
I don't know how to allocate the memory address of the UART Bootloader to the two applications,
and I'm not sure if this is related to the Flag(jump to the application code) and Ymodem protocol settings.

How can I change the default UART Bootloader project to Dual-application Bootloader?
Please provide me some knowledge or suggestions, thanks!


Thanks for your help!

Best Regards, Chen Yan-Li

  • Hello Yan-Li,

    Ymodem protocol can transmit 2 files. You have to ymodem.c in bootloader to handle two files and program those two files to different locations. Please refer to the Ymodem ptotocol.

  • Hello QJ Wang,

    Thanks for your reply!
    I study the bl_ymodem.c file in Bootloader you suggested.
    Looks like what you mean is that I can generate two applications with different memory location settings,
    and then I use the Ymodem transfer option to transfer the .bin file twice.
    But I have a few questions about the application that I can't figure out.

    For example, the following is the Main Menu of the UART Bootloader:
    =========Main Meun=========
    1.Download Application Image To the Internal Flash
    2.Upload The Application Image From the Internal Flash
    3.Execute The Application Code
    4.Get Bootloader Version
    5.Get Device Information
    ===========================

    Suppose I generate "application X" with memory start position set to 0x00010100 and "application Y" with 0x00020000.
    Then use option 1 (Download Application Image To the Internal Flash) to transfer "application Y" and "application X".
    will the content of "application X" overwrite the content of "application Y"? (Assuming application Y is transmitted first, then X)

    And the main menu of the Bootloader has only one option to execute the application, it seems impossible to choose another application.
    Does it mean that I need a new option to execute another application?
    Do I need to define another App_START_ADDRESS in bl_config?


    Thanks for your help!

    Best Regards, Chen Yan-Li

  • Hello,

    1. You can change the application start address in bl_config.h for application #2, then re-compile/load the bootloader, then load/program the application #2

        BTW, the CCS flash load option should be set: erase the necessary flash only

    2. 2nd way, to add 2nd option to main menu, for example 6. Download 2nd Application Image To the internal Flash, then modify the code 

    void UpdaterUART(void)
    {
    char key = 0;

    while (1)
    {
    // LITE_TOPRIGHT_LED;
    UART_putString(UART, "\r================== Main Menu ==========================\r\n");
    UART_putString(UART, " 1. Download Application Image To the Internal Flash \r\n");
    UART_putString(UART, " 2. Upload The Application Image From the Internal Flash \r\n");
    UART_putString(UART, " 3. Execute The Application Code \r\n");
    UART_putString(UART, " 4. Get Bootloader Version \r\n");
    UART_putString(UART, " 5. Get Device Information \r\n");

    UART_putString(UART, " 6. Download 2nd Application Image To the Internal Flash \r\n");

    UART_putString(UART, "=======================================================\r\n\n");

    key = UART_getKey(UART);

    if (key == 0x31)
    {
    /* Download user application in the Flash */
    UART_Download();
    }
    else if (key == 0x32)
    {
    /* Upload user application from the Flash */
    UART_Upload();
    }
    else if (key == 0x33)
    {
    UART_putString(UART, "The application is running now !! \n\r\n\r");
    JumpAddress = (uint32_t)APP_START_ADDRESS;
    ((void (*)(void))JumpAddress)();
    }
    else if (key == 0x34)
    {
    get_software_Version();
    }
    else if (key == 0x35)
    {
    get_hardware_Info();
    }
    else if (key == 0x36)
    {
    UART_putString(UART, "Invalid Number !! \n\r\n\r");
    }

    else if (key == 0x37)
    {
       .. redefine the APP_START_ADDRESS

       UART_Download();
    }
    }
    }

  • Hello QJ Wang,

    Thanks for your help!
    I have followed your suggestion and made the following changes in the bl_uart.c file of Bootloader:

    else if (key == 0x36)
    {
    /* Download user 2nd Application in the Flash */
    UART_Download_2();
    }

    else if (key == 0x37)
    {
    UART_putString(UART, "The 2nd Application is running now !! \n\r\n\r");
    JumpAddress = (uint32_t)APP_START_ADDRESS_2;
    ((void (*)(void))JumpAddress)();
    }

    else
    {
    UART_putString(UART, "Invalid Number !! \n\r\n\r");
    }

    Then I can display the following Main Menu of the Bootloader through HyperTerminal:
    ================== Main Menu ==========================
    1. Download Application Image To the Internal Flash
    2. Upload The Application Image From the Internal Flash
    3. Execute The Application Code
    4. Get Bootloader Version
    5. Get Device Information
    6. Download 2nd Application Image To the Internal Flash
    7. Execute 2nd Application Code
    =======================================================

    This Bootloader can choose two application I want to download or execute it.
    But I found that the application would overwrite the Flash memory space of another application.

    Here is what I actually encountered:
    The size of "application X" and "application Y" viewed in the PC is 90kB and 27kB (decimal).
    The APP_START_ADDRESS and APP_START_ADDRESS_2 I set in the Bootloader is 0x00010100 and 0x00020000.

    In theory, the memory size of 1nd application cannot exceed the 38kB (decimal) size between two applications.
    As I expected, if the memory start address of "Application Y" is set to 0x00010100, and "Application X" with 0x00020000,
    both applications will run correctly.
    But if I download the "application X" to memory start address of 0x00010100",
    the "application Y" with memory start address at 0x00020000 will not work properly.

    Obviously, the capacity of the "application X" is too large, causing the content of the "application Y" to be overwritten.
    Is there any way to avoid this situation, to limit over-capacity applications and protect the application space that may be overwritten.


    Thanks for your help!

    Best Regards, Chen Yan-Li