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.

[FAQ] TDA4VM: Flashing the tiny rootfs image using UNIFLASH on OSPI

Part Number: TDA4VM
Other Parts Discussed in Thread: UNIFLASH

Hi All,

I created the tiny arago-tiny-image-j7-evm with the following command:

TOOLCHAIN_BASE=/usr/local/arm/toolchain EXTERNAL_TOOLCHAIN=aarch64-linux-gnu-gcc MACHINE=j7-evm bitbake arago-tiny-image

Using this page and this page I created a ubifs rootfs image.

I treid to flash the image to the 0x800000 address on the OSPI using the UART (Uni-Flash) with the following command as it is mentioned here.

sudo /opt/ti/uniflash_6.0.0/dslite.sh --mode processors -c /dev/ttyUSB1 -f rootfs/ubi.img -d 3 -o 0x800000

But I get memory access error:

/opt/ti/uniflash_6.0.0/dslite.sh: Zeile 75:  6186 Speicherzugriffsfehler  (Speicherabzug geschrieben) ./ProcessorSDKSerialFlash -c /dev/ttyUSB1 -f rootfs/ubi.img -d 3 -o 0x800000

The size of ubi.img is 37M.

So my question are:

Is my UBIFS created correctly?

How can I flash the ubifs image using the UART  (UNIFLASH) on the OSPI?

How big is the NORFlash on the EVM?

Thanks,

