Construction method of SW platform firmware online updating tool

By building and integrating flash reading and writing tools into the Shenwei platform, the problems of firmware update complexity and inefficiency are solved, and the flexibility and efficiency of online firmware update are achieved, which is suitable for large-scale deployment.

CN119829104APending Publication Date: 2025-04-15WUXI ADVANCED TECH RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411854749.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The prior art has problems such as complexity, inefficiency, high user costs and unsuitable for large-scale updates during firmware updates.

Method used

By encapsulating the mapping and operation of SPI control registers, flash reading tools and flash writing tools are built, and integrated into the application layer of the Shenwei platform to achieve accurate read and write control of flash on the memory chip and support online firmware updates.

Benefits of technology

It simplifies the process of online firmware updates, improves the flexibility and efficiency of updates, reduces user costs, and is suitable for large-scale deployment scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829104A_ABST
    Figure CN119829104A_ABST
Patent Text Reader

Abstract

The invention discloses a method for constructing a SW platform firmware online updating tool, which comprises the following steps of: packaging a user mode program into an executable binary file in a static link manner to obtain a flash reading tool and a flash writing tool, and packaging the flash reading tool and the flash writing tool in an application layer of a SW platform, and the SW platform firmware updating module is used for performing read / write operation on any initial position / any size of any storage chip flash of the hardware layer so as to update the SW platform firmware on line. The problem that traditional firmware updating is complex and low in efficiency is solved, the updating efficiency is improved, and the technical blank of the SW platform is filled.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method for constructing a Shenwei platform firmware online update tool, belonging to the field of software technology. Background Art

[0002] On the X86 platform, computer manufacturers such as Lenovo, HP, Dell, etc., all provide special tools that enable users to conveniently manage firmware updates within the operating system. Microsoft has gone a step further and integrated the driver update program into Windows Update, so that hardware devices that meet the requirements can seamlessly receive the latest updates. In the Linux environment, the launch of the LVFS (Linux Vendor Firmware Service) service provides a standardized solution for the firmware update process between different hardware and Linux distributions. For the ARM platform, FOTA (Firmware Over-the-Air) technology has been widely used, especially in the field of embedded and IoT devices, which allows devices to remotely receive and apply firmware updates. Companies such as Google and many IoT device manufacturers provide solid infrastructure support for FOTA updates. At the same time, in the Linux system, the fwupd tool is used to manage firmware updates in the background, providing a unified firmware update interface for various devices. On the SW platform, the external debug card implements firmware updates through the JTAG interface, which makes it possible to accurately update the firmware parts with bugs. In addition, it also supports remote updates, which significantly improves the flexibility and efficiency of debugging. What is particularly important is that when the firmware content is damaged and the operating system cannot start normally, an external debugging card can be used as an important means to restore the firmware and prevent the device from becoming bricked.

[0003] Although the external debugging card of the SW platform provides flexibility and recovery means for firmware updates through the JTAG interface, its existing technology still has many shortcomings. First, the hardware implementation of the JTAG interface is relatively complex, and its parallelism and large number of control lines increase the difficulty of use for software engineers and operation and maintenance personnel. In addition, the configuration process of the debugging card is also quite cumbersome. It is necessary to ensure that the hardware line is stable and connected correctly, and to accurately configure the level and clock frequency of the maintenance card pins, which is not friendly to non-professional engineers. Secondly, the JTAG interface has limitations on data transmission rate, which to a certain extent affects the efficiency of firmware updates. At the same time, using an external debugging card to update the firmware also requires users to purchase additional debugging cards and connect them to the PC via wire, which not only increases the user's cost, but also requires the user's PC to have an RJ45 network interface. Finally, the external debugging card method is not suitable for large-scale update scenarios. When a large number of machines need to be updated, maintenance personnel need to perform a series of cumbersome steps, including powering off the machine, removing the machine from the shelf, connecting the debugging card, powering on, connecting the PC, configuring the debugging card, updating the firmware, power-on verification, and putting the machine on the shelf. If the update is unsuccessful, these steps need to be performed again, which will consume a lot of human resources and time costs. Summary of the invention

[0004] The purpose of the present invention is to provide a method for constructing a firmware online update tool for the Shenwei platform. By operating the SPI control register to construct a flash reading tool and a flash writing tool, the reading and writing functions of the flash storage chip are realized, the problem of complex and inefficient traditional firmware updates is solved, the update efficiency is improved and the technical gap of the Shenwei platform is filled.

