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.

TMS570LS3137: Jump from Bootloader to Application

Part Number: TMS570LS3137

Hello. I´m doing the bootloader from my board. I don´t know how to jump from my Bootloader program to the Application program. I have some questions about this.

I tried the following line, but I was not successful.

systemREG1-> SYSECR = 0x00020000;

I left my profram, if it helps. Thank you very much for your time.

  • Please refer to TI bootloader example:

    http://software-dl.ti.com/hercules/hercules_docs/latest/hercules/Examples/Examples.html#bootloader

    You can jump to the location at APP_START_ADDRESS

    g_ulTransferAddress = (uint32_t)APP_START_ADDRESS;
    ((void (*)(void))g_ulTransferAddress)();

  • Hello QJ Wang, thans for reply me. I'm using the link you gave me. Now I was able to record the data, but when I do the memory jump, I get a undefEntry. I don't know why, but I think my error may be in the .cmd. I leave the .cmd files:

    .cmd from Bootloader:

    --retain="*(.intvecs)"

    /* USER CODE BEGIN (1) */
    /* USER CODE END */

    /*----------------------------------------------------------------------------*/
    /* Memory Map */

    MEMORY
    {

    VECTORS (X) : origin=0x00000000 length=0x00000020 vfill = 0xffffffff
    FLASH0 (RX) : origin=0x00000020 length=0x180000-0x20 vfill = 0xffffffff
    FLASH1 (RX) : origin=0x00180000 length=0x00180000 vfill = 0xffffffff
    SRAM (RW) : origin=0x08002000 length=0x0002D000
    STACK (RW) : origin=0x08000000 length=0x00002000

    /* USER CODE BEGIN (2) */
    #if 1
    ECC_VEC (R) : origin=(0xf0400000 + (start(VECTORS) >> 3))
    length=(size(VECTORS) >> 3)
    ECC={algorithm=algoL2R5F021, input_range=VECTORS}

    ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASH0) >> 3))
    length=(size(FLASH0) >> 3)
    ECC={algorithm=algoL2R5F021, input_range=FLASH0 }

    ECC_FLA1 (R) : origin=(0xf0400000 + (start(FLASH1) >> 3))
    length=(size(FLASH1) >> 3)
    ECC={algorithm=algoL2R5F021, input_range=FLASH1 }
    #endif
    /* USER CODE END */

    }

    /* USER CODE BEGIN (3) */
    ECC
    {
    algoL2R5F021 : address_mask = 0xfffffff8 /* Address Bits 31:3 */
    hamming_mask = R4 /* Use R4/R5 build in Mask */
    parity_mask = 0x0c /* Set which ECC bits are Even and Odd parity */
    mirroring = F021 /* RM57Lx and TMS570LCx are build in F021 */
    }
    /* USER CODE END */


    /*----------------------------------------------------------------------------*/
    /* Section Configuration */

    SECTIONS
    {
    .intvecs : {} > VECTORS


    flashAPI:
    {
    .\source\Fapi_UserDefinedFunctions.obj (.text)
    .\source\bl_flash.obj (.text)
    --library= "c:\ti\Hercules\F021 Flash API\02.01.01\F021_API_CortexR4_BE_V3D16.lib" (.text)
    // --library= "c:\ti\Hercules\F021 Flash API\02.01.01\F021_API_CortexR4_BE.lib" (.text)
    } palign=8 load = FLASH0, run = SRAM, LOAD_START(apiLoadStart), RUN_START(apiRunStart), SIZE(apiLoadSize)

    .text : {} > FLASH0 /*Initialized executable code and constants*/
    .const : {} load=FLASH0, run = SRAM, LOAD_START(constLoadStart), RUN_START(constRunStart), SIZE(constLoadSize)

    .cinit : {} > FLASH0 /*Initialized global and static variables*/
    .pinit : {} > FLASH0
    .data : {} > SRAM
    .bss : {} > SRAM /*Uninitialized Global and static variables */
    .sysmem : {} > SRAM

    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }

    .cmd from App:

    --retain="*(.intvecs)"

    /* USER CODE BEGIN (1) */
    /* USER CODE END */

    /*----------------------------------------------------------------------------*/
    /* Memory Map */

    MEMORY
    {
    // VECTORS (X) : origin=0x00000000 length=0x00000020
    // FLASH0 (RX) : origin=0x00000020 length=0x0017FFE0
    // FLASH1 (RX) : origin=0x00180000 length=0x00180000
    // STACKS (RW) : origin=0x08000000 length=0x00001500
    // RAM (RW) : origin=0x08001500 length=0x0003EB00

    VECTORS (X) : origin=0x00010020 length=0x00000020 //APP_START_ADDRESS = 0x10020
    /*sectors 4/5 are used for application*/
    FLASH_CODE (RX) : origin=0x00010040 length=0x8000 - 0x40 fill=0xFFFFFFFF
    FLASH0 (RX) : origin=0x00018000 length=0x00200000 - 0x18000
    FLASH1 (RX) : origin=0x00200000 length=0x00200000
    STACKS (RW) : origin=0x08000000 length=0x00001500
    RAM (RW) : origin=0x08001500 length=0x0007EB00

    // VECTORS (X) : origin=0x00020000 length=0x00000020
    // FLASH0 (RX) : origin=0x00020020 length=0x0015FFE0
    // FLASH1 (RX) : origin=0x00180000 length=0x00180000
    // STACKS (RW) : origin=0x08000000 length=0x00001500
    // RAM (RW) : origin=0x08001500 length=0x00026B00

    // VECTORS (X) : origin=0x00010020 length=0x00000020 //APP_START_ADDRESS = 0x10020
    // FLASH0 (RX) : origin=0x00010040 length=0x0007FFC0
    // STACKS (RW) : origin=0x08000000 length=0x00001500
    // RAM (RW) : origin=0x08001500 length=0x0003EB00

    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    }

    /* USER CODE BEGIN (3) */
    /* USER CODE END */


    /*----------------------------------------------------------------------------*/
    /* Section Configuration */

    SECTIONS
    {
    .intvecs : {} > VECTORS
    .text : {} > FLASH0 | FLASH1
    .const : {} > FLASH0 | FLASH1
    .cinit : {} > FLASH0 | FLASH1
    .pinit : {} > FLASH0 | FLASH1
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM

    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }

    I leave the files too.

    APP.rar

    8372.Bootloader.rar

    Thanks a lot !!!

  • I think that the undefEntry is caused by the invalid instruction fetched from 0x10020.

    Please check if the application has been programmed to memory staring at 0x10020 (APP_START_ADDRESS defined in bl_config.h).

  • Hi QJ Wang, thanks for your reply.

    I reprogram my Application .cmd:


    --retain="*(.intvecs)"

    /* USER CODE BEGIN (1) */
    /* USER CODE END */

    /*----------------------------------------------------------------------------*/
    /* Memory Map */

    MEMORY
    {

    VECTORS (X) : origin=0x00010020 length=0x00000020 //APP_START_ADDRESS = 0x10020
    FLASH0 (RX) : origin=0x00010040 length=0x0007FFC0
    STACKS (RW) : origin=0x08000000 length=0x00001500
    RAM (RW) : origin=0x08001500 length=0x0003EB00
    }


    /*----------------------------------------------------------------------------*/
    /* Section Configuration */

    SECTIONS
    {

    .intvecs : {} > VECTORS
    .text : {} > FLASH0
    .const : {} > FLASH0
    .cinit : {} > FLASH0
    .pinit : {} > FLASH0
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM


    FEE_TEXT_SECTION : {} > FLASH0
    FEE_CONST_SECTION : {} > FLASH0
    FEE_DATA_SECTION : {} > RAM
    }

    But I get the same undefEntry error. Do you have an example to an Binary image or their .cmd? 

    My .cmd and sys_intvecs.asm from my Bootloader is the next:

    /* Linker Settings */
    --retain="*(.intvecs)"

    /* USER CODE BEGIN (1) */
    /* USER CODE END */

    /*----------------------------------------------------------------------------*/
    /* Memory Map */

    MEMORY
    {

    VECTORS (X) : origin=0x00000000 length=0x00000020 vfill = 0xffffffff
    FLASH0 (RX) : origin=0x00000020 length=0x00010000 vfill = 0xffffffff
    FLASH1 (RX) : origin=0x00010020 length=0x07FF1FE0 vfill = 0xffffffff
    SRAM (RW) : origin=0x08002000 length=0x00002000
    STACK (RW) : origin=0x08004000 length=0x00002000

    /* USER CODE BEGIN (2) */
    #if 1
    ECC_VEC (R) : origin=(0xf0400000 + (start(VECTORS) >> 3))
    length=(size(VECTORS) >> 3)
    ECC={algorithm=algoL2R5F021, input_range=VECTORS}

    ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASH0) >> 3))
    length=(size(FLASH0) >> 3)
    ECC={algorithm=algoL2R5F021, input_range=FLASH0 }

    ECC_FLA1 (R) : origin=(0xf0400000 + (start(FLASH1) >> 3))
    length=(size(FLASH1) >> 3)
    ECC={algorithm=algoL2R5F021, input_range=FLASH1 }
    #endif
    /* USER CODE END */

    }

    /* USER CODE BEGIN (3) */
    ECC
    {
    algoL2R5F021 : address_mask = 0xfffffff8 /* Address Bits 31:3 */
    hamming_mask = R4 /* Use R4/R5 build in Mask */
    parity_mask = 0x0c /* Set which ECC bits are Even and Odd parity */
    mirroring = F021 /* RM57Lx and TMS570LCx are build in F021 */
    }
    /* USER CODE END */


    /*----------------------------------------------------------------------------*/
    /* Section Configuration */

    SECTIONS
    {
    .intvecs : {} > VECTORS


    flashAPI:
    {
    .\source\Fapi_UserDefinedFunctions.obj (.text)
    .\source\bl_flash.obj (.text)
    --library= "c:\ti\Hercules\F021 Flash API\02.01.01\F021_API_CortexR4_BE_V3D16.lib" (.text)
    // --library= "c:\ti\Hercules\F021 Flash API\02.01.01\F021_API_CortexR4_BE.lib" (.text)
    } palign=8 load = FLASH0, run = SRAM, LOAD_START(apiLoadStart), RUN_START(apiRunStart), SIZE(apiLoadSize)

    .text : {} > FLASH0 /*Initialized executable code and constants*/
    .const : {} load=FLASH0, run = SRAM, LOAD_START(constLoadStart), RUN_START(constRunStart), SIZE(constLoadSize)

    .cinit : {} > FLASH0 /*Initialized global and static variables*/
    .pinit : {} > FLASH0
    .data : {} > SRAM
    .bss : {} > SRAM /*Uninitialized Global and static variables */
    .sysmem : {} > SRAM

    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }

    And my .cmd from Bootloader

    .sect ".intvecs"
    .arm

    ;-------------------------------------------------------------------------------
    ; import reference for interrupt routines

    .ref _c_int00
    .ref _dabort
    .ref phantomInterrupt
    .def resetEntry

    ;-------------------------------------------------------------------------------
    ; interrupt vectors

    resetEntry
    b _c_int00
    undefEntry
    b undefEntry
    svcEntry
    b svcEntry
    prefetchEntry
    b prefetchEntry
    b _dabort
    b phantomInterrupt
    ldr pc,[pc,#-0x1b0]
    ldr pc,[pc,#-0x1b0]

    Again, thank you very much for your time.

  • Attached is an example of application image which should be programmed to 0x20020:

    TMS570LSx_rtiBlinky_BL_APP20020.zip

  • Thank you very much QJ Wang, I am really grateful for your help. I was able to make the bootloader work, passing the binary image through an Arduino with an MCP2515. I´ll upload the complete proyect, in case it helps someone.

  • Thanks Federico!