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.

EK-TM4C123GXL: Implementation of user bootloader

Part Number: EK-TM4C123GXL

Hi All:

I had a problem at my user bootloader project switch to  app project.

Does someone can help me? Thanks

My App project is run with TI-RTOS

App project .cmd

ENTRY POINT SYMBOL: "_c_int00"  address: 00003501

MEMORY
{
    FLASH (RX) : origin = 0x00000000, length = 0x0003d800
    SRAM (RWX) : origin = 0x20000000, length = 0x00008000
}

/* Section allocation in memory */

SECTIONS
{
    .text   :   > FLASH
    .const  :   > FLASH
    .cinit  :   > FLASH
    .pinit  :   > FLASH
    .init_array : > FLASH

    .data   :   > SRAM
    .bss    :   > SRAM
    .sysmem :   > SRAM
    .stack  :   > SRAM
}

Boot loader projcet .cmd

ENTRY POINT SYMBOL: "_c_int00"  address: 0003dd7d

#define APP_BASE 0x0003d800
#define RAM_BASE 0x20000000

/* System memory map */

MEMORY
{
    /* Application stored in and executes from internal flash */
    FLASH (RX) : origin = APP_BASE, length = 0x00002800
    /* Application uses internal RAM for data */
    SRAM (RWX) : origin = 0x20000000, length = 0x00008000
}

/* Section allocation in memory */

SECTIONS
{
    .intvecs:   > APP_BASE
    .text   :   > FLASH
    .const  :   > FLASH
    .cinit  :   > FLASH
    .pinit  :   > FLASH
    .init_array : > FLASH

    .vtable :   > RAM_BASE
    .data   :   > SRAM
    .bss    :   > SRAM
    .sysmem :   > SRAM
    .stack  :   > SRAM
}

__STACK_TOP = __stack + 512;

How to switch those projects?

Follow is my code, but not work

