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.

SK-TDA4VM: How to boot from OSPI flash

Part Number: SK-TDA4VM

Tool/software:

Hi,

I created a minimal image (tisdk-tiny-image) and converted it into a UBIFS image, which can successfully boot from OSPI flash.

sf probe
fatload mmc 1 ${loadaddr} tiboot3.bin
sf update ${loadaddr} 0x0 0x${filesize}
fatload mmc 1 ${loadaddr} tispl.bin
sf update ${loadaddr} 0x80000 0x${filesize}
fatload mmc 1 ${loadaddr} u-boot.img
sf update ${loadaddr} 0x280000 0x${filesize}
fatload mmc 1 ${loadaddr} sysfw.itb
sf update ${loadaddr} 0x6C0000 0x${filesize}

However, U-Boot consistently reports an error when attempting to load the root filesystem.
Please follow the steps outlined below.

mkfs.ubifs -r rootfs -m 16 -e 256KiB -c 256 -o rootfs.ubifs

cat > rootfs.ubi.cfg <<EOF
[rootfs]
mode=ubi
image=rootfs.ubifs
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
EOF

ubinize -o ubi.img -m 16 -p 256KiB -s 16 rootfs.ubi.cfg

And I flashed the image to OSPI flash memory.

flash_erase /dev/mtd6 0 0
ubiformat /dev/mtd6 -f ubi.img
ubiattach /dev/ubi_ctrl -m 6 <- Failed

root@j721e-sk:~# ubiattach /dev/ubi_ctrl -m 6
[  787.820510] ubi0: attaching mtd6
[  787.832703] ubi0: scanning is finished
[  787.836458] ubi0 error: ubi_read_volume_table: the layout volume was not found
[  787.843703] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd6, error -22
ubiattach: error!: cannot attach mtd6
           error 22 (Invalid argument)

mount -t ubifs ubi0:rootfs /mnt

Therefore, I rebooted into U-Boot and attempted to load the root filesystem manually.

=> sf probe
k3-navss-ringacc ringacc@2b800000: Ring Accelerator probed rings:286, gp-rings[96,20] sci-dev-id:235
k3-navss-ringacc ringacc@2b800000: dma-ring-reset-quirk: disabled
jedec_spi_nor flash@0: non-uniform erase sector maps are not supported yet.
SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB, total 64 MiB
=> sf erase 0x800000 0x37c0000
SF: 58458112 bytes @ 0x800000 Erased: OK
=> fatload mmc 1 ${loadaddr} ubi.img
43778048 bytes read in 997 ms (41.9 MiB/s)
=> sf write ${loadaddr} 0x800000 ${filesize}
device 0 offset 0x800000, size 0x29c0000
SF: 43778048 bytes @ 0x800000 Written: OK
=> ubi part ospi.rootfs
ubi0: attaching mtd7
ubi0: scanning is finished
ubi0: volume 0 ("rootfs") re-sized from 165 to 219 LEBs
ubi0: attached mtd7 (name "ospi.rootfs", size 55 MiB)
ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 262016 bytes
ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
ubi0: VID header offset: 64 (aligned 64), data offset: 128
ubi0: good PEBs: 223, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 676530700
ubi0: available PEBs: 0, total reserved PEBs: 223, PEBs reserved for bad PEB handling: 0
jedec_spi_nor flash@0: flash operation timed out
ubi0 error: nor_erase_prepare: cannot invalidate PEB 0, write returned -110
ubi0: dumping 262144 bytes of data from PEB 0, offset 0
ubi0 error: erase_worker: failed to erase PEB 0, error -5
ubi0 error: erase_worker: bad physical eraseblock 0 detected
ubi0 warning: ubi_ro_mode: switch to read-only mode
ubi0 error: do_work: work failed with error code -5
ubi0 error: ubi_do_worker: ubi_bgt0d: work failed with error code -5
ubi0 error: ubi_io_sync_erase: read-only mode
ubi0 error: erase_worker: failed to erase PEB 1, error -30
ubi0 error: do_work: work failed with error code -30
ubi0 error: ubi_do_worker: ubi_bgt0d: work failed with error code -30

Do you have any suggestions for solving the problem?