3. Build Steps

Important

  • ${PSDK_RTOS_PATH} refers to the path where Processor SDK RTOS (PSDK RTOS) is installed

  • ${PSDK_QNX_PATH} refers to the path where Processor SDK QNX (PSDK QNX) is installed inside the ${PSDK_RTOS_PATH}

  • The build is tested on Ubuntu (x86_64) 18.04 & 22.04 system and may not work on earlier or later Ubuntu systems.

  • 20GB of free space is required to install and build PSDK RTOS + PSDK QNX

  • Make sure you have sudo access

Note

Please note that $PSDK_RTOS_PATH/psdkqa will be referred at PSDK_QNX_PATH

3.1. Build

Note

Below build steps offer two build options, where user should select between:

  • 2(a) or 2(b), do not run both

3.1.1. Steps 1: To Build PSDK QNX components along with QNX BSP

Make sure that that the QNX SDP 7.1 installed in your PC as mentioned in Getting Started

  • On Command line call the below environment variables:

export QNX_SDP_VERSION=710
export QNX_BASE=<path_to_qnx710_dir>
export BUILD_QNX_MPU=yes
export PROFILE=release
export BOARD=j721e_evm
export SOC=j721e
  • Run the below commands to build the source code provided in the SDK installer, with “N” being the number of parallel threads

cd ${PSDK_QNX_PATH}/qnx
make all -jN
make qnx_fs_create
  • The generated QNX executable are stored at:

Generated Files

Path

QNX® BSP IFS file

${PSDK_QNX_PATH}/bootfs

PSDK QNX binaries

${PSDK_QNX_PATH}/qnxfs/tibin

PSDK QNX libraries

${PSDK_QNX_PATH}/qnxfs/tilib

3.1.2. Steps 2a: To Build SBL and associated EthFW Images (BootApp Images)

  • Make sure Step 1 above is completed.

  • To build SBL along with bootApp, and Main R5 EthFW images based on FreeRTOS, the following commands need to be run:

cd ${PSDK_QNX_PATH}/qnx
make sbl_ethfw
  • The generated binaries are stored at:

Generated Files

Path

SBL

${PSDK_QNX_PATH}/bootfs_sbl_ethfw_freertos/tiboot3.bin

TIFS

${PSDK_QNX_PATH}/bootfs_sbl_ethfw_freertos/tifs.bin

Boot App

${PSDK_QNX_PATH}/bootfs_sbl_ethfw_freertos/app

Firmware Image 1

${PSDK_QNX_PATH}/bootfs_sbl_ethfw_freertos/lateapp1

ATF Appimage

${PSDK_QNX_PATH}/bootfs_sbl_ethfw_freertos/atf_optee.appimage

QNX IFS Appimage

${PSDK_QNX_PATH}/bootfs_sbl_ethfw_freertos/ifs_qnx.appimage

  • Also, the following EthFW Firmware images are generated which is useful when using SPL+Uboot.

Generated Files

Path

Main R50_0 image

${PSDK_QNX_PATH}/rootfs_ethfw_freertos/lib/firmware/j7-main-r5f0_0-fw

Main R50_1 image

${PSDK_QNX_PATH}/rootfs_ethfw_freertos/lib/firmware/j7-main-r5f0_1-fw

3.1.3. Steps 2b: Build SBL and associated IPC Echo Test Firmware Images (BootApp Images)

  • Make sure Step 1 above is completed.

  • To build SBL along with bootApp, and Main R5s, C6x & C7x cores IPC Echo test images based on FreeRTOS, the following commands need to be run:

cd ${PSDK_QNX_PATH}/qnx
make sbl_echo_test
  • The generated SBL binaries are are same as show in Step 2a above, expect for BootAPP Firmware Image will now include IPC Echo test images. See that we have lateapp1 and lateapp2.

Generated Files

Path

SBL