void
JumpToBootLoader(void)
{

    //
    // Disable all processor interrupts.  Instead of disabling them
    // one at a time, a direct write to NVIC is done to disable all
    // peripheral interrupts.
    //
    HWREG(NVIC_DIS0) = 0xffffffff;
    HWREG(NVIC_DIS1) = 0xffffffff;

    //
    // Return control to the boot loader.  This is a call to the SVC
    // handler in the boot loader.
    //
    (*((void (*)(void))(*(uint32_t *)0x0003dd7d)))();
}
void
JumpToBootLoader(void)
{
    //
    // Disable all processor interrupts.  Instead of disabling them
    // one at a time, a direct write to NVIC is done to disable all
    // peripheral interrupts.
    //
    HWREG(NVIC_DIS0) = 0xffffffff;
    HWREG(NVIC_DIS1) = 0xffffffff;

    //
    // Return control to the boot loader.  This is a call to the SVC
    // handler in the boot loader.
    //
    (*((void (*)(void))(*(uint32_t *)0x00003501)))();
}

  • Hello Andy,

    Your second JumpToBootLoader uses 0x00003501 but you only have space defined from 0x00000000 to 0x00002800.

    Please check carefully your .cmd file setups and your boot loader calls.

    If you need to get to 0x00003501, then you will need to expand the size of the code space reserved for your second project.
  • Hi Ralph:

    Thanks for your reply.

    I redefine my .cmd files. and modify my jump function,but still jump to wrong address.

    Follow is my new setting.

    Boot loader projcet .cmd

    ENTRY POINT SYMBOL: "_c_int00"  address: 0003dd79

    #define APP_BASE 0x00000000
    #define RAM_BASE 0x20000000
    #define BOOT_BASE 0x0003d800
    /* System memory map */
    
    MEMORY
    {
        /* Application stored in and executes from internal flash */
        FLASH (RX) : origin = BOOT_BASE, length = 0x00002800
        /* Application uses internal RAM for data */
        SRAM (RWX) : origin = 0x20000000, length = 0x00008000
    
        APP_FLASH  : origin = APP_BASE, length = 0x0003d800
    }
    
    /* Section allocation in memory */
    
    SECTIONS
    {
        .intvecs:   > BOOT_BASE
        .text   :   > FLASH
        .const  :   > FLASH
        .cinit  :   > FLASH
        .pinit  :   > FLASH
        .init_array : > FLASH
    
        .vtable :   > RAM_BASE
        .data   :   > SRAM
        .bss    :   > SRAM
        .sysmem :   > SRAM
        .stack  :   > SRAM
    }
    
    __STACK_TOP = __stack + 512;

    App projcet .cmd

    ENTRY POINT SYMBOL: "_c_int00"  address: 00003501

    MEMORY
    {
        FLASH (RX) : origin = 0x00000000, length = 0x0003d800
        SRAM (RWX) : origin = 0x20000000, length = 0x00008000
        BOOT_FLASH : origin = 0x0003d800, length = 0x00002800
    }
    
    /* Section allocation in memory */
    
    SECTIONS
    {
        .text   :   > FLASH
        .const  :   > FLASH
        .cinit  :   > FLASH
        .pinit  :   > FLASH
        .init_array : > FLASH
    
        .data   :   > SRAM
        .bss    :   > SRAM
        .sysmem :   > SRAM
        .stack  :   > SRAM
    }

    App jump to Boot loader(My App project is running with TI-RTOS ,and i added System_atexit, BIOS_exit functions)

    System_atexit( JumpToBootLoader );
    BIOS_exit(0);

    void
    JumpToBootLoader(int val)
    {
    
        //
        // Disable all processor interrupts.  Instead of disabling them
        // one at a time, a direct write to NVIC is done to disable all
        // peripheral interrupts.
        //
        HWREG(NVIC_DIS0) = 0xffffffff;
        HWREG(NVIC_DIS1) = 0xffffffff;
    
        //
        // Return control to the boot loader.  This is a call to the SVC
        // handler in the boot loader.
        //
        (*((void (*)(void))(*(uint32_t *)0x0003dd79)))();
    }

    but my CCS show this message. (No source available for "0xce5188f6") 

  • Hi,
    Why don't you use ROM based boot loader ?? Calling ROMupdateUART() is easier.
    regards,
    Digvijay
  • Hi Digijay:

    My Uart0 has other feature,can't be change.

    Thanks for your suggestion.
  • Hi Ralph:

    I reference follow question had success jump to bootloader project(None TI-RTOS project)

    HWREG(NVIC_VTABLE) = 0x0003d800;
        __asm(" ldr r1, [r0]\n"
        " mov sp, r1");
    
        __asm(" ldr r0, [r0, #4]\n"
        " bx r0\n");

    but, use the same way i can't jump to App project(TI-RTOS) from bootloader.

    Is the NVIC VTABLE is difference address with TI-RTOS project?

    Follow is my code,but not work.

    HWREG(NVIC_VTABLE) = 0x00000000;
        __asm(" ldr r1, [r0]\n"
        " mov sp, r1");
    
        __asm(" ldr r0, [r0, #4]\n"
        " bx r0\n");

  • Hello Andy,

    I am not sure but I will have an RTOS expert comment on that.
  • Hi Ralph:

    I had success jump to App project(TI-RTOS project)

    Follow is my code.

    Thanks for your help.

        HWREG(NVIC_DIS0) = 0xffffffff;
        HWREG(NVIC_DIS1) = 0xffffffff;
        HWREG(NVIC_DIS2) = 0xffffffff;
        HWREG(NVIC_DIS3) = 0xffffffff;
        HWREG(NVIC_DIS4) = 0xffffffff;
    
        __asm("    movw    r0, #0x0000;"
            "movt    r0, #0x0000;");
            //"ldr     sp, [r0, #0];"
            //"ldr     pc, [r0, #4];"
    
        __asm(" ldr r1, [r0]\n"
            " mov sp, r1");
    
        __asm(" ldr r0, [r0, #4]\n"
        " bx r0\n");