3. Firmware Builder

The broader Processor SDK RTOS includes several libraries, demos, and examples that can be compiled and run on HLOS, RTOS, or bare metal. This section, however, is intended to be a more focused quick start guide for developers who are PRIMARILY interested in updating/rebuilding the remote core firmware used in the Processor SDK Linux J721S2 or AM68A.

Platform

Devices

J721S2

TDA4VL, TDA4AL, TDA4VE, AM68A

3.1. Background

The default firmware that comes packaged in the Processor SDK Linux J721S2 comes from the following yocto recipe:

More specifically, the prebuilt firmware is maintained as part of the following repository:

The next sections outline how one would go about reproducing these firmware images from source so that one can make appropriate changes as necessary.

3.2. Install

  • Untar the Firmware Builder (aka. PSDK RTOS) package in your workarea.

    cd ${WORKAREA}
    tar -xf ti-processor-sdk-rtos-<soc>-<version>.tar.gz
    
  • The above ${WORKAREA}/ ti-processor-sdk-rtos-<soc>-<version> path will be referred as ${FIRMWARE_BUILDER_INSTALL_PATH} on this page.

  • (Optional) Clone the psdk_fw git repository within the ${FIRMWARE_BUILDER_INSTALL_PATH}

    • This is the read-only git repository at which this prebuilt firmware is maintained. Cloning it here will allow you to see using git if there were any deltas from the prebuilt and the version that you are about to build. It can also be the basis for a fork of this git repository that you can maintain for updated yocto recipes to pull in updated versions of firmware you build.

    • Alternatively, you can skip this step, and the firmware will still be put into this directory structure when built.

    cd ${FIRMWARE_BUILDER_INSTALL_PATH}
    git clone git://git.ti.com/processor-sdk/psdk_fw.git -b REL.PSDK.JACINTO.<release version> --depth=1
    

3.3. Code Updates

In order to verify your setup the first time, you may want to skip this step so you can confirm that the firmware you build is identical to what was released. Otherwise, please refer to details about some of the common reasons you may want to rebuild the firmware from the default:

  • Changes to the memory map

  • Need debug symbols to debug the firmware

    • Prior to running steps in Build Firmware section below, goto the ${FIRMWARE_BUILDER_INSTALL_PATH}/vision_apps/makerules/makefile_linux_arm.mak file, and in the FIRMWARE_VARS list, change PROFILE=release to PROFILE=debug

    • This change will generate the debug symbol versions of the firmware that can then be used to debug the firmware using CCS. See Debugging with HLOS running on A72 (Linux / QNX) for more details.

  • Other changes/customizations needed in the firmware (adding/removing logic)

    • Refer to various sections in the appropriate components to know what changes to make based on what your are interested in.

3.4. One-time Setup

Run the following commands in the ${FIRMWARE_BUILDER_INSTALL_PATH} path.

./psdk_rtos/scripts/setup_psdk_rtos.sh --firmware_only
  • This will install additional ubuntu packages, as well as download some additional folders within the ${FIRMWARE_BUILDER_INSTALL_PATH}

  • As of now, this script is installing much of what might be needed for full PSDK RTOS, however, we are planning on streamlining this using the –firmware_only flag in the future.

3.5. Build Firmware

  • To optionally clean the firmware build, run

cd ${FIRMWARE_BUILDER_INSTALL_PATH}/vision_apps
make firmware_scrub
  • To build the firmware, run

cd ${FIRMWARE_BUILDER_INSTALL_PATH}/vision_apps
./make_firmware.sh
  • This will generate all the remote core firmwares, strip them of symbols, and copy them to the ${FIRMWARE_BUILDER_INSTALL_PATH}/psdk_fw folder.

  • Feel free to review the FIRMWARE_VARS list in the ${FIRMWARE_BUILDER_INSTALL_PATH}/vision_apps/makerules/makefile_linux_arm.mak file if you need to adjust some of the global build flags that are being used to build the firmware.

Note

The default setting of these scripts are building the firmware for the <sd-card-rootfs>/lib/firmware/vision_apps_eaik version of the firmware which is designed for use on the small form factor starter kits, not the larger EVMs. If you are building the firmware for the larger EVM mentioned elsewhere in this user guide, then you will need to make the following changes in the ${FIRMWARE_BUILDER_INSTALL_PATH}/vision_apps/makerules/makefile_linux_arm.mak file: Change the following variable in FIRMWARE_VARS list: BUILD_EDGEAI=no

3.6. Apply Updated Firmware

There are a couple ways you can apply the updated firmware to your setup:

  1. Local update directly to SD card:

    • Flash the SD card with wic image as per the Processor SDK Linux documentation.

    • If you want to update with the locally built binaries, replace the following with the ones generated in the Build Firmware step.

      • If building the default for the starter kit boards:

        cp -R ${FIRMWARE_BUILDER_INSTALL_PATH}/psdk_fw/<soc>/vision_apps_eaik/* <sd-card-rootfs>/lib/firmware/vision_apps_eaik/.
        
      • If building with BUILD_EDGEAI=*no* for the EVM boards:

        cp -R ${FIRMWARE_BUILDER_INSTALL_PATH}/psdk_fw/<soc>/vision_apps_evm/* <sd-card-rootfs>/lib/firmware/vision_apps_evm/.
        
  2. Yocto:

3.7. Verify Updated Firmware

After making code changes in the Firmware builder, you can test the functionality of the firmwares with TIOVX framework using this conformance test. To run the conformance test follow the below steps.

  • Download the test data from this link: FIRMWARE_BUILDER

  • Copy this test data to sd card using,

    cd {FIRMWARE_BUILDER_INSTALL_PATH}
    ./psdk_rtos/scripts/install_data_set_to_sd_card.sh <data set tar ball>
    
  • Boot the EVM with this SD card. After boot, at the prompt, run the following test:

    cd /opt/vision_apps
    source ./vision_apps_init.sh
    ./vx_app_conformance.out
    
  • This is a large test suite that will take > 20 minutes to finish and a summary report will be printed in the terminal.