[0005] In order to solve the above technical problems, the present invention is implemented by adopting the following technical solutions.

[0006] The present invention provides a method for constructing a Shenwei platform firmware online update tool, comprising: Encapsulate the following operations into an executable binary file to get the flash reading tool: Map the SPI control register to memory and obtain the memory pointer returned by the operation to indirectly configure the related registers; Call the SPI_FLASH_Buffer_Read interface to complete the read operation in blocks; Encapsulate the following operations into an executable binary file to get the flash writing tool: Map the SPI control register to memory and obtain the memory pointer returned by the operation to indirectly configure the related registers; If the data to be written is 64K aligned, call the spi_flash_block_erase interface to erase the area on the storage chip flash where the data is to be written, and call the spi_flash_buffer_write interface to write the data; If the data to be written is less than 64K or not aligned according to 64K, call the spi_flash_buffer_read interface to read the 64K content stored in the storage chip flash into the memory, and merge the data to be written with the read content, call the spi_flash_block_erase interface to erase the data to be written on the storage chip flash, and call the spi_flash_buffer_write interface to complete the write operation in blocks; The flash reading tool and the flash writing tool are encapsulated in the application layer of the Shenwei platform to obtain the Shenwei platform firmware online update tool, which is used to perform read / write operations on any starting position / any size of any storage chip flash in the hardware layer to update the Shenwei platform firmware online.

[0007] Furthermore, the hardware layer also includes a CPU with a built-in SPI control register and an SPI bus that responds to read / write requests from a flash reading tool / flash writing tool, and communicates with the storage chip flash through the SPI bus.

[0008] Furthermore, it also includes encapsulating an update script for the Shenwei platform firmware online update tool to receive user input parameters and serve as an interface for the user to interact with the flash reading tool and the flash writing tool.

[0009] Furthermore, the update script includes a motherboard topology detection interface, which is used to perform different burning processes for single-way, dual-way and quad-way machines, wherein a single-way machine only burns the storage chip flash of the first CPU in the hardware layer, a dual-way machine burns the storage chip flash of the first two CPUs in the hardware layer, and a quad-way machine burns the storage chip flash of the first four CPUs in the hardware layer.

[0010] Furthermore, the update script also includes a firmware specification standard interface for detecting the firmware file update location and storage format according to the magic number information or CPU model information of the Shenwei platform firmware.

[0011] Furthermore, the update script also includes a file consistency verification interface, which is used to verify whether the file is consistent with the source file based on the md5 value of the file read by the flash reading tool and the md5 value of the source file; wherein, if the file read by the flash reading tool is consistent with the source file, 0 is returned; if the file read by the flash reading tool is inconsistent with the source file, -1 is returned and a prompt message is output, and the source file is the file configured when writing to the storage chip flash.

[0012] Furthermore, the update script also includes a write operation interface with a verification function, which is used to verify whether the written file is correct when the data of the file to be written is less than 64K, including: Calling a mainboard topology detection interface, and writing a source file into a storage chip flash corresponding to the mainboard topology according to the mainboard topology; Using a flash reading tool, the contents of the covered area in the storage chip flash corresponding to the mainboard topology structure are read again according to the mainboard topology structure and redirected to different temporary files; Call the file consistency check interface to check whether the source file is consistent with each temporary file according to the mainboard topology. If they are consistent, return 0 to perform the write operation; if they are inconsistent, return -1 and output a prompt message.

[0013] Furthermore, the update script also includes a resource recovery interface for preventing conflicts or other unknown errors in the SPI control register caused by user misoperation. When a SIGINT interrupt signal sent by the user is obtained, all running read and write processes are terminated, the occupied system resources are recovered, and a prompt message is output.

[0014] Furthermore, it also includes configuring a parallel operation tool for the Shenwei platform firmware online update tool, which is used to batch update the Shenwei platform firmware online, including performing password-free operations on the control machine and the machine to be updated, distributing the update firmware package to the machine to be updated, and executing the update in parallel.

