掌機 - Miyoo Mini Plus - 如何透過U-Boot回復SPI資料



參考資料:
https://github.com/steward-fu/website/releases/download/miyoo-mini-plus/spi.img

必要條件:
1. UART可以使用
2. SPI IPL存在(前400KB)

更新步驟:
1. 格式化MicroSD的第一分區成FAT32
2. 將spi.img放到MicroSD根目錄
3. 按住鍵盤的Enter鍵(讓UART傳送Enter按鍵,藉此中斷U-Boot繼續執行)
4. Miyoo Mini Plus開機

SigmaStar # version
    U-Boot 2015.01 (Mar 26 2023 - 23:38:58)
    arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.2-2018-08 (arm-rel-8.23)) 8.2.1 20180802
    GNU ld (GNU Toolchain for the A-profile Architecture 8.2-2018-08 (arm-rel-8.23)) 2.30.0.20180625

SigmaStar # mmc dev 0
    switch to partitions #0, OK
    mmc0 is current device

SigmaStar # fatls mmc 0
    get_dev_hwpart (mmc, 0, 0)
    get_dev_hwpart ifname mmc, name usb,reloc_get_dev 23f39c2c, select_hwpart 00000000,mmc_get_dev 23f73a84, mmc_select_hwpart 23f72a34
    get_dev_hwpart ifname mmc, name mmc,reloc_get_dev 23f73a84, select_hwpart 23f72a34,mmc_get_dev 23f73a84, mmc_select_hwpart 23f72a34
    part unspecified1
    part_type is 2, part -2
    part unspecified2
    get_partition_info part 1, ret 0
    return part 1
    get_device_and_partition(mmc, 0) return 1, fstype=1
    probe fstype = 1, info->fstype=1
    probe fs_dev_desc = 00000001, info->null_dev_desc_ok=0
     16777216   spi.img

    1 file(s), 0 dir(s)

SigmaStar # fatload mmc 0 0x21000000 spi.img 0 0
    get_dev_hwpart (mmc, 0, 0)
    get_dev_hwpart ifname mmc, name usb,reloc_get_dev 23f39c2c, select_hwpart 00000000,mmc_get_dev 23f73a84, mmc_select_hwpart 23f72a34
    get_dev_hwpart ifname mmc, name mmc,reloc_get_dev 23f73a84, select_hwpart 23f72a34,mmc_get_dev 23f73a84, mmc_select_hwpart 23f72a34
    part unspecified1
    part_type is 2, part -2
    part unspecified2
    get_partition_info part 1, ret 0
    return part 1
    get_device_and_partition(mmc, 0) return 1, fstype=1
    probe fstype = 1, info->fstype=1
    probe fs_dev_desc = 00000001, info->null_dev_desc_ok=0
    reading spi.img
    16777216 bytes read in 1190 ms (13.4 MiB/s)

SigmaStar # sf probe;sf erase 0 1000000;sf write 0x21000000 0 0x1000000
    Flash is detected (0x0B05, 0xC8, 0x40, 0x18)
    SF: Detected nor0 with total size 16 MiB

    _spi_flash_erase: addr 0x0, len 0x1000000 100%(cost 61079 ms)
    SF: 16777216 bytes @ 0x0 Erased: OK

    _spi_flash_write to 0x0, len 0x1000000 from 0x21000000 100%(cost 29740 ms)
    SF: 16777216 bytes @ 0x0 Written: OK

SigmaStar # reset

P.S. 如果有SPI燒錄器可以使用,只要將spi.img直接燒錄到SPI Flash即可