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.

TM4C1294NCPDT: Ethernet Bootloader ,boot_demo_emac_rom

Part Number: TM4C1294NCPDT

Tool/software:

Hi Team,

I trying to do firmware upgrade using ethernet bootloader code (boot_demo_emac_rom)(TM4C1294NCPDT),

The firmware upgrade is working fine using LM Flash in Ethernet,

But my requirement is to encrypt the HEX file using 128 bit ECB AES encryption,

The problem is I could not extract the payload that is Hex File DATA in the boot_demo_emac_rom code (swupdate.c file)

Can you please help me to get the payload data from which function, variable in this boot_demo_emac_rom and explain how this project will work 

can You please help me to highlight which function, variable from where I need extract the TFTP Hex file data

I also attached my custom swupdate.c and boot_demo_emac_rom.c  file for your reference

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//*****************************************************************************
//
// swupdate.c - A module wrapping the Ethernet bootloader software update
// functionality.
//
// Copyright (c) 2008-2020 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//*****************************************************************************
//
// boot_demo_emac_rom.c - Example demonstrating the use of the ROM Ethernet
// boot loader.
//
// Copyright (c) 2008-2020 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

And I also have a doubt is there any link between boot_demo_emac_rom  and boot_emac_flash projects and

bl_emac.c file

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//*****************************************************************************
//
// bl_emac.c - Functions to update via Ethernet.
//
// Copyright (c) 2013-2020 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 2.2.0.295 of the Tiva Firmware Development Package.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 

