This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: OSPI + UFS boot problem

Part Number: TDA4VM

Tool/software:

We are using SDK 10 and want to implement SPL + OSPI + UFS boot. Here's what we've done and the issues we're facing:

1 We've written boot files to norflash

2 We've modified the bootcmd

config BOOTCOMMAND
	string "bootcmd value"
	depends on USE_BOOTCOMMAND && !USE_DEFAULT_ENV_FILE
	default "run ufs_or_mmc_boot" if ARCH_K3
	default "bootflow scan -lb" if BOOTSTD_DEFAULTS && CMD_BOOTFLOW_FULL
	default "bootflow scan" if BOOTSTD_DEFAULTS && !CMD_BOOTFLOW_FULL
	default "run distro_bootcmd" if !BOOTSTD_BOOTCOMMAND && DISTRO_DEFAULTS
	help
	  This is the string of commands that will be used as bootcmd and if
	  AUTOBOOT is set, automatically run.
	  
and in psdkla/board-support/ti-u-boot-2024.04+git/include/configs/j721e_evm.h

#define CFG_EXTRA_ENV_SETTINGS \
"ufs_bootenvfile=uEnv.txt\0" \
"ufs_importbootenv=echo Importing environment from UFS ...; env import -t ${loadaddr} ${filesize}\0" \
"ufs_loadbootenv=ext4load scsi 0:0 ${loadaddr} /boot/${ufs_bootenvfile}\0" \
"ufs_apply_overlays=" \
    "fdt address ${fdtaddr}; " \
    "fdt resize 0x100000; " \
    "for overlay in ${name_overlays}; do " \
        "ext4load scsi 0:0 ${dtboaddr} /boot/dtb/${overlay} && " \
        "fdt apply ${dtboaddr}; " \
    "done;\0" \
"ufs_set_bootargs=" \
    "setenv bootargs console=${console} " \
    "${optargs} " \
    "root=/dev/sda rw " \
    "rootfstype=ext4 rootwait " \
    "${extra_bootargs};\0" \
"ufs_or_mmc_boot=" \
    "run bootcmd_ti_mmc; " \
    "echo 'Trying UFS boot first...'; " \
    "ufs init; " \
    "scsi scan; " \
    "if scsi dev 0; then " \
        "echo 'UFS Boot...'; " \
        "if run ufs_loadbootenv; then " \
            "echo 'Loaded env from ${ufs_bootenvfile}'; " \
            "run ufs_importbootenv; " \
            "if test -n ${uenvcmd}; then " \
                "echo 'Running uenvcmd from UFS...'; " \
                "run uenvcmd; " \
            "fi; " \
        "fi; " \
        "if ext4load scsi 0:0 ${loadaddr} /boot/Image; then " \
            "if ext4load scsi 0:0 ${fdtaddr} /boot/dtb/ti/k3-j721e-common-proc-board.dtb; then " \
                "if test -n ${name_overlays}; then " \
                    "run ufs_apply_overlays; " \
                "fi; " \
                "run ufs_set_bootargs; " \
                "if test ${dorprocboot} = 1; then " \
                    "echo 'Enabling remote processor boot...'; " \
                "fi; " \
                "booti ${loadaddr} - ${fdtaddr}; " \
            "else " \
                "echo 'Failed to load DTB'; " \
                "run mmc_fallback; " \
            "fi; " \
        "else " \
            "echo 'Failed to load Kernel'; " \
            "run mmc_fallback; " \
        "fi; " \
    "else " \
        "echo 'UFS not available, trying MMC...'; " \
        "run mmc_fallback; " \
    "fi;\0" \
"mmc_fallback=echo 'Falling back to MMC boot...'; run envboot; run bootcmd_ti_mmc; bootflow scan -lb;\0"  

Current results:

  1. All cores can boot
  2. Linux can boot
  3. But when executing source ./vision_apps_init.sh, we encounter errors
  4. root@j721e-evm:/opt/vision_apps# source ./vision_apps_init.sh
    root@j721e-evm:/opt/vision_apps#      0.000000 s: APP_LOG: ERROR: Unable to map memory @ 0xac000000 of size 262144 bytes !!!
    APP_LOG: ERROR: Unable to map memory @ 0xb0000000 of size 3288576 bytes !!!
    

The boot log is 

