Upgrade the firmware via USB cable Introduction This article describes how to upgrade the firmware file on the host to the flash memory of the development board through the USB data cable. When upgrading, you need to choose the appropriate upgrade mode according to the host operating system and firmware type. Preparatory Tools C40PL development board Firmware host computer USB data cable Prepare Firmware The firmware can be obtained by compiling the SDK, or you can download the public firmware (unified firmware) from the Resource download . There are two types of firmware files: A single unified firmware The unified firmware is a single file packaged and merged by all files such as the partition table, bootloader, uboot, kernel, system and so on. The firmware officially released by Firefly adopts a unified firmware format. Upgrading the unified firmware will update the data and partition table of all partitions on the motherboard, and erase all data on the motherboard. Multiple partition images That is, files with independent functions, such as partition table, bootloader, and kernel, are generated during the development phase. The independent partition image can only update the specified partition, while keeping other partition data from being destroyed, it will be very convenient to debug during the development process. Through the unified firmware unpacking / packing tool, the unified firmware can be unpacked into multiple partition images, or multiple partition images can be merged into a unified firmware. Install the Upgrade Tool Windows Operating System Install RK USB driver Download Release_DriverAssistant.zip , extract, and then run the DriverInstall.exe inside . In order for all devices to use the updated driver, first select Driver uninstall( 驱动卸载) and then select Driver install(驱动安装). Linux Operating System There is no need to install device driver under Linux. Linux_Upgrade_Tool Download Linux_Upgrade_Tool , And install it into the system as follows for easy invocation: unzip Linux_Upgrade_Tool_xxxx.zip cd Linux_UpgradeTool_xxxx sudo mv upgrade_tool /usr/local/bin sudo chown root:root /usr/local/bin/upgrade_tool sudo chmod a+x /usr/local/bin/upgrade_tool Linux_adb_fastboot Download Linux_adb_fastboot , And install it into the system as follows for easy invocation: sudo mv adb /usr/local/bin sudo chown root:root /usr/local/bin/adb sudo chmod a+x /usr/local/bin/adb sudo mv fastboot /usr/local/bin sudo chown root:root /usr/local/bin/fastboot sudo chmod a+x /usr/local/bin/fastboot Enter Upgrade mode Usually we upgrade firmware in two modes, namely "Loader" mode and "MaskRom" mode. Before we can write the firmware, we need to connect the device and put the board into upgradable mode. Loader mode Hardware way into Loader mode Connect the device and press the RECOVERY button to enter the Loader mode. The steps are as follows: Disconnect the power adapter first Use USB 数据线 to connect one end to the host and the other end to the development board Press and hold the RECOVERY button on the device The button position may vary slightly depending on the hardware version, please refer to the actual silk screen Connect the power After about two seconds, release the RECOVERY button Software way into Loader mode USB data cable is connected, use the command in the serial debugging terminal or "adb shell": reboot loader Check the Loader mode How to determine whether the board is in Loader mode, we can check through the tool Windows Operating System The AndroidTool displays the prompt Found One LOADER Device at the bottom if the “Enter Loader mode” operation is performed, and the LOADER prompted by the upgrade tool is not displayed, check whether the Windows host computer you to discover new hardware and configure the driver. Open the Device manager and a new device "Rockusb Device" will appear, as shown below. If not, you can go back to the previous step to reinstall the driver . Linux Operating System After running upgrade_tool, you can see a Loader prompt in the connected device: firefly@T-chip:~/severdir/down_firmware$ sudo upgrade_tool List of rockusb connected DevNo=1 Vid=0x2207,Pid=0x330c,LocationID=106 Loader Found 1 rockusb,Select input DevNo,Rescan press ,Quit press :q MaskRom mode To enter MaskRom mode, please refer to MaskRom mode . Upgrade the firmware Windows Operating System Upgrade unified firmware - update.img The steps to update the unified firmware "update.img" are as follows: Switch to the Upgrade Firmware page. Press the Firmware button to open the firmware file to be upgraded. The upgrade tool displays detailed firmware information. Press the Upgrade button to start the upgrade. If the upgrade fails, you can try to erase the Flash by pressing the EraseFlash button first, and then upgrade. Upgrade Partition image The steps to upgrade the partition image are as follows: Switch to the Download Image page. Check the partition to be burned, and select multiple. Make sure the path of the image file is correct. If necessary, click the blank table cell on the right side of the path to select it again. Click Run button to start the upgrade, and the device will restart automatically after the upgrade. Tips for using the flashing tool: Get device partition table information Put the rv1126 device into loader mode. Then click the Dev Partition button in the picture to get the device partition information. Click Update to get the device partition information as follows: Export device partition table information Right-click the mouse to pop up a menu, select export config to export the partition table configuration: Load device partition table information Right-click the mouse to pop up a menu, select load config to load the partition table configuration: Linux Operating System Upgrade unified firmware - update.img sudo upgrade_tool uf update.img If the upgrade fails, try erasing before upgrading. # erase flash : Using the ef parameter requires the loader file or the corresponding update.img to be specified. # update.img :The ubuntu firmware you need to upgrade. sudo upgrade_tool ef update.img # upgrade again sudo upgrade_tool uf update.img Upgrade Partition image View the SDK compilation output directory rockdev. You can see that boot.img in this directory is linked to /path/to/sdk/kernel/zboot.img. lvsx@tchip16:~/project/rv1126_rv1109 $ ls -l rockdev/ total 364 lrwxrwxrwx 1 lvsx lvsx 49 8月 27 11:43 boot.img -> /home/lvsx/project/rv1126_rv1109/kernel/zboot.img -rw-rw-r-- 1 lvsx lvsx 272 8月 20 13:44 ffimage.swv lrwxrwxrwx 1 lvsx lvsx 41 8月 20 13:44 MiniLoaderAll.bin -> ../u-boot/rv1126_spl_loader_v1.08.108.bin lrwxrwxrwx 1 lvsx lvsx 44 8月 20 13:44 misc.img -> ../device/rockchip/rockimg/wipe_all-misc.img -rw-rw-r-- 1 lvsx lvsx 5242880 8月 20 13:44 oem.img drwxrwxr-x 2 lvsx lvsx 4096 8月 20 13:44 pack lrwxrwxrwx 1 lvsx lvsx 90 8月 20 15:15 parameter.txt -> /home/lvsx/project/rv1126_rv1109/device/rockchip/rv1126_rv1109/parameter-buildroot-fit.txt lrwxrwxrwx 1 lvsx lvsx 71 8月 20 13:44 recovery.img -> ../buildroot/output/rockchip_rv1126_rv1109_recovery/images/recovery.img lrwxrwxrwx 1 lvsx lvsx 72 8月 20 13:44 rootfs.ext4 -> ../buildroot/output/firefly_rv1126_rv1109_facial_gate/images/rootfs.ext2 lrwxrwxrwx 1 lvsx lvsx 72 8月 20 13:44 rootfs.img -> ../buildroot/output/firefly_rv1126_rv1109_facial_gate/images/rootfs.ext2 lrwxrwxrwx 1 lvsx lvsx 60 8月 19 17:37 rootfs.squashfs -> ../buildroot/output/firefly_rv1126_rv1109/images/rootfs.ext2 lrwxrwxrwx 1 lvsx lvsx 19 8月 20 13:44 uboot.img -> ../u-boot/uboot.img -rw-rw-r-- 1 lvsx lvsx 5242880 8月 20 13:44 userdata.img So the kernel firmware that actually needs to be burned is zboot.img. If it is in the rockdev directory, execute the following command to burn the kernel firmware: sudo upgrade_tool di -b /path/to/sdk/rockdev/boot.img If it is in the /path/to/sdk/kernel directory, you need to execute the following command to burn the kernel firmware: sudo upgrade_tool di -b /path/to/sdk/kernel/zboot.img Note: Do not burn boot.img in the /path/to/sdk/kernel directory. Otherwise, the device will fail to start. Commonly used programming commands are as follows: sudo upgrade_tool di -b /path/to/boot.img sudo upgrade_tool di -r /path/to/recovery.img sudo upgrade_tool di -m /path/to/misc.img sudo upgrade_tool di -u /path/to/uboot.img sudo upgrade_tool di -dtbo /path/to/dtbo.img sudo upgrade_tool di -p paramater #upgrade parameter sudo upgrade_tool ul bootloader.bin #upgrade bootloader If the upgrade fails due to flash problems, you can try low-level formatting and erase nand flash: sudo upgrade_tool lf update.img # low-level formatting sudo upgrade_tool ef update.img # erase fastboot Burn dynamic partitions: adb reboot fastboot # enter bootloader sudo fastboot flash vendor vendor.img sudo fastboot flash system system.img sudo fastboot reboot # After the burn is successful, restart FAQs 1. How to forcibly enter MaskRom mode A1 : If the board does not enter Loader mode, you can try to force your way into MaskRom mode. See operation method "How to enter MaskRom mode" . 2. Analysis of programming failure If Download Boot Fail occurs during the programming process, or an error occurs during the programming process, as shown in the figure below, it is usually caused by the poor connection of the USB cable, the inferior cable, or the insufficient drive capability of the USB port of the computer. Troubleshoot the computer USB port.