[0015] Furthermore, the control machine and the machine to be updated perform a password-free operation, distribute the update firmware package to the machine to be updated, and execute the update method in parallel, including: According to the IP range and user name of the machine to be updated, a machine IP list is generated in a loop, where each line in the machine IP list is in the format of "user name@IP address"; Use the sshpass command and the ssh-copy-id command in conjunction with the machine IP list to cyclically set up password-free login for each machine in the machine IP list; Use the pscp.pssh tool to distribute the firmware update package to each machine to be updated. Specifying the -r parameter means that the firmware update package will be distributed recursively. Use the pssh tool to perform the update operation, wherein the -h parameter is specified to use the machine IP list to perform the update operation, and the update command to be executed is filled in the double quotes of the pssh command; Use the --inline-stdout parameter to output the output results of each machine in sequence to the terminal interface of the control machine; Enter the reboot command in the double quotes of another pssh command to perform a batch reboot operation; or According to the IP range and user name of the machine to be updated, a machine IP list is generated in a loop, where each line in the machine IP list is in the format of "user name@IP address"; Use the sshpass command and the ssh-copy-id command in conjunction with the machine IP list to cyclically set up password-free login for each machine in the machine IP list; Use the parallel-scp tool to distribute the update firmware package to each machine to be updated. Specifying the -r parameter means that the update firmware package will be distributed recursively. Use the parallel-ssh tool to perform the update operation, wherein the -h parameter is specified to use the machine IP list to perform the update operation, and the update command to be executed is filled in the double quotes of the parallel-ssh command; Use the --inline-stdout parameter to output the output results of each machine in sequence to the terminal interface of the control machine; Enter the reboot command in the double quotation marks of another parallel-ssh command to perform a batch reboot operation.

[0016] Compared with the prior art, the present invention has the following beneficial effects: The present invention encapsulates efficient flash reading tools and flash writing tools into executable binary files and integrates them into the application layer, thereby realizing precise reading and writing control of the hardware layer storage chip flash. It not only supports reading and writing operations on the storage chip flash area of ​​any starting position and any size, but also greatly simplifies the process of firmware online update, improves the flexibility and efficiency of the update, and brings significant convenience to the firmware management of the Shenwei platform.

[0017] The present invention can intelligently detect the mainboard topology structure such as a single-channel machine, a dual-channel machine, and a quad-channel machine by encapsulating the update script, and execute the corresponding burning process according to different topological structures, thereby ensuring the flexibility and accuracy of the firmware update. Whether it is a single CPU or a multi-CPU system, it can be properly processed, greatly simplifying the update process and improving efficiency; In addition, the update script also includes a firmware specification standard detection interface and a file consistency verification interface, which can accurately determine the update location and storage format of the firmware file, and ensure the consistency of the file through MD5 value verification before writing. In addition, the write operation interface with verification function further enhances the reliability of the writing process. The final write operation is performed only after confirming that the writing is correct, effectively avoiding update failures caused by file damage or inconsistency.

[0018] The present invention is also equipped with a parallel operation tool, which can batch update the firmware of the Shenwei platform online. Through password-free login, firmware package distribution and parallel execution of update operations, the operation and maintenance efficiency in large-scale deployment scenarios is significantly improved. At the same time, the resource recovery interface in the update script can also prevent SPI control register conflicts or other unknown errors caused by user misoperation, and ensure the stability and security of the system by timely terminating the read and write process and outputting prompt information. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 The figure is a schematic diagram of the structure of a Shenwei platform firmware online update tool provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0020] The technical solution of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solution of the present invention, rather than limitations on the technical solution of the present invention. The embodiments of the present invention and the technical features in the embodiments may be combined with each other unless there is a conflict.

[0021] The term "and / or" is only a description of the association relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " generally indicates that the related objects are in an "or" relationship.

[0022] Example 1

[0023] like Figure 1 As shown, the online firmware update tool of the Shenwei platform includes a flash reading tool and a flash writing tool. This embodiment introduces a method for constructing the online firmware update tool of the Shenwei platform, including: Step 1: Encapsulate the following operations into an executable binary file to obtain the flash reading tool: Map the SPI control registers to memory and get the memory pointer returned by the operation to indirectly configure the related registers.

[0024] The present invention uses a memory mapping technology to map the address space of the SPI control register to a certain memory address in the user space. The user program can indirectly configure the SPI control register by operating the memory address to achieve control of the SPI bus and a memory chip flash connected thereto, thereby improving the access efficiency of the program to the SPI control register and making the read and write operations on the flash more direct and flexible.

