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.

TM4C123FE6PM: TM4C123FE6PM bootloader

Part Number: TM4C123FE6PM
Other Parts Discussed in Thread: UNIFLASH,

Hi,

I am have spent a lot of time on this and i am hoping for a more detailed answer than read the manual because i have many times or look at the example because that is what this is all based on.

I have a flash bootloader that i have written based on the boot_loader examples.  i have a windows application that communicates with it and updates the firmware.

Here is the structure of my project, boot_serial is the bootloader and QTIM is the application.

I have setup the bootloader at address 0x00000000 and the application at 0x00000000 for debug cmd and APP_BASE of 0x00004000 for the release cmd version.  

When i run my application it communicates and updates with the bootloader correctly, and when i read the memory after the update using Uniflash here is the bootloader section and application section:

The SP in the map file for the bootloader is at the reset vector for the bootloader and the SP for QTIM is at address 4000.

After the update the board doesnt function at all.  If i load the debug version of application everything runs fine.  If i load the bootloader (via CCS) and flash the firmware it is all in the correct locations.  The file i am flashing is the release version of application and based on the map file the addresses line up with what is written in Uniflash for the SP.

any suggestions on what the issue could be or what i should test?


Thanks,

Dustin

  • To add to this. When the flash update is done i get Device Configured out of the serial port which means it entered bootloader and when i connect to the board Updater responds which means it is still in the bootloader not in the application thus the code for checking if a valid application image is intact and exiting if it is must not be working. This is the source:
    checking memory with Uniflash the area:
    //
    // See if the first location is 0xfffffffff or something that does not
    // look like a stack pointer, or if the second location is 0xffffffff or
    // something that does not look like a reset vector.
    //
    pui32App = (uint32_t *)APP_START_ADDRESS;
    if((pui32App[0] == 0xffffffff) ||
    ((pui32App[0] & 0xfff00000) != 0x20000000) ||
    (pui32App[1] == 0xffffffff) ||
    ((pui32App[1] & 0xfff00001) != 0x00000001))
    {
    return(1);
    }
    should exit because that is not at the APP_START_ADDRESS


    uint32_t
    CheckForceUpdate(void)
    {
    #ifdef CHECK_CRC
    uint32_t ui32Retcode;
    #endif

    #ifdef BL_CHECK_UPDATE_FN_HOOK
    //
    // If the update check function is hooked, call the application to determine
    // how to proceed.
    //
    return(BL_CHECK_UPDATE_FN_HOOK());
    #else
    uint32_t *pui32App;

    #ifdef ENABLE_UPDATE_CHECK
    g_ui32Forced = 0;
    #endif

    //
    // See if the first location is 0xfffffffff or something that does not
    // look like a stack pointer, or if the second location is 0xffffffff or
    // something that does not look like a reset vector.
    //
    pui32App = (uint32_t *)APP_START_ADDRESS;
    if((pui32App[0] == 0xffffffff) ||
    ((pui32App[0] & 0xfff00000) != 0x20000000) ||
    (pui32App[1] == 0xffffffff) ||
    ((pui32App[1] & 0xfff00001) != 0x00000001))
    {
    return(1);
    }

    //
    // If required, scan the image for an embedded CRC and ensure that it
    // matches the current CRC of the image.
    //
    #ifdef CHECK_CRC
    InitCRC32Table();
    ui32Retcode = CheckImageCRC32(pui32App);

    //
    // If ENFORCE_CRC is defined, we only boot the image if the CRC is
    // present in the image information header and the value calculated
    // matches the value in the header. If ENFORCE_CRC is not defined, we
    // the image if the CRC is good but also if the length field of the header
    // is zero (which typically indicates that the post-build step of running
    // binpack to add the length and CRC to the header was not run).
    //
    #ifdef ENFORCE_CRC
    if(ui32Retcode != CHECK_CRC_OK)
    #else
    if((ui32Retcode != CHECK_CRC_OK) && (ui32Retcode != CHECK_CRC_NO_LENGTH))
    #endif
    {
    //
    // The CRC32 image check failed indicating that the image is
    // corrupt (or doesn't have the CRC embedded correctly). Either way,
    // fail the update check and force the boot loader to retain control.
    //
    return(2);
    }
    #endif

    #ifdef ENABLE_UPDATE_CHECK
    //
    // If simple GPIO checking is configured, determine whether or not to force
    // an update.
    //
    return(CheckGPIOForceUpdate());
    #else
    //
    // GPIO checking is not required so, if we get here, a valid image exists
    // and no update is needed.
    //
    return(0);
    #endif
    #endif
    }
  • Hello Dustin,

    The first thing that sticks out to me is you have declared a length of available flash space far larger than your MCU's capability. Hex 40000 would indicate 262,144 bytes of memory available but the TM4C123FE6PM is a 128kB flash device. Please fix that length to match your MCU's capabilities first and foremost. There is a chance that could be the issue if memory that doesn't exist is being attempted to be accessed.

    Now then, you stated the following:

    dustin cairns said:
    I have setup the bootloader at address 0x00000000 and the application at 0x00000000 for debug cmd and APP_BASE of 0x00004000 for the release cmd version.  

    I want to make sure I understand this better.

    Case 1) Release version, Boot loader is used, and the code loaded via boot loader has an APP_BASE of 0x00004000 and should start execution from 0x00004000

    Case 2) Debug version, no boot loader is being used, application code is set to 0x00000000, and it runs fine like this

    Am I correct in understanding these two cases and how the addresses change for each case?

    What interface is being used with the serial boot loader? USB? UART?

    You mention a custom application is downloading the code, how have you verified your custom application is performing it's job correctly?

    Right now based on the problem presentation I could see the issue laying in either the custom application or the boot loader, so trying to narrow down which is the root cause would be beneficial.

  • Ralph,
    I fixed a bunch of issues that i had as well as an error that i did't realize was occurring when clearing flash before programming a new image. Once this was done everything worked.
    Thanks,
    Dustin
  • Hi Dustin,

    Thanks for the update, glad to hear you got everything working! I will go ahead and close out this thread then.