TI Edge AI v10_00_00_08 sdk on BBAI64

This is a guide on how I patched TI Edge AI v10_00_00_08 SD card image for BBAI64. Based on BBAI64 now can use TI SDK10.0 and debug R5 thread.
Some steps could be redundant or wrong. Any advice would be appreciated :slight_smile:

On Ubuntu 22.14:

chmod +x ti-processor-sdk-linux-edgeai-j721e-evm-10_00_00_08-Linux-x86-Install.bin
./ti-processor-sdk-linux-edgeai-j721e-evm-<version>-Linux-x86-Install.bin
  • Extract tisdk-edgeai-image-j721e-evm.wic.xz with double click

  • Flash tisdk-edgeai-image-j721e-evm.wic image into SD card with Balena Etcher

  • Prepare build environment:

cd ~/ti-processor-sdk-linux-edgeai-j721e-evm-10_00_00_08
sudo apt install -y python3-pip xinetd nfs-kernel-server minicom build-essential libncurses5-dev autoconf automake dos2unix screen lrzsz lzop flex libssl-dev swig bison flex libssl-dev bc u-boot-tools
sudo apt install -y python3-jsonschema python3-pyelftools python3-yaml yamllint python3-setuptools
  • Modify Rules.make:
UBOOT_MACHINE=j721e_beagleboneai64_a72_defconfig
UBOOT_MACHINE_R5=j721e_beagleboneai64_r5_defconfig
EXEC_DIR?=targetfs/lib/firmware
ROOTFS_PART?=targetfs
BOOT_PART?=targetfs/boot
  • Modify board-support/ti-u-boot-2024.04+git/arch/arm/mach-k3/arm64-mmu.c:
#ifdef CONFIG_TARGET_J721E_A72_EVM // replace this line with the next line:
#if defined (CONFIG_TARGET_J721E_A72_EVM) || defined (CONFIG_TARGET_J721E_A72_BEAGLEBONEAI64)
  • Rebuild bl31.bin:
cd board-support/trusted-firmware-a-2.10+git/
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic SPD=opteed K3_USART=0x0
cd -
cp board-support/trusted-firmware-a-2.10+git/build/k3/generic/release/bl31.bin board-support/prebuilt-images/bl31.bin
  • Rebuild bl32.bin:
cd board-support/optee-os-4.2.0+git/
make CROSS_COMPILE=arm-linux-gnueabihf- CROSS_COMPILE64=aarch64-linux-gnu- CFG_CONSOLE_UART=0x0 PLATFORM=k3-j721e CFG_ARM64_core=y
cd -
cp board-support/optee-os-4.2.0+git/out/arm-plat-k3/core/tee-pager_v2.bin board-support/prebuilt-images/bl32.bin
  • Build u-boot:
mkdir -p targetfs/boot
make u-boot
mv board-support/ti-u-boot-2024.04+git/build/a72/u-boot.img_unsigned board-support/ti-u-boot-2024.04+git/build/a72/u-boot.img
mv board-support/ti-u-boot-2024.04+git/build/a72/tispl.bin_unsigned board-support/ti-u-boot-2024.04+git/build/a72/tispl.bin
make u-boot_install
make linux
make linux_install
cp board-support/prebuilt-images/uEnv.txt targetfs/boot/
cp -a board-support/ti-linux-kernel-6.6.32+git-ti/targetfs/* targetfs/
cp board-support/prebuilt-images/ti-sysfw/ti-fs-firmware-j721e-gp.bin targetfs/boot/
rm -rf targetfs/lib/modules/6.6.32-*/build
  • Replace name_overlays in targetfs/boot/uEnv.txt with:
name_overlays=ti/k3-j721e-beagleboneai64.dtb ti/k3-j721e-common-proc-board.dtb ti/k3-j721e-sk.dtb ti/k3-j721e-edgeai-apps.dtbo
  • Create extlinux.conf:
mkdir -p targetfs/boot/extlinux
touch targetfs/boot/extlinux/extlinux.conf
  • Populate extlinux.conf: with:
menu title BeagleBone AI-64 microSD (extlinux.conf) Options

timeout 50

default BeagleBone AI-64 microSD (default)

