SPMA083 January   2022 TM4C129CNCPDT , TM4C129CNCPDT , TM4C129CNCZAD , TM4C129CNCZAD , TM4C129DNCPDT , TM4C129DNCPDT , TM4C129DNCZAD , TM4C129DNCZAD , TM4C129EKCPDT , TM4C129EKCPDT , TM4C129ENCPDT , TM4C129ENCPDT , TM4C129ENCZAD , TM4C129ENCZAD , TM4C129LNCZAD , TM4C129LNCZAD , TM4C129XKCZAD , TM4C129XKCZAD , TM4C129XNCZAD , TM4C129XNCZAD

 

  1.   Trademarks
  2. 1Implementation
    1. 1.1 Flash Boot Loader Project
      1. 1.1.1 Changes to the Example Project boot_serial
        1. 1.1.1.1 Changes to bl_config.h
        2. 1.1.1.2 New Functions Added
          1. 1.1.1.2.1 MyCheckUpdateFunc
          2. 1.1.1.2.2 MyReinitFunc
          3. 1.1.1.2.3 MyEndFunc
          4. 1.1.1.2.4 MyDecryptionFunc
    2. 1.2 Image Creation Project
    3. 1.3 Key Image Project
    4. 1.4 EK-TM4C129EXL Example Application Project
    5. 1.5 DK-TM4C129X Example Application Project
    6. 1.6 RAM-Based EEPROM Erase Project
  3. 2Example Walk Through
    1. 2.1 Build Environment
    2. 2.2 Importing the Examples into Code Composer Studio
    3. 2.3 Setting Keys and Variables
      1. 2.3.1 Keys
      2. 2.3.2 Initialization Vector
      3. 2.3.3 Application Start Address and Flash Size
        1. 2.3.3.1 APP_BASE
        2. 2.3.3.2 APP_END
        3. 2.3.3.3 RAM_BASE
    4. 2.4 Running the shared_key_image_encrypt Tool
    5. 2.5 Running the Shared Key Serial Boot Loader
      1. 2.5.1 Programming the Boot Loader
        1. 2.5.1.1 Erasing Existing Code and Keys
          1. 2.5.1.1.1 Erasing Flash and EEPROM With Code Composer Studio
          2. 2.5.1.1.2 Erasing Flash and EEPROM by Using the Unlock Procedure
        2. 2.5.1.2 Using the ROM Boot Loader to Program the Shared Key Boot Loader
      2. 2.5.2 Using the Shared Key Boot Loader to Program the Application Code
    6. 2.6 Returning to the Boot Loader
  4. 3Summary

Running the shared_key_image_encrypt Tool

After making any modifications described in section 3.3, re-compile the Debug configurations of the projects shared_key_image_encrypt and key_image. Then recompile the Debug_wKey configuration of the project shared_key_boot_serial. The debug configurations do not lock the JTAG and are for use during development. The release configurations will lock JTAG and should be used for the production version of the shared key boot loader.

  1. With the EK-TM4C129EXL LaunchPad Development Kit connected with a USB cable from the DEBUG port of the LaunchPad to a USB port on the PC, launch the shared_key_image_encrypt project. This can be done by highlighting the project in the Project Explorer window then clicking on the debug icon shown in yellow in Figure 2-5.
    GUID-20211209-SS0I-BWRB-5RPS-RPWHJQ3XCFKB-low.pngFigure 2-5 Executing the shared_key_image_encrypt Program
  2. Identify that the serial port was assigned by the PC to the virtual serial port of the LaunchPad. This can be found by running Device Manager on the PC. In Figure 2-6, the LaunchPad was assigned to COM19.
    GUID-20211209-SS0I-XRSD-G7VT-WKZ5KBK6514B-low.pngFigure 2-6 Identifying the COM Port
  3. Open a terminal emulator that supports XMODEM communications. In this example “Tera Term” was used. Connect over serial to the identified COM port for the LaunchPad.
    GUID-20211209-SS0I-1CMR-Q11H-PFVM21RKWTSZ-low.pngFigure 2-7 Selecting the COM Port in Tera Term
  4. Configure the terminal emulator to use the serial port at 460800 baud, 8-bit data, 1 stop bit, and no parity.
    GUID-20211209-SS0I-TLN9-ZDVP-TGGN14GKFK3X-low.pngFigure 2-8 Configuring the COM Port in Tera Term
  5. Execute the shared_key_image_encrypt program by clicking on the green arrow in Code Composer Studio or by pressing F8.
    GUID-20211209-SS0I-KQ03-F7NP-S7X9NBD3RDML-low.pngFigure 2-9 Executing the shared_key_image_encrypt Program
  6. The following menu should now be displayed on the terminal.
    GUID-20211209-SS0I-XQDQ-93GG-7L3GWCHMFTK4-low.pngFigure 2-10 shared_key_image_encrypt Command Menu
  7. To create a signed and encrypted image to be used by the boot loader follow these steps:
    1. Transfer the file key_image.bin from the debug subdirectory of the project key_image to the device using XMODEM protocol. Using Tera Term follow these steps:
      1. Type K in the terminal emulator (it takes lower-case k or upper-case K).
      2. Select “File” -> “Transfer” -> “XMODEM” -> “Send”.
      3. Browse to key_image\Debug\key_image.bin and select “Open”.
        GUID-20211209-SS0I-DTSL-6GBB-PP15VRP4VQDC-low.pngFigure 2-11 Loading the Key Image
      4. The terminal should now display Keys successfully programmed into EEPROM.
        GUID-20211214-SS0I-NQX8-DPBP-DDV6CGSP1XFV-low.pngFigure 2-12 Keys Successfully Loaded
    2. Transfer the application image into the device. Using Tera Term follow these steps:
      1. Type L in the terminal emulator.
      2. Select “File” -> “Transfer” -> “XMODEM” -> “Send”.
      3. Browse to shared_key_boot_demo\Debug\shared_key_boot_demo.bin and select “Open”.

      The transfer can take up to one minute for a full 1MB flash device. After completion, the message File programming complete will be displayed on the terminal.

      GUID-20211209-SS0I-Q79C-QGQK-572PL65DXW9N-low.pngFigure 2-13 Loading the Program Image
    3. Output a signed and encrypted version of the binary image. Using Tera Term follow these steps:
      1. Type O in the terminal emulator.
      2. Select “File” -> “Transfer” -> “XMODEM” -> “Receive”.
      3. Choose an output file name such as:

        shared_key_boot_demo\Debug\shared_key_boot_demo_encrypted.bin and select “Save”.

    4. Optionally, it is possible to verify the encrypted file just created against the unencrypted image stored in flash by:
      1. Type V in the terminal emulator.
      2. Select “File” -> “Transfer” -> “XMODEM” -> “Send”.
      3. Browse to shared_key_boot_demo\Debug\shared_key_boot_demo_encrypted.bin and select “Open”.
      4. The transfer will take about one minute for a full 1MB flash device. After completion, the message File verification complete will be displayed on the terminal if the encrypted file's hash value was autheticated successfully.
        GUID-20211209-SS0I-99MV-CDB6-1GNXXPVPBNM6-low.pngFigure 2-14 Verifying the Program Image
    5. Optionally, execute the application code that has been programmed into the device by:
      1. Type X in the terminal emulator.
      2. The message Hash value authenticated will be displayed on the terminal and LED D1 on the LaunchPad will be flashing.
      3. Reset the LaunchPad with either Code Composer Studio, or the reset button on the LaunchPad and the terminal will indicate that the program is back in the shared_key_image_encrypt tool.