UltimaSerial To create DFU for TM4C1294

Windaq add-ons
Windaq Add-ons

  1. First download and install LM Flash Programmer from http://www.ti.com/tool/lmflashprogrammer
  2. Download the Stellaris Firmware Upgrade USB driver from http://www.ti.com/lsds/ti/microcontrollers_16-bit_32-bit/c2000_performance/control_automation/tm4c12x/tools_software.page#uti
  3. Add the following line to Project->Properties->C/C++ Build->Settings-> Build Steps ->Post-Build Steps to generate .bin file (make sure the project name is not too long or it may have trouble generating the .bin file without error warning)
    1. "${CCE_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin" "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" "${CG_TOOL_ROOT}/bin/armofd" "${CG_TOOL_ROOT}/bin/armhex" "${CCE_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin"
  4. Unless TiVaWare has newer version than to build your DFU, you need to create your own DFU in the following steps
    1. Start with TiVaWare or later, or you will run into many Bus Fault
    2. Import boot_usb from DK_TM4C123G
    3. Overwrite the bl_config.h in the project with the one in this folder
    4. Replace line 506 with the following: while((HWREG(SYSCTL_RCGCGPIO) & (USB_DP_PERIPH | USB_DM_PERIPH)) !=
    5. In boot_usb project, replaced the defines referring to TM4C123 in project->properties->CCS Build->ARM Compiler->Advanced Options->Predefined Symbols with PART_TM4C1294NCPDT and TARGET_IS_TM4C129_RA2
    6. To match the pushbutton on our DI-2x08, enable the following definition in bl_config.h
      1. #define ENABLE_UPDATE_CHECK
      4. #define FORCED_UPDATE_PIN       0
      5. #define FORCED_UPDATE_POLARITY  0
      6. #define FORCED_UPDATE_WPU
      7. With the above configuration, if we push the button, which is shorting G0 to ground, during power-up, USB DFU will be invoked
      8. Watch out, we should NOT multiplex G0 for wired event input, or it may force USB DFU to come up during deployment if the event level is low.
    7. Modify the VIP and PID in bl_config.h, in our design
      1. #define USB_VENDOR_ID to your own VID
      2. #define USB_PRODUCT_ID to your own PID
    8. Modify g_pui8ManufacturerString[] to reflect company name
    9. Modify g_pui8ProductStringo[] to reflect device name
    10. Build the project
    11. Flash it to the device, this is the USB DFU 
      1. If this is brand new device, you can use either CCS or LM Flash Programmer to flash in USB DFU
      2. If this is an used micro, you may need to CCS to flash in USB DFU
  5. Prepare the USB drivers for USB_DFU
    1. Modify boot_usb.inf to use the new PID/VID
    2. Modify boot_usb.inf to assign new ProviderName, etc in the [Strings] section
    3. Sign boot_usb.inf
    4. Consider to include the driver and LM Flash programmer in our installation
  6. When your project is ready to release
    1. Modify project_ccs.cmd to change the link script
      1. Add #define APP_BASE 0x00004000 to project_ccs.cmd
      2. Replace 

            FLASH (RX) : origin = 0x00000000, length = 0x000100000
            SRAM (RWX) : origin = 0x20000000, length = 0x00040000


            FLASH (RX) : origin = APP_BASE, length = 0x000FC000
            SRAM (RWX) : origin = 0x20000000, length = 0x00040000
      3. Replace

            .intvecs:   > 0x00000000


            .intvecs:   > APP_BASE
      4. Build the project to generate .bin file
        1. This .bin file has no info regarding the memory location of the firmware regardless what the link script specifies. It is purely the binary image of the firmware. It is the responsibility of the FlashProgramer to place it in the appropriate memory location
        2. Once DFU is activated, when LMFlashProgrammer is started, it will query DFU and find out the starting address, and it will NOT allow any other address to be entered to the starting offset to protect the DFU, as long as we don't define ENABLE_BL_UPDATE when creating the DFU
        3. DFU is smart enough to protect itself and the users don't need to worry about " If there is a Flash based boot loader then 0x0 cannot be used as it will try to overwrite the Flash boot loader”
      5. Revert the modification in 2 and 3 for future CCS IDE debugging
    2. To program the firmware on top of USB DFU (during calibration or DFU)
      1. Make sure the device is programmed with USB DFU in 2.8
      2. Push the button (G0) when powering it up via USB
      3. Now the device will show up in the device manager as Stellaris Device Firmware Upgrade
      4. Run LM Flash Programmer
      5. Select Manual Configuration and USB DFU in Configuration pane
      6. In Program pane, select the .bin file generated in 6.1.4
      7. Program Address offset would be set up properly by the firmware, don’t change it
      8. Select Erase Necessary Pages instead of Erase Entire Flash
      9. Flash the firmware to the micro
  7. To restore the micro to factory default USB DFU, follow CCW->Debug->FlashMemory->Erase All