label BeagleBone AI-64 microSD Recovery
    kernel /Image
    append root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0
    fdtdir /

label BeagleBone AI-64 microSD (default)
    kernel /Image
    append root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0 quiet
    fdtdir /
  • Patch the SD card (I assume that it is mounted under /media/<user_name>/BOOT/ and /media/<user_name>/rootfs/):
rm -rf /media/<user_name>/BOOT/*
mkdir /media/<user_name>/BOOT/extlinux
cp targetfs/boot/extlinux/* /media/<user_name>/BOOT/extlinux/
cp targetfs/boot/Image /media/<user_name>/BOOT/
cp targetfs/boot/sysfw.itb /media/<user_name>/BOOT/
cp targetfs/boot/tiboot3.bin /media/<user_name>/BOOT/
cp targetfs/boot/tispl.bin /media/<user_name>/BOOT/
cp targetfs/boot/u-boot.img /media/<user_name>/BOOT/
cp targetfs/boot/uEnv.txt /media/<user_name>/BOOT/
cp targetfs/boot/ti-fs-firmware-j721e-gp.bin /media/<user_name>/BOOT/
cp -r targetfs/boot/dtb/* /media/<user_name>/BOOT/

sudo cp -r targetfs/lib/modules/* /media/<user_name>/rootfs/lib/modules/
sudo rm -rf /media/<user_name>/rootfs/lib/modules/6.6.32-ti-gdb8871293143-dirty/
sudo cp targetfs/boot/Image /media/<user_name>/rootfs/boot/Image-6.6.32-ti-gdb8871293143-dirty
sudo cp -r targetfs/boot/dtb/* /media/<user_name>/rootfs/boot/dtb/
4 Likes

2 Likes

Did you actually get the GPU running or is the display still on software?

I don’t know much about how this edge ai app renders. I assume it using the DRM somehow.

In the am62evm sdk they have app manager, I don’t recall the exact name. It has a dashboard for managing the demos and has an indicator for gpu it might be in with that sdk?? How does it perform is it fast?

If you meant the AI performance on C7x than yes it is fast.
I tested some time ago my custom object detection model on edge ai image from beagleboard (with sdk v08_02_00_05) using TI TFLite delegate - about 6ms inference time:

1 Like

Sounds like terribly good work right there.

Don’t have a BB-AI-64, so I haven’t checked, but I can’t help wondering if
this could be reworked into the CI builder, that I suspect exists already.

Fork, Branch, Implement and post a Merge Request! :grinning:

TI are using their own Arago Project distro there.
But I would love to have Debian image with all the necessary TI Edge AI libraries, gstreamer plugins, csi camera overlays, delegates, etc.
So anyone can take a simple example Python script for image processing and run it without any hassle.

Good work, you have way more patience than my self.

Thank you very much it’s worked!.

2 Likes

Anyway I don’t know what to do with these errors:

Retrieving file: /Image
append: root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0
Retrieving file: /ti/k3-j721e-beagleboneai64.dtb
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
Working FDT set to 88000000
ERROR: reserving fdt memory region failed (addr=880000000 size=27000000 flags=4)
   Loading Device Tree to 000000008ffe0000, end 000000008ffff1c7 ... OK
Working FDT set to 8ffe0000
...
[    3.590326] pcieport 0000:00:00.0: of_irq_parse_pci: failed with rc=-22
...
[    8.805641] platform 5e00000.r5f: assigned reserved memory node vision-apps-r5f-dma-memory@a6000000
[    8.815947] remoteproc remoteproc5: 5e00000.r5f is available
[    8.822203] remoteproc remoteproc5: loading /lib/firmware/j7-main-r5f1_0-fw failed with error -22
[    8.822215] remoteproc remoteproc5: Direct firmware load for j7-main-r5f1_0-fw failed with error -22
[    8.822226] remoteproc remoteproc5: powering up 5e00000.r5f
[    8.822261] remoteproc remoteproc5: loading /lib/firmware/j7-main-r5f1_0-fw failed with error -22
[    8.822264] remoteproc remoteproc5: Direct firmware load for j7-main-r5f1_0-fw failed with error -22
[    8.822268] remoteproc remoteproc5: request_firmware failed: -22