[0025] Call the SPI_FLASH_Buffer_Read interface to complete the read operation in blocks.

[0026] SPI_FLASH_Buffer_Read is a packaged interface function used to read data in blocks from the flash memory chip connected to the SPI. The SPI_FLASH_Buffer_Read function configures the SPI bus, sends the read command, and receives the data returned by the flash.

[0027] Step 2: Encapsulate the following operations into an executable binary file to obtain the flash writing tool: Map the SPI control registers to memory and get the memory pointer returned by the operation to indirectly configure the related registers.

[0028] If the data to be written is 64K aligned, call the spi_flash_block_erase interface to erase the area on the storage chip flash where the data is to be written, and call the spi_flash_buffer_write interface to write the data.

[0029] The present invention ensures that the new data will not be interfered by the original data when writing by erasing the original data on the storage chip flash before writing the new data. The spi_flash_block_erase interface is used to perform a block erase operation on the specified storage chip flash area, and the spi_flash_buffer_write interface is used to write the prepared data to the specified position of the storage chip flash, thereby realizing the data writing operation, and because the data is 64K aligned, the entire block can be written at one time, thereby improving the writing efficiency.

[0030] If the data to be written is less than 64K or is not aligned according to 64K, call the spi_flash_buffer_read interface to read the 64K content stored in the storage chip flash into the memory, and merge the data to be written with the read content, call the spi_flash_block_erase interface to erase the data to be written on the storage chip flash, and call the spi_flash_buffer_write interface to complete the write operation in blocks.

[0031] Since the data to be written is less than the size of a block, it is necessary to first read the content of the current block on the flash into the memory so as to merge the new data in. The present invention obtains the content of the current block by calling the spi_flash_buffer_read interface, and merges the new data to be written with the read flash block content in the memory, ensuring that the new data can correctly overwrite or add to the original data.

[0032] Step three: Encapsulate the flash reading tool and flash writing tool in the application layer of the Shenwei platform to obtain the Shenwei platform firmware online update tool, which is used to perform read / write operations on any starting position / any size of any storage chip flash in the hardware layer to update the Shenwei platform firmware online.

[0033] The present invention encapsulates the flash reading tool and the flash writing tool in the application layer of the Shenwei platform, realizes the operation of the underlying hardware access logic, that is, the storage chip flash, ensures the compatibility of the operating system distribution version, and interacts through the unified interface provided by the application layer. The encapsulation process follows the modularization principle of software design, aiming to improve the reusability, maintainability and scalability of the code.

[0034] The encapsulated flash reading tool and flash writing tool serve as a bridge between the application layer and the hardware layer, providing an abstract access interface to the storage chip flash, so that the upper-layer application does not need to care about the specific implementation details of the underlying hardware, and can complete the reading and writing operations of the storage chip flash by simply calling the encapsulated interface.

[0035] By calling the packaged flash reading tool and flash writing tool, the system can read, modify and write the firmware in the storage chip flash at runtime, thereby realizing dynamic update and upgrade of the firmware.

[0036] In addition, the packaged flash read tool and flash write tool also support read and write operations on any starting position and any size of the storage chip flash, providing great flexibility, and can also selectively update part or all of the firmware content according to actual needs.

[0037] Example 2

[0038] Based on the same inventive concept as Example 1, this example introduces a method for constructing a Sunway platform firmware online update tool, including: Step 1: Encapsulate the following operations into an executable binary file to obtain the flash reading tool: Map the SPI control register to memory and obtain the memory pointer returned by the operation to indirectly configure the related registers; Call the SPI_FLASH_Buffer_Read interface to complete the read operation in blocks; Step 2: Encapsulate the following operations into an executable binary file to obtain the flash writing tool: Map the SPI control register to memory and obtain the memory pointer returned by the operation to indirectly configure the related registers; If the data to be written is 64K aligned, call the spi_flash_block_erase interface to erase the area on the storage chip flash where the data is to be written, and call the spi_flash_buffer_write interface to write the data; If the data to be written is less than 64K or is not aligned according to 64K, resulting in less than 64K content remaining, call the spi_flash_buffer_read interface to read the 64K content stored in the storage chip flash into the memory, and merge the data to be written with the read content, call the spi_flash_block_erase interface to erase the data to be written on the storage chip flash, and call the spi_flash_buffer_write interface to complete the write operation in blocks.

