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.

Linux/AM5749: Dtb -How to write U-boot to SPI

Hello support!!!

I use ti-processor-sdk-linux-am57xx-evm-06.03.00.106 on am5749 (custom board).

I would like to write U-boot to s25fl256s1.

I found solution here: https://software-dl.ti.com/processor-sdk-linux/esd/docs/06_03_00_106/linux/Foundational_Components_U-Boot.html?highlight=boot

section 3.1.1.7.1. Writing to SPI from U-Boot.

Here we have a good example:

U-Boot # mmc rescan
U-Boot # sf probe 0
U-Boot # sf erase 0 +80000
U-Boot # fatload mmc 0 ${loadaddr} MLO.byteswap
U-Boot # sf write ${loadaddr} 0 ${filesize}
U-Boot # fatload mmc 0 ${loadaddr} u-boot.img
U-Boot # sf write ${loadaddr} 0x20000 ${filesize}
U-Boot # sf erase 80000 +${spiimgsize}
U-Boot # fatload mmc 0 ${loadaddr} zImage
U-Boot # sf write ${loadaddr} ${spisrcaddr} ${filesize}

But I have a couple of questions:

1.I see the meanings with $ and like I understood it is meaning defined like u-boot environment variables. Variable for all rows here is loadaddr=0x82000000?

2.How I should get filesize?(How to measure the size correctly?)

3.How I should get spiimgsize? (How to measure the size correctly?)

4.Like I understood it is address where located zImage?

5.How I should get spisrcaddr?

6.How I should get MLO.byteswap?? I didn't find any MLO.byteswap in directory U-boot after building.

Or maybe I am not right and I should use QSPI section.

BR,

Oleg

  • I tried to use another one example:
    3.1.1.8.2. DRA7xx support

    U-Boot # mmc rescan
    U-Boot # fatload mmc 0 ${loadaddr} MLO
    U-Boot # sf probe 0
    U-Boot # sf erase 0x00000 0x100000
    U-Boot # sf write ${loadaddr} 0x00000 ${filesize}
    U-Boot # fatload mmc 0 ${loadaddr} u-boot.img
    U-Boot # sf write ${loadaddr} 0x40000 ${filesize}

    Log:

    => mmc rescan
    => fatload mmc 0 ${loadaddr} MLO
    157287 bytes read in 9 ms (16.7 MiB/s)
    => sf probe 0
    SF: Detected s25fl256s1 with page size 256 Bytes, erase size 64 KiB, total 32 MiB
    => sf erase 0x00000 0x100000
    SF: 1048576 bytes @ 0x0 Erased: OK
    => sf write ${loadaddr} 0x00000 1048576
    device 0 offset 0x0, size 0x1048576
    SF: 17073526 bytes @ 0x0 Written: OK
    => fatload mmc 0 ${loadaddr} u-boot.img
    1447496 bytes read in 65 ms (21.2 MiB/s)
    => sf write ${loadaddr} 0x40000 1447496
    device 0 offset 0x40000, size 0x1447496
    SF: 21263510 bytes @ 0x40000 Written: OK

    Then I pull out my sd card and do reset...

    => reset
    resetting ...

    U-Boot SPL 2019.01 (Oct 19 2020 - 17:05:56 +0200)
    DRA762-GP ES1.0 ABZ package
    no pinctrl state for default mode
    Card did not respond to voltage select!
    Firmware loading failed
    Trying to boot from SPI
    Loading Environment from FAT... no pinctrl state for default mode
    Card did not respond to voltage select!
    Loading Environment from MMC... Card did not respond to voltage select!
    *** Warning - No block device, using default environment

    Maybe I am wrong again and make any mistakes but it looks like the SPL does not see u-boot...

  • Also I didn't  see some special defconfig for am574x IDK... SPI Boot

  • Oleg Solovev said:
    => fatload mmc 0 ${loadaddr} MLO
    157287 bytes read in 9 ms (16.7 MiB/s)

    Oleg Solovev said:
    sf write ${loadaddr} 0x00000 1048576
    device 0 offset 0x0, size 0x1048576
    SF: 17073526 bytes @ 0x0 Written: OK

    The problem is that you are giving size in decimal but u-boot taking it in Hexadecimal & hence there are
    issues booting. Can you try with the right size?

    Best Regards,
    Keerthy

  • Hello Keerthy,

    I am sorry... wait a minute

    1.I should use example from section 3.1.1.8.2???

    2.I have MLO and u-boot.img after u-boot building it is enought?

    3.If I right understand you it should looks like :

    => mmc rescan
    =>  fatload mmc 0 ${loadaddr} MLO
    157287 bytes read in 9 ms (16.7 MiB/s)
    => sf probe 0
    SF: Detected s25fl256s1 with page size 256 Bytes, erase size 64 KiB, total 32 MiB
    => sf erase 0x00000 0x100000
    SF: 1048576 bytes @ 0x0 Erased: OK
    =>  sf write ${loadaddr} 0x00000 0x26667
    device 0 offset 0x0, size 0x26667
    SF: 157287 bytes @ 0x0 Written: OK
    => fatload mmc 0 ${loadaddr} u-boot.img
    1447496 bytes read in 65 ms (21.2 MiB/s)
    => sf write ${loadaddr} 0x40000 0x161648
    device 0 offset 0x40000, size 0x161648
    SF: 1447496 bytes @ 0x40000 Written: OK
    =>

    and it is still doesn't  work

    U-Boot SPL 2019.01 (Oct 19 2020 - 17:05:56 +0200)
    DRA762-GP ES1.0 ABZ package
    no pinctrl state for default mode
    Card did not respond to voltage select!
    Firmware loading failed
    Trying to boot from SPI
    Loading Environment from FAT... no pinctrl state for default mode
    Card did not respond to voltage select!
    Loading Environment from MMC... Card did not respond to voltage select!
    *** Warning - No block device, using default environment

    Best Regards,

    Oleg

  • Oleg,

    I reproduced the issue and fixed it.

    The u-boot.img size is greater than 1MB and we are erasing only 1MB.

    So:

    Instead of sf erase 0x00000 0x100000


    In the sf erase that you are using please do: sf erase 0x00000 0x200000


    Here is the full set of commands:

    mmc rescan
    fatload mmc 0 ${loadaddr} MLO
    sf probe 0
    sf erase 0x00000 0x200000
    sf write ${loadaddr} 0x00000 ${filesize}
    fatload mmc 0 ${loadaddr} u-boot.img
    sf write ${loadaddr} 0x40000 ${filesize}

    Please try the above and you should be able to QSPI U-boot.
    Resolve this thread if you are successful.

    Best Regards,
    Keerthy

  • Hi Keerthy,

    Excelent answer that is what I need with normal explanation. It is work good!!!

    Thx so much=)

    BR,

    Oleg

  • Hi Oleg,

    You need to click on the post that actually resolved your issue and not your response. That is
    to confirm that exact post resolved your issue.

    Best Regards,
    Keerthy