Pouyan

  • Hi Pouyan,

    Did you run the flasher command before you ran the command to flash the OSPI?

    The command is referenced here: http://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/latest/exports/docs/pdk_jacinto_07_00_00/docs/userguide/board/uniflash.html#downloading-flash-programmer

    You need to run a similar command as this " dslite.bat --mode processors -c COM7 -f C:\ti\uniflash_5.3.1\processors\FlashWriter\j721e_evm\uart_j721e_evm_flash_programmer_release.tiimage -i 0" and then try to flash the ubi.img as the next step.

    The NOR Flash on the EVM is 64MB.

    => sf probe
    SF: Detected mt35xu512aba with page size 256 Bytes, erase size 128 KiB, total 64 MiB

    Regards

    Karthik

  • Hi Karthik,

    Thanks for the respone,

    yes I did Flash the flasher. And then tried to Flash my Image. So when I copy after 0x80000 (8MiB), I should have more than enough space (64-8 = 56). But I can not Flash because of Memory Access Problem, so how can I solve this?

    Thanks,

    Pouyan

  • Hi Pouyan,

    I need your help to reproduce this at my end to debug further. Will contact you offline.

    Regards

    Karthik

  • Hi Pouyan,

    Sorry, this got out of my priority. I'm starting to look into this now. Will update soon.

    Regards

    Karthik

  • Hi Pouyan,

    Can you flash the UBIFS using any other media like SD card? I tried to flash the UBIFS with a tiny file system (with kernel and DTB coming via tftp) and was able to boot.

    Let me know if you are using the EVM or custom hardware but with SD card interface and I can help you with the steps.

    Regards,

    Karan

  • Hi Pouyan,

    Assuming that you have SD card interface available.

    -1- Get the tiny file system

    Please find the attached tiny file system: /cfs-file/__key/communityserver-discussions-components-files/791/6708.tisdk_2D00_tiny_2D00_image_2D00_j7_2D00_evm.tar.xz

    Or alternatively generate the same using the following instructions:

    git clone git://arago-project.org/git/projects/oe-layersetup.git tisdk
    cd tisdk/
     
    # Copy config file from the 7.00 installer yocto-build/configs/psdkla/psdkla-07_00_00.txt
    ./oe-layertool-setup.sh -f psdkla-07_00_00.txt
     
    # export proxy
    export ftp_proxy=http://webproxy.ext.ti.com:80
    export http_proxy=http://webproxy.ext.ti.com:80
    export https_proxy=http://webproxy.ext.ti.com:80
     
    cd build
    # Edit config file if you want to reuse downloads folder
    vi conf/local.conf
    . conf/setenv
     
    # this is the path to the toolchains for ARMv7 and ARMv8
    TOOLCHAIN_BASE=/sdk/tools MACHINE=j7-evm bitbake -k tisdk-tiny-image
     
    # build image can be found here
    la -la tisdk/build/arago-tmp-external-arm-glibc/deploy/images/j7-evm/tisdk-tiny-image-j7-evm.tar.xz

    -2- Flash the tiny file system to the UBI partition of OSPI

    We will use this image to flash to the UBI partition of OSPI. Instructions in section Using UBIFS on flash of https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-jacinto7/07_00_01_01/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/QSPI.html

    Follow below steps once you have the tisdk-tiny-image-j7-evm.tar.xz:

    # boot to file system using SD card
    
    cat /proc/mtd
    ubiformat /dev/mtd6
    ubiattach -p /dev/mtd6
    ubimkvol /dev/ubi0 -N flash_fs -s 55MiB
    mkdir /mnt/flash
    mount -t ubifs ubi0:flash_fs /mnt/flash/
    
    cd /mnt/flash
    tar xvf /home/root/tisdk-tiny-image-j7-evm.tar.xz
    sync
    
    cd /home/root/
    umount /mnt/flash
    
    # flashing completes here

    NOTE that we haven't still flashed the kernel image and DTB to the tiny image, we need to pick this from TFTP or SD card while booting from OSPI UBIFS.

    NOTE We are not flashing the Kernel Image and DTB to this as then u-boot needs to read the Image and DTB from the UBIFS and currently there is an issue when u-boot tries to open and read the UNIFS. To work around this we provide the Kernel Image and DTB to the u-boot.

    -3- Update u-boot environment to support UBIFS

    Also, the u-boot environment needs to be modified according to the below to enable UBI FS (this is not part of the SDK, hence the additional steps)

    diff --git a/include/configs/j721e_evm.h b/include/configs/j721e_evm.h
    index edf747b8d3..9d5b7452ca 100644
    --- a/include/configs/j721e_evm.h
    +++ b/include/configs/j721e_evm.h
    @@ -82,6 +82,14 @@
                    "${mtdparts}\0"                                         \
            "run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0"
     
    +#define EXTRA_ENV_J721E_BOARD_SETTINGS_UBI                             \
    +       "init_ubi=run args_all args_ubi; sf probe; "                    \
    +               "ubi part ospi.rootfs; ubifsmount ubi:flash_fs;\0"        \
    +       "get_kern_ubi=ubifsload ${loadaddr} ${bootdir}/${name_kern}\0"  \
    +       "get_fdt_ubi=ubifsload ${fdtaddr} ${bootdir}/${name_fdt}\0"     \
    +       "args_ubi=setenv bootargs console=${console} ${optargs} "       \
    +               "rootfstype=ubifs root=ubi0:flash_fs rw ubi.mtd=ospi.rootfs\0"
    +
     /* U-Boot MMC-specific configuration */
     #define EXTRA_ENV_J721E_BOARD_SETTINGS_MMC                             \
            "boot=mmc\0"                                                    \
    @@ -142,6 +150,7 @@
            DEFAULT_FIT_TI_ARGS                                             \
            EXTRA_ENV_J721E_BOARD_SETTINGS                                  \
            EXTRA_ENV_J721E_BOARD_SETTINGS_MMC                              \
    +        EXTRA_ENV_J721E_BOARD_SETTINGS_UBI                              \
            EXTRA_ENV_RPROC_SETTINGS                                        \
            EXTRA_ENV_DFUARGS                                               \
            DEFAULT_UFS_TI_ARGS                                             \
    

    After applying this, please rebuilt the u-boot and replace in the OSPI Flash. You can also add these environment variables at the u-boot prompt.

    -4- Boot from file system in UBI partition of OSPI

    Now you have the flashed tiny file system in the OSPI UBI, and also the modified u-boot with the environment to support it. Now change bootmode to OPSI and run the below:

    => run args_all
    => run args_ubi
    =>
    => setenv boot ubi
    =>
    =>
    # Here you can load from TFTP etc, you just need the DTB and kernel image in the RAM
    # This is because we don't have Kernel image and DTB in the Tiny file system in UBIFS
    =>
    => ext4load mmc 1:2 0x82000000 /boot/Image
    16654344 bytes read in 337 ms (47.1 MiB/s)
    =>
    => ext4load mmc 1:2 0x81200000 /boot/k3-j721e-common-proc-board.dtb
    92333 bytes read in 5 ms (17.6 MiB/s)
    =>
    => booti 0x82000000 - 0x81200000

    NOTE: I've seen if you do a hard reboor (power OFF -> ON) when the UBIFS is mounted then the next time it corrupts the file system. Please use a soft reboor (run reboot at command from kernel) instead.

    I can understand that the above instructions migh look a little overwhelming at first. Reason being that this out of the box is not supported / tested frequently. I can help you with more questions you have on the above process or in case you get stuck following the above.

    Also, please let me know the whole use-case where the UBIFS file system will add value as then I can circle back to the team and look at the possibility of making this a part of the SDK.

    Regards,

    Karan