[0039] Step three: Encapsulate the flash reading tool and flash writing tool in the application layer of the Shenwei platform to obtain the Shenwei platform firmware online update tool, which is used to perform read / write operations on any starting position / any size of any storage chip flash in the hardware layer to update the Shenwei platform firmware online.

[0040] The hardware layer also includes a CPU with a built-in SPI control register and an SPI bus that responds to read / write requests from a flash reading tool / flash writing tool, and communicates with the storage chip flash through the SPI bus.

[0041] In this embodiment, it also includes encapsulating an update script for the Shenwei platform firmware online update tool to receive user input parameters and serve as an interface for the user to interact with the flash reading tool and the flash writing tool.

[0042] In this embodiment, the update script includes a motherboard topology structure interface for detecting different burning processes for single-way, dual-way and quad-way machines, wherein the single-way machine only burns the storage chip flash of the first CPU in the hardware layer, the dual-way machine burns the storage chip flash of the first two CPUs in the hardware layer, and the quad-way machine burns the storage chip flash of the first four CPUs in the hardware layer.

[0043] In this embodiment, the update script also includes a firmware specification standard interface for detecting the firmware file update location and storage format according to the magic number information or CPU model information of the Shenwei platform firmware.

[0044] In this embodiment, the update script also includes a file consistency verification interface, which is used to verify whether the file is consistent with the source file based on the md5 value of the file read by the flash reading tool and the md5 value of the source file; if the file read by the flash reading tool is consistent with the source file, 0 is returned; if the file read by the flash reading tool is inconsistent with the source file, -1 is returned and a prompt message is output, and the source file is the file configured when writing to the storage chip flash.

[0045] In this embodiment, the update script also includes a write operation interface with a verification function, which is used to verify whether the written file is correct when the data of the file to be written is less than 64K, including: Calling a mainboard topology detection interface, and writing a source file into a storage chip flash corresponding to the mainboard topology according to the mainboard topology; Using a flash reading tool, the contents of the covered area in the storage chip flash corresponding to the mainboard topology structure are read again according to the mainboard topology structure and redirected to different temporary files; Call the file consistency check interface to check whether the source file is consistent with each temporary file according to the mainboard topology. If they are consistent, return 0 to perform the write operation; if they are inconsistent, return -1 and output a prompt message.

[0046] In this embodiment, the update script also includes a resource recovery interface for preventing conflicts or other unknown errors in the SPI control register caused by user misoperation. When a SIGINT interrupt signal sent by the user is obtained, all running read and write processes are terminated, the occupied system resources are recovered, and a prompt message is output.

[0047] This embodiment also configures a parallel operation tool for the Shenwei platform firmware online update tool, which is used to batch update the Shenwei platform firmware online, including performing password-free operations on the control machine and the machine to be updated, distributing the update firmware package to the machine to be updated, and executing the update in parallel.

[0048] In this embodiment, the control machine and the machine to be updated perform a password-free operation, distribute the update firmware package to the machine to be updated, and execute the update method in parallel, including: According to the IP range and user name of the machine to be updated, a machine IP list is generated in a loop, where each line in the machine IP list is in the format of "user name@IP address"; Use the sshpass command and the ssh-copy-id command in conjunction with the machine IP list to cyclically set up password-free login for each machine in the machine IP list; On the domestic operating system Kylin platform, the following method can be used: Use the pscp.pssh tool to distribute the firmware update package to each machine to be updated. Specifying the -r parameter means that the firmware update package will be distributed recursively. Use the pssh tool to perform the update operation, wherein the -h parameter is specified to use the machine IP list to perform the update operation, and the update command to be executed is filled in the double quotes of the pssh command; Use the --inline-stdout parameter to output the output results of each machine in sequence to the terminal interface of the control machine; Enter the reboot command in double quotation marks of another pssh command to perform a batch reboot operation.

[0049] On the domestic operating system Tongxin platform: Use the parallel-scp tool to distribute the update firmware package to each machine to be updated. Specifying the -r parameter means that the update firmware package will be distributed recursively. Use the parallel-ssh tool to perform the update operation, wherein the -h parameter is specified to use the machine IP list to perform the update operation, and the update command to be executed is filled in the double quotes of the parallel-ssh command; Use the --inline-stdout parameter to output the output results of each machine in sequence to the terminal interface of the control machine; Enter the reboot command in the double quotation marks of another parallel-ssh command to perform a batch reboot operation.