U-Boot SPL 2024.04 (Mar 19 2025 - 15:53:46 +0800)
SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)')
Trying to boot from MMC2
Warning: Detected image signing certificate on GP device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted
Warning: Detected image signing certificate on GP device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted
Warning: Detected image signing certificate on GP device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted
Warning: Detected image signing certificate on GP device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted
Warning: Detected image signing certificate on GP device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted
Loading Environment from nowhere... OK
Starting ATF on ARM64 core...

NOTICE:  BL31: v2.10.0(release):v2.10.0-367-g00f1ec6b87-dirty
NOTICE:  BL31: Built : 16:09:05, Feb  9 2024
I/TC:
I/TC: OP-TEE version: 4.2.0-dev (gcc version 13.3.0 (GCC)) #1 Fri Apr 12 09:51:21 UTC 2024 aarch64
I/TC: WARNING: This OP-TEE configuration might be insecure!
I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
I/TC: Primary CPU initializing
I/TC: GIC redistributor base address not provided
I/TC: Assuming default GIC group status and modifier
I/TC: SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)')
I/TC: HUK Initialized
I/TC: Activated SA2UL device
I/TC: Fixing SA2UL firewall owner for GP device
I/TC: Enabled firewalls for SA2UL TRNG device
I/TC: SA2UL TRNG initialized
I/TC: SA2UL Drivers initialized
I/TC: Primary CPU switching to normal world boot

U-Boot SPL 2024.04 (Mar 19 2025 - 15:53:04 +0800)
SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)')
Detected: J7X-BASE-CPB rev E3
Detected: J7X-VSC8514-ETH rev E2
Trying to boot from MMC2
Warning: Detected image signing certificate on GP device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted
Warning: Detected image signing certificate on GP device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted


U-Boot 2024.04 (Mar 21 2025 - 14:20:46 +0800)

SoC:   J721E SR1.1 GP
Model: Texas Instruments J721e EVM
Board: J721EX-PM2-SOM rev E8
DRAM:  2 GiB (effective 4 GiB)
Core:  116 devices, 34 uclasses, devicetree: separate
Flash: 0 Bytes
MMC:   mmc@4f80000: 0, mmc@4fb0000: 1
Loading Environment from nowhere... OK
In:    serial@2800000
Out:   serial@2800000
Err:   serial@2800000
am65_cpsw_nuss ethernet@46000000: K3 CPSW: nuss_ver: 0x6BA00101 cpsw_ver: 0x6BA80100 ale_ver: 0x00293904 Ports:1
Detected: J7X-BASE-CPB rev E3
Detected: J7X-VSC8514-ETH rev E2
Net:   Could not get PHY for mdio@f00: addr 0
am65_cpsw_nuss_port ethernet@46000000port@1: phy_connect() failed
No ethernet found.

Hit any key to stop autoboot:  0
GPIO: 'gpio@22_17' not found
Command 'gpio' failed: Error -22
GPIO: 'gpio@22_16' not found
Command 'gpio' failed: Error -22
k3_r5f_rproc r5f@41000000: Core 1 is already in use. No rproc commands work
k3_r5f_rproc r5f@41400000: Core 2 is already in use. No rproc commands work
1416896 bytes read in 254 ms (5.3 MiB/s)
Load Remote Processor 2 with data@addr=0x82000000 1416896 bytes: Success!
322804 bytes read in 209 ms (1.5 MiB/s)
Load Remote Processor 3 with data@addr=0x82000000 322804 bytes: Success!
Failed to load '/lib/firmware/j7-main-r5f1_0-fw'
Failed to load '/lib/firmware/j7-main-r5f1_1-fw'
998224 bytes read in 237 ms (4 MiB/s)
Load Remote Processor 6 with data@addr=0x82000000 998224 bytes: Success!
998224 bytes read in 237 ms (4 MiB/s)
Load Remote Processor 7 with data@addr=0x82000000 998224 bytes: Success!
13504656 bytes read in 755 ms (17.1 MiB/s)
Load Remote Processor 8 with data@addr=0x82000000 13504656 bytes: Success!
20351488 bytes read in 865 ms (22.4 MiB/s)
114029 bytes read in 35 ms (3.1 MiB/s)
Working FDT set to 88000000
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
Working FDT set to 88000000
   Loading Device Tree to 000000008fee1000, end 000000008fffffff ... OK
Working FDT set to 8fee1000

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x411fd080]

I'd like to confirm if my approach is correct.
If not, what should I do differently?