${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/tiboot3.bin

TIFS

${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/tifs.bin

Boot App

${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/app

Firmware Image 1

${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/lateapp1

Firmware Image 2

${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/lateapp2

ATF Appimage

${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/atf_optee.appimage

QNX IFS Appimage

${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/ifs_qnx.appimage

  • Also, the following IPC Echo test images are generated which is useful when using SPL+Uboot.

Generated Files

Path

Main R50_0 image

${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-main-r5f0_0-fw

Main R50_1 image

${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-main-r5f0_1-fw

Main R51_0 image

${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-main-r5f1_0-fw

Main R51_1 image

${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-main-r5f1_1-fw

C66x_0 image

${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-c66_0-fw

C66x_1 image

${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-c66_1-fw

C7x_0 image

${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-c71_0-fw

3.2. Run Instructions

Note

Below run steps offer two different setups, where user should select between:

  • Step 2a or Step 2b, do not run both

  • Step 2c or Step 2d, do not run both

3.2.1. Step 1: Prepare SD card for boot (one time only)

  • Insert SD card onto your PC SD card slot and format SD card in to three partitions. At-least a 16GB SD card recommended.

    • First partition - FAT32: for boot loader, 128MB size recommended

    • Second partition - EXT4: for root filesystem, 1GB size recommended. (Used only for SPL+Uboot boot to store firmware images)

    • Third partition - FAT32: for QNX filesystem that include may include vision app files, More than 12GB recommended

  • You can use one of two options to format your SD card

    • Option 1: You can use the utility script ${PSDK_QNX_PATH}/qnx/scripts/mkcard_qnx.sh to make the partitions

      • Use the command “df -h” to identify the device used by SD card

      • Unmount the SD card before running the script

      • Example, if your SD card is on device /dev/sdb having three partitions, run below to unmount them

      umount /dev/sdb1
      umount /dev/sdb2
      umount /dev/sdb3
      
      • Run the script as below to partition it, answer “y” to all questions asked when running the script

      cd ${PSDK_QNX_PATH}
      sudo ${PSDK_QNX_PATH}/qnx/scripts/mkcard_qnx.sh --device /dev/sdb
      

      Note

      Make sure to give the correct device name to this script, example /dev/sda is typically local hard-disk, if you give this by mistake, your whole hard disk will be wiped off !!!

    • Option 2: you can use “gparted” utility (sudo apt install gparted) to use a GUI based interface to create the partitions.

      • Make sure you set the first FAT32 partition name as “boot”, flag as “lba”. Size of 128MB recommended.

      • Make the second partition as EXT4 partition and name as “rootfs”. Size of 1GB recommended.

      • Name the third FAT32 partition as “qnxfs”. Size of >12GB recommended.

  • After formatting, remove and insert the SD card for the freshly formatted partitions to get auto mounted on the host PC.

3.2.2. Step 2a: Copy files to the SD Card - QNX + SBL + EthFW Images (BootApp Images)

  • Copy/untar filesystem and boot files to SD card by executing the script as shown below

cd ${PSDK_QNX_PATH}
## Remove existing files on bootfs and qnxfs
rm -rf <path_to_SD_card_mount_dir>/boot/*
rm -rf <path_to_SD_card_mount_dir>/qnxfs/*
## Copy QNX FS
cp -fv ${PSDK_QNX_PATH}/bootfs/*                                  <path_to_SD_card_mount_dir>/boot
## Copy QNX FS binaries
cp -fv ${PSDK_QNX_PATH}/qnxfs/*                                   <path_to_SD_card_mount_dir>/qnxfs
## Copy SBL + bootapps + remote core file (lateapp*) + A72 appimages
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_ethfw/tiboot3.bin           <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_ethfw/tifs.bin              <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_ethfw/app                   <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_ethfw/lateapp1              <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_ethfw/atf_optee.appimage    <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_ethfw/ifs_qnx.appimage      <path_to_SD_card_mount_dir>/boot

3.2.3. Step 2b: Copy files to the SD Card - QNX + SBL + IPC Echo Test Firmware Images (BootApp Images)

  • Copy/untar filesystem and boot files to SD card by executing the script as shown below

cd ${PSDK_QNX_PATH}
## Remove existing files on bootfs and qnxfs
rm -rf <path_to_SD_card_mount_dir>/boot/*
rm -rf <path_to_SD_card_mount_dir>/qnxfs/*
## Copy QNX FS
cp -fv ${PSDK_QNX_PATH}/bootfs/*                                 <path_to_SD_card_mount_dir>/boot
## Copy QNX FS binaries
cp -fv ${PSDK_QNX_PATH}/qnxfs/*                                  <path_to_SD_card_mount_dir>/qnxfs
## Copy SBL + bootapps + remote core file (lateapp*) + A72 appimages
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/tiboot3.bin           <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/tifs.bin              <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/app                   <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/lateapp1              <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/lateapp2              <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/atf_optee.appimage    <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_QNX_PATH}/bootfs_sbl_echotest_freertos/ifs_qnx.appimage      <path_to_SD_card_mount_dir>/boot

3.2.4. Step 2c: Copy files to the SD Card - QNX + SPL-Uboot + EthFW Images

Note

The SPL-Uboot binaries must be downloaded directly from https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-J721E

  • Download and extract the boot-j7-evm-tar.gz file to a know location say ${PSDK_LINUX_UBOOT_PATH}

  • Copy/untar filesystem and boot files to SD card by executing the script as shown below

cd ${PSDK_QNX_PATH}
## Remove existing files on bootfs and qnxfs
rm -rf <path_to_SD_card_mount_dir>/boot/*
rm -rf <path_to_SD_card_mount_dir>/qnxfs/*
## Copy QNX FS
cp -fv ${PSDK_QNX_PATH}/bootfs/*                            <path_to_SD_card_mount_dir>/boot
## Copy QNX FS binaries
cp -fv ${PSDK_QNX_PATH}/qnxfs/*                             <path_to_SD_card_mount_dir>/qnxfs
## Copy SPL-Uboot
cp -fv ${PSDK_QNX_PATH}/qnx/scripts/u-boot/uEnv_j721e.txt   <path_to_SD_card_mount_dir>/boot/uEnv.txt
cp -fv ${PSDK_LINUX_UBOOT_PATH}/tiboot3.bin                 <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_LINUX_UBOOT_PATH}/tispl.bin                   <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_LINUX_UBOOT_PATH}/u-boot.img                  <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_LINUX_UBOOT_PATH}/sysfw.itb                   <path_to_SD_card_mount_dir>/boot
## Remove existing files on rootfs
sudo rm -rf <path_to_SD_card_mount_dir>/rootfs/*
## Copy remote proc images
sudo mkdir -p <path_to_SD_card_mount_dir>/rootfs/lib/firmware
sudo cp -fv ${PSDK_QNX_PATH}/rootfs_ethfw_freertos/lib/firmware/j7-main-r5f0_0-fw  <path_to_SD_card_mount_dir>/rootfs/lib/firmware
sudo cp -fv ${PSDK_QNX_PATH}/rootfs_ethfw_freertos/lib/firmware/j7-main-r5f0_1-fw  <path_to_SD_card_mount_dir>/rootfs/lib/firmware

3.2.5. Step 2d: Copy files to the SD Card - QNX + SPL-Uboot + IPC Echo Test Firmware Images

Note

The SPL-Uboot binaries must be downloaded directly from https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-J721E

  • Download and extract the boot-j7-evm-tar.gz file to a know location say ${PSDK_LINUX_UBOOT_PATH}

  • Copy/untar filesystem and boot files to SD card by executing the script as shown below

cd ${PSDK_QNX_PATH}
## Remove existing files on bootfs and qnxfs
rm -rf <path_to_SD_card_mount_dir>/boot/*
rm -rf <path_to_SD_card_mount_dir>/qnxfs/*
## Copy QNX FS
cp -fv ${PSDK_QNX_PATH}/bootfs/*                            <path_to_SD_card_mount_dir>/boot
## Copy QNX FS binaries
cp -fv ${PSDK_QNX_PATH}/qnxfs/*                             <path_to_SD_card_mount_dir>/qnxfs
## Copy SPL-Uboot
cp -fv ${PSDK_QNX_PATH}/qnx/scripts/u-boot/uEnv_j721e.txt   <path_to_SD_card_mount_dir>/boot/uEnv.txt
cp -fv ${PSDK_LINUX_UBOOT_PATH}/tiboot3.bin                 <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_LINUX_UBOOT_PATH}/tispl.bin                   <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_LINUX_UBOOT_PATH}/u-boot.img                  <path_to_SD_card_mount_dir>/boot
cp -fv ${PSDK_LINUX_UBOOT_PATH}/sysfw.itb                   <path_to_SD_card_mount_dir>/boot
## Remove existing files on rootfs
sudo rm -rf <path_to_SD_card_mount_dir>/rootfs/*
## Copy remote proc images
sudo mkdir -p <path_to_SD_card_mount_dir>/rootfs/lib/firmware
sudo cp -fv ${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-main-r5f0_0-fw  <path_to_SD_card_mount_dir>/rootfs/lib/firmware
sudo cp -fv ${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-main-r5f0_1-fw  <path_to_SD_card_mount_dir>/rootfs/lib/firmware
sudo cp -fv ${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-main-r5f1_0-fw  <path_to_SD_card_mount_dir>/rootfs/lib/firmware
sudo cp -fv ${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-main-r5f1_1-fw  <path_to_SD_card_mount_dir>/rootfs/lib/firmware
sudo cp -fv ${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-c66_0-fw        <path_to_SD_card_mount_dir>/rootfs/lib/firmware
sudo cp -fv ${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-c66_1-fw        <path_to_SD_card_mount_dir>/rootfs/lib/firmware
sudo cp -fv ${PSDK_QNX_PATH}/rootfs_echotest_freertos/lib/firmware/j7-c71_0-fw        <path_to_SD_card_mount_dir>/rootfs/lib/firmware

3.2.6. Step 2e: OSPI Boot Mode

  • To flash boot binaries to the OSPI flash, you need to have Uniflash flashprogrammer installed in the host PC. If you don’t have this, install it from https://www.ti.com/tool/UNIFLASH

  • Update the UNIFLASH_VERSION value in “psdkqa/qnx/scripts/sbl/makefile” to correspond to the downloaded version of uniflash.

  • Make sure that the MCU UART is connected to the host PC. Note the port name of the second COM PORT of the MCU UART. You can find this using “dmesg | grep ttyUSB” in linux. For example let’s assume it was ‘/dev/ttyUSB1’.

  • Update the UNIFLASH_COM_PORT value in “psdkqa/qnx/scripts/sbl/makefile”.

  • Make sure the EVM board dip-switch are set for UART Boot mode. Please refer to EVM Setup for J721E for more details.

  • Run the below command to flash the xSPI.

make sbl_echo_test_ospi_flashing
  • Note: if using an HS device, you will instead need to run the below command:

make sbl_echo_test_ospi_flashing_hs
  • Important note for the step above: if you face a permissions issue when running the above command, you can run the below command first which changes the permissions of the /dev/ttyUSB* devices to not require sudo permissions

sudo usermod -a -G dialout $USER
  • Change the EVM board dip-switch settings to xSPI Boot mode. Please refer to EVM Setup for J721E for more details.

  • Put the SD card with the QNX filesystem into the EVM, as it will still require filesystem access in order to use xSPI boot mode.

  • Boot the EVM.

3.2.7. Step 3: Boot the EVM with SD card

  • Make sure the EVM board dip-switch are set for SD Boot mode. Please refer to EVM Setup for J721E for more details.

  • Power on the board.

  • Debug logs would be printed to respective UART debug consoles based on the bootloader and firmware image used.

Debug UART

Debug log seen

Main UART 0

Uboot and QNX logs

Main UART 2

EthFW log if we are using EthFW images

MCU UART 1

SBL and BootAPP logs