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/TM4C1294NCPDT: Upgrade the firmware using UART and Tivaware bootloader

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: EK-TM4C1294XL

Tool/software: Code Composer Studio

Hi,

Currently we are loading TM4C1294 firmware directly using TI JTAG programmer and no bootloader is involved. In final design, TM4C1294 is connected with
embedded CPU through UART interface. I'm trying to bringup the bootloader so that we could do firmware update from embedded CPU through UART interface.

I came across the boot_serial example under ek-tm4c1294xl and boot_demo_uart example under ek-tm4c129x boards in TivaWare_C_Series-2.1.3.156 version. 
Based on older community thread decided to follow boot_serial example under ek-tm4c1294xl. At this point I have following questions and can you help to clarify
the details?

1. Do you have CCS project for the boot_serial?

2. Can you provide the steps to build and load the bootloader using CCS on the TM4C1294?

3. How do I know bootloader is loaded successfully? Once I load the bootloader on the board, can I access 
    the bootloader prompt through JTAG or UART interface?

4. What changes do I need to make in the current firmware to load the firmware from the bootloader?

5. How do I copy the firmware from the embedded CPU to TM4C1294 through UART interface after bootloader is loaded?

Currently I'm stuck with this problem. I appreciate your prompt help. Let me know if any other information is needed.

