High-speed debugging and automatic testing method based on USB interface
The virtual serial port function is realized in the Bootrom of the product chip through the USB interface, which solves the problem of low testing efficiency in the existing technology, realizes fast download of firmware and fast reading of test results, improves testing efficiency and convenience, and supports multiple support The firing of a storage medium.
Patent Information
- Application Number
- CN202410963943.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-11-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the product needs to continuously burn firmware and restart the device during the testing process, resulting in inefficient testing, especially during batch testing.
The product chip is started and connected through the USB interface, and the firmware is downloaded into the SRAM using Bootrom, and the test code is run without restarting the device, writing back the test results in real time, and quickly reading and parsing the results through the USB interface.
It improves testing efficiency and accuracy, simplifies firmware recording and testing processes, reduces testing costs and manpower investment, and supports the writing functions of multiple storage media, improving convenience and flexibility.
Smart Images

Figure CN118939490A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computers, and in particular relates to a high-speed debugging and automatic testing method based on a USB interface. Background Art
[0002] In the process of electronic product development and production, debugging and testing are key links to ensure product performance and quality. Through systematic verification and evaluation, testing technology can check the correctness, reliability and performance of the software system, discover and fix potential defects, errors and vulnerabilities, thereby improving the stability and reliability of the product. Especially in today's digital age, software has penetrated into all aspects of people's lives, from mobile phone applications to e-commerce platforms, from industrial control systems to smart home devices, software has become an important part of modern society. As one of the main connection methods between modern computers and external devices, the USB interface has been widely popularized and applied. Due to its ease of use, high-speed transmission and versatility, the USB interface plays a vital role in the field of electronic equipment.
[0003] During the production process, it is usually necessary to conduct factory testing on the product. At this time, the serial port is usually used as input and output, and the firmware is burned through USB to test the product. The above method requires burning the firmware to the specified storage medium and then restarting the test firmware for testing. For some tests, it may be necessary to burn the firmware continuously for testing. This not only takes a lot of time, but also requires restarting the device for each burning, which greatly affects the test efficiency. Especially in the factory environment, when a large number of devices are tested in batches, the inefficiency of this method is more prominent.
[0004] Therefore, a high-speed debugging and automated testing method based on a USB interface is needed to solve the problem in the prior art that the test efficiency is greatly affected by constantly burning firmware and restarting the device for testing. Summary of the invention
[0005] The purpose of the present invention is to provide a high-speed debugging and automated testing method based on a USB interface to solve the problems raised in the above background technology.
[0006] To achieve the above object, the present invention provides the following technical solution: a high-speed debugging and automated testing method based on a USB interface, comprising:
[0007] S1. Start the product chip, enter Bootrom, and establish a connection with the test host through the USB interface;
[0008] S2, the test host program sends a firmware download instruction to the product chip through the USB interface;
[0009] S3, download the firmware to the SRAM of the product chip, and Bootrom notifies another CPU of the product chip to load and run the test code from the SRAM;
[0010] S4, the CPU writes the test results back to the specified area of the SRAM in real time;
[0011] S5. After the test is completed, the test host reads the test result;
[0012] S6. The test host receives and analyzes the test result, determines whether the test passes, and outputs the test result.
[0013] It should be noted in the solution that the product chip supports USB function, the test host can identify and connect to the product chip through the USB interface, the USB virtual serial port is supported in the Bootrom of the product chip, the test host program can identify the USB virtual serial port, and communicate with the product chip through the USB virtual serial port.
[0014] It is further worth noting that the test host is provided with a firmware burning tool, an Efuse burning tool and a test tool. The firmware burning tool is used to burn the firmware into the target device, and the Efuse burning tool is used to burn specific configuration information and keys into the Efuse. Once the information is burned, it cannot be modified or erased. The test tool is used to test the performance, function and stability of the product chip. The firmware burning tool supports a variety of hardware devices and storage media, has a wide range of compatibility, and provides a graphical user interface (GUI) or a command line interface (CLI) to facilitate user operation. During the burning process, it provides The checksum verification mechanism ensures the integrity and correctness of the firmware data and supports multiple burning methods and options, such as serial port, USB, network and other connection methods, as well as different burning modes and parameter settings. Through the Efuse burning tool, a unique identifier can be assigned to each device during the production stage to achieve unique tracking and management of the device. The Efuse burning tool can store these keys securely in Efuse to ensure that they will not be tampered with or leaked. Since the information in Efuse cannot be modified or erased once written, using the Efuse burning tool can effectively prevent the device from being illegally tampered with. Even if the device is disassembled or physically attacked, the information stored in Efuse cannot be changed, thus ensuring the security and credibility of the device.
[0015] It is further worth noting that the download instruction includes the content of the instruction header, target information, firmware data, control information, end mark and additional information. After all the data of the firmware file is transmitted, the test host software will wait for the confirmation information of the product chip. This confirmation information indicates that the firmware has been successfully received and stored in the memory of the product chip. If any error occurs during the download process, the test host software will perform corresponding error processing, such as retrying the download, prompting the user to check the device, etc.
[0016] It should be further explained that the downloading of the firmware into the SRAM of the product chip and the notification of the Bootrom to another CPU of the product chip to load and run the test code from the SRAM include:
[0017] S301. In the development environment, open the project configuration file and configure the download method and related parameters;
[0018] S302, using a download tool to download the firmware image file to SRAM;
[0019] S303, Bootrom checks whether the firmware has been downloaded to SRAM. If the firmware exists and is verified to be correct, Bootrom will point the CPU's boot_addr_i (boot address) to the starting position of the firmware in SRAM. After the other CPU is reset or woken up, it will start executing the code from the address specified by boot_addr_i, that is, load and run the test code from SRAM;
[0020] S304. After the CPU loads the test codes from the SRAM, it will start to execute the codes.
[0021] As a preferred implementation, the CPU writes the test result back to the designated area of the SRAM in real time including:
[0022] S401, it is necessary to clarify which area in the SRAM is used to store the test results, and a fixed address segment of the SRAM can be set as the test result storage area;
[0023] S402, during the execution of the test code, the CPU generates or collects test data, and generates corresponding result data according to the test result;
[0024] S403, storing the test result data in a register or memory accessible to the CPU, specifying the SRAM address to be written by setting the SRAM address register or using a pointer, and writing the data in the register or memory to the specified SRAM address by executing a write operation instruction;
[0025] S404, read the test result data just written from the SRAM, compare it with the original data, check the status register of the CPU or SRAM, and confirm whether the write operation is successfully completed.
[0026] As a preferred implementation, the test host reading the test result includes the test host sending a test command through a virtual serial port and reading the test result.
[0027] As a preferred implementation manner, the test host reading the test result includes the test host directly and quickly reading the test result through a USB interface.
[0028] As a preferred implementation, the test results can be directly burned into the firmware via USB to the QSPI, SD card, or eMMC storage medium.
[0029] Compared with the prior art, the high-speed debugging and automated testing method based on the USB interface provided by the present invention has at least the following beneficial effects:
[0030] Implementing the USB virtual serial port function in the product's Bootrom allows the test host to communicate and control the product chip through the virtual serial port, and quickly download the firmware to the product's SRAM through the USB interface, simplifying the firmware burning and testing process. The test code can be run directly without restarting the device, which can achieve fast firmware downloads, direct operation without restarting, and fast reading of test results, improving test efficiency and accuracy, and reducing test costs and manpower investment. This technology implements the firmware burning function for multiple storage media such as QSPI, SD card, and eMMC through the USB interface, which greatly improves the convenience and flexibility of the burning process. Users no longer need to prepare different burning devices and tools for different storage media, thereby reducing operational complexity and costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a flow chart of the high-speed debugging and automated testing method based on USB interface of the present invention;
[0032] Figure 2 It is a structural block diagram of the high-speed debugging and automatic testing method based on USB interface of the present invention. DETAILED DESCRIPTION
[0033] The present invention will be further described below in conjunction with the embodiments.
[0034] See also Figure 1-2 The present invention provides a high-speed debugging and automated testing method based on a USB interface, comprising:
[0035] S1. Start the product chip, enter Bootrom, and establish a connection with the test host through the USB interface;
[0036] S2, the test host program sends a firmware download instruction to the product chip through the USB interface;
[0037] S3, download the firmware to the SRAM of the product chip, and Bootrom notifies another CPU of the product chip to load and run the test code from the SRAM;
[0038] S4, the CPU writes the test results back to the specified area of the SRAM in real time;
[0039] S5. After the test is completed, the test host reads the test result;
[0040] S6. The test host receives and analyzes the test result, determines whether the test passes, and outputs the test result.
[0041] The product chip supports USB function, the test host can identify and connect to the product chip through the USB interface, the USB virtual serial port is supported in the Bootrom of the product chip, the test host program can identify the USB virtual serial port, and communicate with the product chip through the USB virtual serial port.
[0042] The test host is provided with a firmware burning tool, an Efuse burning tool and a test tool. The firmware burning tool is used to burn the firmware into the target device, the Efuse burning tool is used to burn specific configuration information and keys into the Efuse, and the information cannot be modified or erased once burned. The test tool is used to test the performance, function and stability of the product chip.
[0043] The firmware burning tool supports a variety of hardware devices and storage media, has wide compatibility, and provides a graphical user interface (GUI) or command line interface (CLI) to facilitate user operation. During the burning process, it provides a checksum and verification mechanism to ensure the integrity and correctness of the firmware data. It supports a variety of burning methods and options, such as serial port, USB, network and other connection methods, as well as different burning modes and parameter settings.
[0044] Through the Efuse burning tool, a unique identifier can be assigned to each device during the production stage to achieve unique tracking and management of the device. The Efuse burning tool can store these keys securely in Efuse to ensure that they will not be tampered with or leaked. Since the information in Efuse cannot be modified or erased once written, using the Efuse burning tool can effectively prevent the device from being illegally tampered with. Even if the device is disassembled or physically attacked, the information stored in Efuse cannot be changed, thus ensuring the security and credibility of the device.
[0045] The download instruction includes an instruction header, target information, firmware data, control information, an end mark and additional information.
[0046] ARM-based chips usually have a BootLoader program responsible for receiving and processing firmware download instructions. This BootLoader program listens for specific commands on the USB interface; the test host software builds a USB data packet containing the firmware download instruction and sends it to the product chip through the USB interface. This data packet usually contains the address, size, and verification information of the firmware file.
[0047] Once the firmware download command is received and confirmed by the product chip, the test host software will start to transfer the data of the firmware file. This is usually done through USB bulk transfer, because it supports the reliable transmission of large amounts of data; during the transmission process, the test host software will calculate and send data verification information (such as CRC checksum) to ensure the integrity and accuracy of the data, and the product chip will also perform verification after receiving the data.
[0048] After all data of the firmware file is transferred, the test host software will wait for confirmation information from the product chip. This confirmation information indicates that the firmware has been successfully received and stored in the memory of the product chip. If any errors occur during the download process, the test host software will perform corresponding error processing, such as retrying the download, prompting the user to check the device, etc.
[0049] The firmware is downloaded to the SRAM of the product chip, and the Bootrom notifies another CPU of the product chip to load and run the test code from the SRAM, including:
[0050] S301. In the development environment, open the project configuration file and configure the download method and related parameters;
[0051] S302, using a download tool to download the firmware image file to SRAM;
[0052] S303, Bootrom checks whether the firmware has been downloaded to SRAM. If the firmware exists and is verified to be correct, Bootrom will point the CPU's boot_addr_i (boot address) to the starting position of the firmware in SRAM. After the other CPU is reset or woken up, it will start executing the code from the address specified by boot_addr_i, that is, load and run the test code from SRAM;
[0053] S304. After the CPU loads the test codes from the SRAM, it will start to execute the codes.
[0054] Bootrom (Boot Read-Only Memory) is the first code executed after the chip is powered on. It is usually stored in ROM and is non-volatile, so it can retain its content after power failure. Bootrom is responsible for initializing the hardware, checking the startup conditions, and selecting which medium (such as SRAM, Flash, ROM, etc.) to load the main program from.
[0055] Test code may include various hardware and software tests to ensure that the product chip functions properly. Test code usually includes unit testing, integration testing, system testing, etc., and is applied to multiple aspects to verify the correctness, stability and efficiency of the software.
[0056] The CPU writes the test results back to the designated area of the SRAM in real time including:
[0057] S401, it is necessary to clarify which area in the SRAM is used to store the test results, and a fixed address segment of the SRAM can be set as the test result storage area;
[0058] S402, during the execution of the test code, the CPU generates or collects test data, and generates corresponding result data according to the test result;
[0059] S403, storing the test result data in a register or memory accessible to the CPU, specifying the SRAM address to be written by setting the SRAM address register or using a pointer, and writing the data in the register or memory to the specified SRAM address by executing a write operation instruction;
[0060] S404, read the test result data just written from the SRAM, compare it with the original data, check the status register of the CPU or SRAM, and confirm whether the write operation is successfully completed.
[0061] The test host reading the test result includes the test host sending a test command through the virtual serial port and reading the test result.
[0062] The test host reading the test result includes the test host directly and quickly reading the test result through the USB interface.
[0063] The test results can be directly burned into the firmware via USB to the QSPI, SD card, or eMMC storage media.
[0064] The firmware burning function for multiple storage media such as QSPI, SD card and eMMC is realized through the USB interface, which greatly improves the convenience and flexibility of the burning process. Users no longer need to prepare different burning devices and tools for different storage media, thereby reducing the complexity and cost of operation.
[0065] In summary, the advantages of the present invention are: the USB virtual serial port function is implemented in the Bootrom of the product, so that the test host can communicate and control with the product chip through the virtual serial port, and the firmware is quickly downloaded to the SRAM of the product through the USB interface, which simplifies the process of firmware burning and testing, and the test code can be directly run without restarting the device, and the firmware can be quickly downloaded without restarting, and the test results can be quickly read, so as to improve the test efficiency and accuracy, and reduce the test cost and manpower investment. This technology realizes the firmware burning function of multiple storage media such as QSPI, SD card and eMMC through the USB interface, which greatly improves the convenience and flexibility of the burning process, and the user no longer needs to prepare different burning devices and tools for different storage media, thereby reducing the complexity and cost of operation.
[0066] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions only describe the principles of the present invention. The present invention may be subject to various changes and improvements without departing from the spirit and scope of the present invention. These changes and improvements fall within the scope of the present invention. The scope of protection claimed by the present invention is defined by the attached claims and their equivalents.
Claims
1. A high-speed debugging and automated testing method based on USB interface, It is characterized in that include: S1. Start the product chip, enter Bootrom, and establish a connection with the test host through the USB interface; S2, the test host program sends a firmware download instruction to the product chip through the USB interface; S3, download the firmware to the SRAM of the product chip, and Bootrom notifies another CPU of the product chip to load and run the test code from the SRAM; S4, the CPU writes the test results back to the specified area of the SRAM in real time; S5. After the test is completed, the test host reads the test result; S6. The test host receives and analyzes the test result, determines whether the test passes, and outputs the test result.
2. A high-speed debugging and automated testing method based on a USB interface according to claim 1, Features: The product chip supports USB function, the test host can identify and connect to the product chip through the USB interface, the USB virtual serial port is supported in the Bootrom of the product chip, the test host program can identify the USB virtual serial port, and communicate with the product chip through the USB virtual serial port.
3. A high-speed debugging and automated testing method based on a USB interface according to claim 1, Features: The test host is provided with a firmware burning tool, an Efuse burning tool and a test tool. The firmware burning tool is used to burn the firmware into the target device, the Efuse burning tool is used to burn specific configuration information and keys into the Efuse, and the information cannot be modified or erased once burned. The test tool is used to test the performance, function and stability of the product chip.
4. A high-speed debugging and automated testing method based on a USB interface according to claim 1, Features: The download instruction includes an instruction header, target information, firmware data, control information, an end mark and additional information.
5. A high-speed debugging and automated testing method based on a USB interface according to claim 1, It is characterized in that The firmware is downloaded to the SRAM of the product chip, and the Bootrom notifies another CPU of the product chip to load and run the test code from the SRAM, including: S301. In the development environment, open the project configuration file and configure the download method and related parameters; S302, using a download tool to download the firmware image file to SRAM; S303, Bootrom checks whether the firmware has been downloaded to SRAM. If the firmware exists and is verified to be correct, Bootrom will point the CPU's boot_addr_i (boot address) to the starting position of the firmware in SRAM. After the other CPU is reset or woken up, it will start executing the code from the address specified by boot_addr_i, that is, load and run the test code from SRAM; S304. After the CPU loads the test codes from the SRAM, it will start to execute the codes.
6. A high-speed debugging and automated testing method based on a USB interface according to claim 1, It is characterized in that The CPU writes the test results back to the designated area of the SRAM in real time including: S401, it is necessary to clarify which area in the SRAM is used to store the test results, and a fixed address segment of the SRAM can be set as the test result storage area; S402, during the execution of the test code, the CPU generates or collects test data, and generates corresponding result data according to the test result; S403, storing the test result data in a register or memory accessible to the CPU, specifying the SRAM address to be written by setting the SRAM address register or using a pointer, and writing the data in the register or memory to the specified SRAM address by executing a write operation instruction; S404, read the test result data just written from the SRAM, compare it with the original data, check the status register of the CPU or SRAM, and confirm whether the write operation is successfully completed.
7. A high-speed debugging and automated testing method based on a USB interface according to claim 1, Features: The test host reading the test result includes the test host sending a test command through the virtual serial port and reading the test result.
8. A high-speed debugging and automated testing method based on a USB interface according to claim 1, Features: The test host reading the test result includes the test host directly and quickly reading the test result through the USB interface.
9. A high-speed debugging and automated testing method based on a USB interface according to any one of claims 1 to 8, Features: The test results can be directly burned into the firmware via USB to the QSPI, SD card, or eMMC storage media.
Citation Information
Patent Citations
Equipment production testing method and system, and testing terminal
CN109596167A
Chip software burning method and chip software burning data processing method and device
CN111124440A
Local voice recognition module production test method
CN112860582A
Method and system for automatically calibrating high-speed downloading of preset firmware in mass production of chip
CN113282442A
Memory test system / Method at the time of starting system by control firmware
JP2000090014A
