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.

TM4C123GH6PM: Putting bootloader in ROM

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL

Hi Folks,

I'm working on a bootloader and can't seem to figure out how to program the  C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c123gxl\boot_demo_uart_rom.bin file into rom.

I'm using:

But really not sure it is in ROM or flash.

I then load boot_demo1 using CCS, and can even use the debugger to see that it jumps to the bootloader:

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 *)0x2c)))();
}

But I'm not sure if 0x2c should be changed to 0x100 0000  or some other value mapped to ROM.

Assuming the system is really in bootloader mode, I try using the uart to send the desired program and get this message:


I appreciate any feedback.  I know I'm close to getting this working.

thanks,

Bob

  • Hello Bob,

    You cannot program anything in ROM. The ROM firmware is Read Only and exists in every device when we ship it. The ROM boot loader example shows how to call to the ROM boot loader by using the correct preparation to allow the boot loader to execute followed by the proper memory jump to invoke the ROM boot loader.

    The boot_demo1 project is not meant to be used with the ROM boot loader, but rather the Flash boot loader which is boot_serial.

    Best Regards,

    Ralph Jacobi

  • I think I understand.  In order to make my application work with the ROM Bootloader, I would need to have my host send packets following a very specific protocol.  For example breaking the .bin file into 60 byte packets and then listen for each ack.

    Is there a way to have the application running on the TIVA chip to act as a middle man between the host and the ROM Bootloader?   (The host in my application basically downloads a file in 1000byte chucks and needs a commands for the next 1000 bytes.)  

    What example do you recommend to handle everything in flash?  (I'm guessing boot_serial.)  Any links to additional docs or examples would be appreciated.

    thanks,

    Bob

  • Hello Bob,

    I would need to have my host send packets following a very specific protocol.  For example breaking the .bin file into 60 byte packets and then listen for each ack.

    Yes and that protocol is outlined here: https://www.ti.com/lit/pdf/spma074

    Is there a way to have the application running on the TIVA chip to act as a middle man between the host and the ROM Bootloader?   (The host in my application basically downloads a file in 1000byte chucks and needs a commands for the next 1000 bytes.)  

    At that point you should just run a Flash based boot loader. boot_serial would be the starting point but you may need to edit the Flash boot loader itself, that source code can be found in the boot_loader folder in the primary TivaWare directory.

    This document would also be useful for understanding how to use boot loaders on TM4C devices: https://www.ti.com/lit/pdf/spmu301

    Best Regards,

    Ralph Jacobi

  • Thank you.  I was starting to head that way.

    I appreciate the help.

    Bob

  • Ralph,

    One more question.  If I write the new program to 0x20000, what is the command to jump execution to that location?  I was hoping it was something simple like:

    HWREG(NVIC_DIS0) = 0xffffffff;
    HWREG(NVIC_DIS1) = 0xffffffff;

    //
    // trying to jump to application stored at 128K
    //
    (*((void (*)(void))(*(uint32_t *)0x20000)))();

    but that doesn't seem to work.  (I even tried 0x20004 to get past the vector table.)

    Thanks for helping me learn.

    Bob

  • One more question.  If I write the new program to 0x20000, what is the command to jump execution to that location? 

    For ARM Cortex-M devices which only support THUMB mode the least significant bit of a branch address needs to be set to indicate THUMB mode, otherwise a hard fault occurs.

    I.e. try:

    HWREG(NVIC_DIS0) = 0xffffffff;
    HWREG(NVIC_DIS1) = 0xffffffff;
    
    //
    // trying to jump to application stored at 128K
    //
    (*((void (*)(void))(*(uint32_t *)0x20001)))();

    See TMS320F28384S: Code branch in CM4 for some more information.

  • Hello Bob,

    To add to Chester's comment, if you examine the .map file output for a compiled project, you'll see the entry point as well as all your application functions have addresses that start with the least significant bit:

    ENTRY POINT SYMBOL: "_c_int00_noargs" address: 00004625

    Best Regards,

    Ralph Jacobi