Thanks,
Senthil

  • Senthil Paramasivam said:

    1. Do you have CCS project for the boot_serial?

    2. Can you provide the steps to build and load the bootloader using CCS on the TM4C1294?

     In TivaWare library you can find the boot_serial and boot_demo1 under the example folder. You don't need to rebuild them. The .out file is already there. If you make modification to the examples then you will rebuild them just like building any projects. 

    Senthil Paramasivam said:
    3. How do I know bootloader is loaded successfully? Once I load the bootloader on the board, can I access 
        the bootloader prompt through JTAG or UART interface?

      You will need to load the bootloader using the JTAG interface. Once the bootloader is loaded it is waiting for the firmware to be loaded. You can use the LM flash programmer and select the UART interface to load the firmware to the MCU.

    Senthil Paramasivam said:

    4. What changes do I need to make in the current firmware to load the firmware from the bootloader?

    If you are using the boot_demo1 then there is nothing to change. In the LM flash programmer just specify location to the boot_demo1.bin and click the program button. The bootloader will transfer the boot_demo1 firmware image and program into flash. You can look at how the boot_demo1 source code and reference it to build your own firmware.

    Senthil Paramasivam said:

    5. How do I copy the firmware from the embedded CPU to TM4C1294 through UART interface after bootloader is loaded?

     What is the embedded CPU? Can it run the LM flash programmer? The LM flash programmer is Windows program. If you cannot run LM flash programmer on your embedded CPU then you will need to build your own. You might want to look at the source code of sflash utility that comes with the TivaWare library and see if you can adapt to your embedded CPU.

  • Hi Charles,

    Thanks for the prompt response.

    I have MSP-EXP432P401R which is connected with the CCS. I tried loading boot_serial.out from the CCS and it went through without any
    errors hence I assume it was successful then tried loading boot_demo1.out from the CCS and device got locked up with the following
    errors,

    CORTEX_M4_0: Can't Run Target CPU: (Error -1268 @ 0x1090001) Device is locked up in Hard Fault or in NMI. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 7.0.188.0)

    In the current experiment, I don't have embedded CPU. Programmer is directly connected to the TM4C1294 MCU through JTAG. Hence I thought we don't need LM flash programmer. Am I missing any steps to load it from CCS? I'm planning to try with embedded CPU next after validating this step with CCS.

    Let me know if I need to try any other steps.

    Thanks,
    Senthil
  • Hi,

     The boot_demo1 is an application starting at address 0x4000 while the bootloader is loaded to the flash starting at address 0x0. I think what might have happened was than you you load the boot_demo1 using CCS, the CCS first erases the entire flash and thus wiping out the bootloader. By the end of the loading, only boot_demo1 appears at 0x4000 but the bootloader starting at 0x0 is gone. You can verify this by looking the memory browser window to see if the boot_demo1 is present at 0x4000 and if the bootloader at 0x0 is erased to all F's.

     With that said, to load the boot_demo1 you want to prevent CCS from erasing the entire flash which is the default when loading a new program. See below and change to the  "Necessary Pages Only" for the Erase Method.

  • Hi Charles,

    After changing to "Necessary Pages Only" option, I don't see device lock up anymore and not sure whether boot_demo1 working fine since it doesn't have any prints on the UART debug port. Just to double check I thought of adding UARTprintf() right after SetupForUART() in boot_demo1.c. I hope UARTprintf() should work in that place. Pls confirm. Also can you provide sample CCS project file for rebuilding and loading boot_demo1 from CCS? I tried opening boot_demo1 as project but CCS doesn't recognize as a valid CCS project hence not able to build or load from the CCS.

    Regarding sflash utility, can I cross compile the code as is for embedded CPU and run it in the ubuntu? Do I need to pass UART port number
    in the sflash utility?

    I'm planning to follow the below steps for loading the firmware from embedded CPU,

    1. Once the TM4C1294 is powered up, it will automatically load bootloader (boot_serial.out) from the flash 0x0 address and will wait for the UART communication.

    2. Copy the firmware from embedded CPU using the following command,
    sflash test.bin -p 0x4000 -r 0x820 -c tty0

    3. Since I have serial debug port is connected with the MCU UART, I should be able to see the prints if load is successful.

    pls correct if I'm missed any other steps to complete the UART boot.

    Thanks,
    Senthil
  • If you have successfully loaded the boot_demo1 then you should see the LED toggling. Or you can go to address 0x4000 in the memory browser and you should see the boot_demo1 being loaded there.

    Have you downloaded the latest TivaWare. The entire CCS project for the boot_demo1, boot_demo2 and boot_serial should all be there in the TivaWare library. In CCS, you just need to import these CCS projects and you can rebuild them anytime once they are imported to your workspace.

    Senthil Paramasivam said:
    1. Once the TM4C1294 is powered up, it will automatically load bootloader (boot_serial.out) from the flash 0x0 address and will wait for the UART communication.

     Yes. If you are using LM flash programmer then after you press the "Program" button in the Program tab, the boot_demo1.bin will be downloaded to the flash. See below images.

     

    Senthil Paramasivam said:
    2. Copy the firmware from embedded CPU using the following command,
    sflash test.bin -p 0x4000 -r 0x820 -c tty0

    I never tried sflash myself but it should work. You should specify the Virtual COM port number with the -c switch. 

    Senthil Paramasivam said:
    3. Since I have serial debug port is connected with the MCU UART, I should be able to see the prints if load is successful.

      I will suggest you start with the LM flash programmer first before you use the sflash and just try the example as is first. 

  • Hi Charles,

    After loading boot_demo1 from CCS (Run -> Load -> Select Program to Load -> boot_demo1.out), I don't see any LED toggle and also not able to capture any entries on the memory browser since program is getting terminated.

    Currently I have Tivaware library 2.1.3.15 and I do see boot_demo1, boot_demo2 and boot_serial under following path (ti/TivaWare_C_Series-2.1.3.156/examples/boards/ek-tm4c1294xl/).

    When I did the "import CCS projects" for boot_demo1, I'm getting following error message,
    ""Error: Import failed for project 'boot_demo1' because its meta-data cannot be interpreted. Please contact support.""

    Am I missing any other steps?

    Since I'm MAC user, I'm not using LM flash programmer instead directly using CCS v8 to program the flash. Once I validate the boot_demo1, planning to directly switch to sflash. As I mentioned before, planning to cross compile sflash to run from the embedded CPU linux. How do I get the Virtual COM port number on the embedded CPU which is running ubuntu distribution?

    I appreciate your prompt responses.

    Thanks,
    Senthil
  • Please download the latest TivaWare and try again. If you don't see the boot_demo1 at 0x4000 in the memory browser then the firmware is not loaded properly. I don't see this issue at all. If you do have both the bootloader as well as the boot_demo1 loaded then you want to first reset your device. After reset, the bootloader will first check if there the application is present at 0x4000 by checking if the stack pointer and reset vector are non-F's. If these two entries are non F's then it indicates to the bootloader that the application firmware is already present. The bootloader will just jump to the application boot_demo1 and start executing it.
  • Hi,
    Is your problem resolved?
  • Hi,
    Is your problem resolved? I'm going to close this thread. If you have further questions, you are welcome to open a new thread.