[0050] The present invention greatly reduces the operational difficulty of software engineers and operation and maintenance personnel, and the firmware update can be completed using the Linux command. Compared with the method for updating the firmware using the debug card, the present invention reads the flash of the storage chip at a rate of about 167K / s, and writes the flash of the storage chip at a rate of about 37K / s, and the performance is improved by about 4 times. In terms of visualization, the update progress can be intuitively displayed, so that the maintenance personnel can grasp the update status in real time. From the cost point of view, the method of this invention no longer requires additional hardware equipment, such as a debug card, a PC, a switching cable, etc., which reduces the user's use cost.

[0051] To summarize the above embodiments, the present invention encapsulates efficient flash reading tools and flash writing tools into executable binary files and integrates them into the application layer, thereby realizing precise reading and writing control of the hardware layer storage chip flash. It not only supports reading and writing operations on storage chip flash areas of any starting position and any size, but also greatly simplifies the process of firmware online updates, improves the flexibility and efficiency of updates, and brings significant convenience to the firmware management of the Shenwei platform.

[0052] The present invention can intelligently detect the mainboard topology structure such as a single-channel machine, a dual-channel machine, and a quad-channel machine by encapsulating the update script, and execute the corresponding burning process according to different topological structures, thereby ensuring the flexibility and accuracy of the firmware update. Whether it is a single CPU or a multi-CPU system, it can be properly processed, greatly simplifying the update process and improving efficiency; In addition, the update script also includes a firmware specification standard detection interface and a file consistency verification interface, which can accurately determine the update location and storage format of the firmware file, and ensure the consistency of the file through MD5 value verification before writing. In addition, the write operation interface with verification function further enhances the reliability of the writing process and effectively avoids update failures caused by file damage or inconsistency.

[0053] The present invention is also equipped with a parallel operation tool, which can batch update the firmware of the Shenwei platform online. Through password-free login, firmware package distribution and parallel execution of update operations, the operation and maintenance efficiency in large-scale deployment scenarios is significantly improved. At the same time, the resource recovery interface in the update script can also prevent SPI control register conflicts or other unknown errors caused by user misoperation, and ensure the stability and security of the system by timely terminating the read and write process and outputting prompt information.

[0054] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0055] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0056] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0057] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0058] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which all fall within the protection of the present invention.

Claims

1. A method for constructing a Shenwei platform firmware online update tool, characterized in that: include: Encapsulate the following operations into an executable binary file to get the flash reading tool: Map the SPI control register to memory and obtain the memory pointer returned by the operation to indirectly configure the related registers; Call the SPI_FLASH_Buffer_Read interface to complete the read operation in blocks; Encapsulate the following operations into an executable binary file to get the flash writing tool: Map the SPI control register to memory and obtain the memory pointer returned by the operation to indirectly configure the related registers; If the data to be written is 64K aligned, call the spi_flash_block_erase interface to erase the area on the storage chip flash where the data is to be written, and call the spi_flash_buffer_write interface to write the data; If the data to be written is less than 64K or not aligned according to 64K, call the spi_flash_buffer_read interface to read the 64K content stored in the storage chip flash into the memory, and merge the data to be written with the read content, call the spi_flash_block_erase interface to erase the data to be written on the storage chip flash, and call the spi_flash_buffer_write interface to complete the write operation in blocks; The flash reading tool and the flash writing tool are encapsulated in the application layer of the Shenwei platform to obtain the Shenwei platform firmware online update tool, which is used to perform read / write operations on any starting position / any size of any storage chip flash in the hardware layer to update the Shenwei platform firmware online.

2. The method for constructing the online firmware update tool of the Shenwei platform according to claim 1, characterized in that: The hardware layer also includes a CPU with a built-in SPI control register and an SPI bus that responds to read / write requests from a flash reading tool / flash writing tool, and communicates with a storage chip flash via the SPI bus.

3. The method for constructing the online firmware update tool of the Shenwei platform according to claim 1, characterized in that: It also includes encapsulating an update script for the Shenwei platform firmware online update tool, which is used to receive user input parameters and serve as an interface for the user to interact with the flash reading tool and the flash writing tool.