Please help to sort this issue ASAP 

  • Another doubt is how ROM_UpdateEMAC() this function is working ?

  • Hi team i aslo try to run boot_emac_flash but iam strcuk here

     

    I dont know what to do can you help me 

    this is the configuration I made

  • I trying to do firmware upgrade using ethernet bootloader code (boot_demo_emac_rom)(TM4C1294NCPDT),
    The problem is I could not extract the payload that is Hex File DATA in the boot_demo_emac_rom code (swupdate.c file)

    This is using the ROM-based bootloader. In another word, the bootloader is stored in the ROM. I strongly suggest you go through Booloader User's guide the understand the difference between the ROM-based bootloader vs. the flash-based bootloader. https://www.ti.com/lit/pdf/spmu301

    When you run the ROM bootloader, it does NOT execute functions in swupdate.c. When the applications calls ROM_UpdateEMAC(), it jumps to the bootloader code in the ROM. 

    If you need to modify the bootloader as to perform some custom algorithm like encryption or decryption, you would need to run the flash-based bootloader. 

    Another doubt is how ROM_UpdateEMAC() this function is working ?

    As explained above. 

    i aslo try to run boot_emac_flash but iam strcuk here

     

    The  boot_emac_flash is the flash-based bootloader. The bootloader must be first loaded to the flash through the JTAG interface just like any programs such as blinky or hello. Once it is running, it will send out a BOOTP request to the Boot and TFTP server and that is the PC which is running the LM flash programmer. The flash-based bootloader (boot_emac_flash) go along with an example application (boot_demo_emac_flash). The boot_emac_flash and load the boot_demo_emac_flash through the Ethernet port. 

    See below steps to run the flash-based example. 

    Step1: Run the enet_lwip or enet_io to obtain the IP address.  On the terminal window you should see the IP address printed out. Record this address. 

     Step2: Load the boot_emac_flash via the JTAG interface using CCS. This is the bootloader to be loaded at 0x0. 

     Step 3. Bring up the LM flash programmer. See below image. Provide the IP address that you just record in step 1 and enter the IP address and also the MAC address. If you are using the LaunchPad, the MAC address is shown on the sticker on the back of the board. 

    Your PC will be your TFTP server as well as a BootP server to transfer the program image to the MCU (the client). You need to inform the BootP server for the MCU’s IP address and its MAC address. This is how a BootP server works. Unlike a DHCP server, the MAC address and its associated IP address must be manually entered and known ahead of time because BootP is static in nature. This is why we enter them in the configuration tab. However, we don’t know what IP address to enter. We cannot enter any arbitrary address that might interfere with other IP address in the network.

    This is the reason we must first run a different Ethernet example such as enet_lwip. The enet_lwip will send the DHCP request. After the IP address is acquired we will just record the IP address value for reuse in boot_emac_flash. The IP address acquired by running enet_lwip shows 10.219.14.138 in my image. Note your address will be different from mine. The reason we can use this address is that the DHCP IP address is leased for some hours. The address we acquired by running the enet_lwip will be good for a few hours.

    Step 4. Go to the Program tab. Provide the path to the application image which is the boot_demo_emac_flash.bin. This TvaWare example was already llinked to 0x4000. DO NOT change it. You can change to wherever you like in the future. But until you get the example working, do NOT change anything. 

     Step 5. if the boot_emac_flash in step 2 is still halted in CCS, you can run it now. 

     Step 6. After the boot_emac_flash is run, you can hit the Program button in the above image.

     Step 7. Suppose everything went smoothly and the boot_demo_emac_flash application was programmed and if you want to debug it, you can load the symbol by going to Run->Load->Load Symbols. The symbol is contained in the boot_demo_emac_flash.out. Note it is the .out file. Do load symbols, not to be confused with Load program. 

    I will suggest you use WireShark to view the traffic between the MCU and the TFTP/BOOTP server. Below is what you should see. The MCU will send BOOTP request to the PC and after the handshake the TFTP sever sends the program image (boot_demo_emac_flash.bin) to the MCU via the Ethernet interface.

  • still not working please see this video if any issue please help me to solve this 

  • Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //*****************************************************************************
    //
    // bl_main.c - The file holds the main control loop of the boot loader.
    //
    // Copyright (c) 2006-2020 Texas Instruments Incorporated. All rights reserved.
    // Software License Agreement
    //
    // Texas Instruments (TI) is supplying this software for use solely and
    // exclusively on TI's microcontroller products. The software is owned by
    // TI and/or its suppliers, and is protected under applicable copyright
    // laws. You may not combine this software with "viral" open-source
    // software in order to form a larger program.
    //
    // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
    // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
    // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
    // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
    // DAMAGES, FOR ANY REASON WHATSOEVER.
    //
    // This is part of revision 2.2.0.295 of the Tiva Firmware Development Package.
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    bl_main.c my changes

  • Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //*****************************************************************************
    //
    // bl_config.h - The configurable parameters of the boot loader.
    //
    // Copyright (c) 2015-2020 Texas Instruments Incorporated. All rights reserved.
    // Software License Agreement
    //
    // Texas Instruments (TI) is supplying this software for use solely and
    // exclusively on TI's microcontroller products. The software is owned by
    // TI and/or its suppliers, and is protected under applicable copyright
    // laws. You may not combine this software with "viral" open-source
    // software in order to form a larger program.
    //
    // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
    // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
    // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
    // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
    // DAMAGES, FOR ANY REASON WHATSOEVER.
    //
    // This is part of revision 2.2.0.295 of the EK-TM4C1294XL Firmware Package.
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    bl_config.h

  • Did you try the example as-is without modification? There is no need to modify the example as it should work out of the box.

    How many NICs (network interface controller) are there on your PC? If you have multiple of them installed on your PC then you need to disable all except the one that is acting as the BootP and TFTP server talking to the client (your MCU). When I look at your video, you seem to have two of them Ethernet Adapter selection when you open LM Flash Programmer. 

  • I used the example code without any modification but still i have the same problem and I disabled all the NIC cards except the PC ethernet also I can share the Wireshark logs  if needed

  • Iam also getting this 3 warning do i need to enable these things ?

  • IS it possible to add uart prints for debugging purpose in boot_emac_flash project 

  • I used the example code without any modification but still i have the same problem and I disabled all the NIC cards except the PC ethernet also I can share the Wireshark logs  if needed

    Are you running on a LaunchPad or you own board? If you are running on your own board, do you have a valid MAC address?

    Iam also getting this 3 warning do i need to enable these things ?

    What compiler version are you using? I just rebuilt the example with the default settings and I don't see any warning. 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    **** Clean-only build of configuration Debug for project boot_emac_flash ****
    "C:\\ti\\ccs1011\\ccs\\utils\\bin\\gmake" -k -j 8 clean -O
    gmake: *** No rule to make target 'clean'.
    **** Build Finished ****
    **** Build of configuration Debug for project boot_emac_flash ****
    "C:\\ti\\ccs1011\\ccs\\utils\\bin\\gmake" -k -j 8 all -O
    Building file: "C:/ti/TivaWare_C_Series-2.2.0.295/boot_loader/bl_autobaud.c"
    Invoking: ARM Compiler
    "C:/ti/ccs1011/ccs/tools/compiler/ti_cgt-arm_18.12.0.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me -O2 --include_path="C:/Users/a0321879/Documents/CCS/TM4C/My CCS EKTM4C1294XL 2.2.0/boot_emac_flash" --include_path="C:/Users/a0321879/Documents/CCS/TM4C/My CCS EKTM4C1294XL 2.2.0/boot_emac_flash" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295/boot_loader" --include_path="C:/ti/ccs1011/ccs/tools/compiler/ti_cgt-arm_18.12.0.LTS/include" --define=ccs="ccs" --define=PART_TM4C1294NCPDT --define=TARGET_IS_TM4C129_RA2 -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --ual --preproc_with_compile --preproc_dependency="boot_loader/bl_autobaud.d_raw" --obj_directory="boot_loader" "C:/ti/TivaWare_C_Series-2.2.0.295/boot_loader/bl_autobaud.c"
    Finished building: "C:/ti/TivaWare_C_Series-2.2.0.295/boot_loader/bl_autobaud.c"
    Building file: "C:/ti/TivaWare_C_Series-2.2.0.295/boot_loader/bl_can.c"
    Invoking: ARM Compiler
    "C:/ti/ccs1011/ccs/tools/compiler/ti_cgt-arm_18.12.0.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me -O2 --include_path="C:/Users/a0321879/Documents/CCS/TM4C/My CCS EKTM4C1294XL 2.2.0/boot_emac_flash" --include_path="C:/Users/a0321879/Documents/CCS/TM4C/My CCS EKTM4C1294XL 2.2.0/boot_emac_flash" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295/boot_loader" --include_path="C:/ti/ccs1011/ccs/tools/compiler/ti_cgt-arm_18.12.0.LTS/include" --define=ccs="ccs" --define=PART_TM4C1294NCPDT --define=TARGET_IS_TM4C129_RA2 -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --ual --preproc_with_compile --preproc_dependency="boot_loader/bl_can.d_raw" --obj_directory="boot_loader" "C:/ti/TivaWare_C_Series-2.2.0.295/boot_loader/bl_can.c"
    Finished building: "C:/ti/TivaWare_C_Series-2.2.0.295/boot_loader/bl_can.c"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    IS it possible to add uart prints for debugging purpose in boot_emac_flash project 

    It is possible but I will suggest you look at the wireshark instead. Do you see the bootloader send out the BOOTP request? Why don't you show your wireshark capture?

  • How can I upload the wireshark logs , could not able to upload it as a file and

    how to configure the boot_emac_flash project as static and without BOOTP request and reply and directly using TFTP ? 

  • How can I upload the wireshark logs , could not able to upload it as a file and

    You just drag the file into the forum editor window. 

    how to configure the boot_emac_flash project as static and without BOOTP request and reply and directly using TFTP ? 

    The example bootloader uses the BOOTP protocol to establish connection between a client and server before TFTP can start. Check this article for clarification. https://www.techtarget.com/searchnetworking/definition/BOOTP. I will suggest you get the existing example working first before you venture into making some custom bootloader without using BOOTP. 

  • Hi charles 

    At-last it got worked after changing the stack size from 256 to 1024 in bl_config.h
    can you please suggest code changes for how to use this project with static IP with only TFTP and without BOOTP protocol


  • At-last it got worked after changing the stack size from 256 to 1024 in bl_config.h

    Hi,

      When I check the default CCS project setting for boot_emac_flash, the stack size is 1024 being reserved. Did you happen to change this value? In anycase, glad your problem is resolved. 

    can you please suggest code changes for how to use this project with static IP with only TFTP and without BOOTP protocol

    If you already know a static IP that is available on your network, you can just use that IP address in LM Flash Programmer setting. The reason I asked you to first run enet_lwip example was that the DHCP server will give you an available IP address. That address is normally leased to the client for a while. It could be hours, days or indefinite depending on your network setting. Since that DHCP address is leased to you, you can use that address to enter to the LM flash programmer. But if you already know for sure that a particular IP address is not used/leased to any node on your network then you could just use that address for the client along with the client's MAC address and enter the pair into LM flash programmer. 

  • Hi Charles

    If you already know a static IP that is available on your network, you can just use that IP address in LM Flash Programmer setting. 

    means I can use any ip address in LM flash which will be configured as static

    can you please elaborate how to configure a static IP & to Remove BOOTP request & reply

  • means I can use any ip address in LM flash which will be configured as static

    Again, any IP address that you know for sure is not used/assigned to any node on your network. You need to talk to your IT department what are the available IP addresses that can be used statically. If you are on your home network, you normally can log in to your router and find our what addresses have been used already. 

    can you please elaborate how to configure a static IP & to Remove BOOTP request & reply

    I don't understand your question. How can you remove BOOTP for the purpose of bootloading? The BOOTP is the protocol to download/update a new firmware through Ethernet interface. 

  • Hi Charles 
    Is BOOTP & DHCP are same or different  I need either DHCP or Static IP need to be enabled , can you help me for code changes ?

  • Is BOOTP & DHCP are same or different  I need either DHCP or Static IP need to be enabled , can you help me for code changes ?

    Why don't you read about the difference between BOOTP and DHCP? This article will be helpful. https://www.tutorialspoint.com/difference-between-bootp-and-dhcp

    What are you trying to achieve? I thought you were trying to use a Ethernet bootloader to download/update firmware on the flash. Isn't that what you want to do? A bootloader is supposed to be a very small program residing on the flash to perform such task. The current example uses BOOTP because it is small to implement. DHCP is a layer-7 protocol which means it is an application in the definition of OSI model. To implement DHCP you would need to have the TCP/IP stack running. Check the enet_lwip example where DHCP is used and the lwIP (TCP/IP) stack is loaded to handle the layer 2 and layer 3 operations. It will take up a huge amount of memory just to acquire an IP address. Is that what you really want?