4. The method for constructing the online firmware update tool of the Shenwei platform according to claim 3, characterized in that: The update script includes a mainboard topology detection interface, which is used to perform different burning processes on single-channel, dual-channel and quad-channel machines respectively, wherein the single-channel machine only burns the storage chip flash of the first CPU in the hardware layer, the dual-channel machine burns the storage chip flash of the first two CPUs in the hardware layer, and the quad-channel machine burns the storage chip flash of the first four CPUs in the hardware layer.

5. The method for constructing the online firmware update tool of the Shenwei platform according to claim 4, characterized in that: The update script also includes a firmware specification standard interface for detecting the firmware file update location and storage format according to the magic number information or CPU model information of the Shenwei platform firmware.

6. The method for constructing the online firmware update tool of the Shenwei platform according to claim 5, characterized in that: The update script also includes a file consistency verification interface, which is used to verify whether the file is consistent with the source file based on the md5 value of the file read by the flash reading tool and the md5 value of the source file; if the file read by the flash reading tool is consistent with the source file, 0 is returned; if the file read by the flash reading tool is inconsistent with the source file, -1 is returned and a prompt message is output, and the source file is the file configured when writing to the storage chip flash.

7. The method for constructing the online firmware update tool of the Shenwei platform according to claim 6, characterized in that: The update script also includes a write operation interface with a verification function, which is used to verify whether the written file is correct when the data of the file to be written is less than 64K, including: Calling a mainboard topology detection interface, and writing a source file into a storage chip flash corresponding to the mainboard topology according to the mainboard topology; Using a flash reading tool, according to the mainboard topology structure, the contents of the covered area in the storage chip flash corresponding to the mainboard topology structure are read again and redirected to different temporary files; Call the file consistency check interface to check whether the source file is consistent with each temporary file according to the mainboard topology. If they are consistent, return 0 to perform the write operation; if they are inconsistent, return -1 and output a prompt message.

8. The method for constructing the online firmware update tool of the Shenwei platform according to claim 1, characterized in that: The update script also includes a resource recovery interface for preventing conflicts or other unknown errors in the SPI control register caused by user misoperation. When a SIGINT interrupt signal sent by the user is obtained, all running read and write processes are terminated, the occupied system resources are recovered, and a prompt message is output.

9. The method for constructing the online firmware update tool of the Shenwei platform according to claim 1, characterized in that: It also includes configuring a parallel operation tool for the Shenwei platform firmware online update tool, which is used to batch update the Shenwei platform firmware online, including performing password-free operations on the control machine and the machine to be updated, distributing the update firmware package to the machine to be updated, and executing the update in parallel.

10. The method for constructing the online firmware update tool of the Shenwei platform according to claim 9, characterized in that: The method of performing a password-free operation on a control machine and a machine to be updated, distributing an update firmware package to the machine to be updated, and executing the update in parallel includes: According to the IP range and user name of the machine to be updated, a machine IP list is generated in a loop, where each line in the machine IP list is in the format of "user name@IP address"; Use the sshpass command and the ssh-copy-id command in conjunction with the machine IP list to cyclically set up password-free login for each machine in the machine IP list; Use the pscp.pssh tool to distribute the firmware update package to each machine to be updated. Specifying the -r parameter means that the firmware update package will be distributed recursively. Use the pssh tool to perform the update operation, wherein the -h parameter is specified to use the machine IP list to perform the update operation, and the update command to be executed is filled in the double quotes of the pssh command; Use the --inline-stdout parameter to output the output results of each machine in sequence to the terminal interface of the control machine; Enter the reboot command in the double quotes of another pssh command to perform a batch reboot operation; or According to the IP range and user name of the machine to be updated, a machine IP list is generated in a loop, where each line in the machine IP list is in the format of "user name@IP address"; Use the sshpass command and the ssh-copy-id command in conjunction with the machine IP list to cyclically set up password-free login for each machine in the machine IP list; Use the parallel-scp tool to distribute the update firmware package to each machine to be updated. Specifying the -r parameter means that the update firmware package will be distributed recursively. Use the parallel-ssh tool to perform the update operation, wherein the -h parameter is specified to use the machine IP list to perform the update operation, and the update command to be executed is filled in the double quotes of the parallel-ssh command; Use the --inline-stdout parameter to output the output results of each machine in sequence to the terminal interface of the control machine; Enter the reboot command in the double quotation marks of another parallel-ssh command to perform a batch reboot operation.