Firmware upgrading method, electronic equipment, storage medium and computer program product

By automatically detecting the storage device and determining the transmission path, automatic firmware upgrade of electronic devices is realized, solving the problems of low upgrade efficiency and hardware dependence in the prior art, simplifying user operations and reducing costs.

CN119201176APending Publication Date: 2024-12-27BEIJING EPSOLAR TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411374447.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The firmware upgrade process of existing electronic devices is inefficient, especially devices without touch screens cannot achieve automated upgrades. The operation steps are cumbersome, the process is complicated, and rely on LCD and additional USB interfaces, which increases hardware cost and complex operations.

Method used

By detecting storage device insertion events, automatically traverse the file pool to determine the target upgrade file, determine the transmission path based on preset rules, convert and send the upgrade file to the target upgrade unit for verification and automatic firmware upgrade, reduce user operations, and support multi-chip one-time upgrade .

Benefits of technology

It realizes automatic firmware upgrade of electronic devices, simplifies user operations, improves upgrade efficiency, and reduces hardware costs. It is suitable for cost-sensitive energy storage devices, and does not rely on LCD and additional USB interfaces, and has a wider range of applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201176A_ABST
    Figure CN119201176A_ABST
Patent Text Reader

Abstract

The invention discloses a firmware upgrading method, electronic equipment, a storage medium and a computer program product, and relates to the technical field of firmware upgrading. The method comprises the steps that a first chip in the electronic equipment responds to a detected target event, traverses a file pool of the storage equipment and determines a target upgrading file, the target event at least comprises an insertion event of the storage equipment, and a transmission path between the target upgrading file and a target upgrading unit is determined based on a preset rule, and converting the target upgrading file based on a communication protocol corresponding to the target upgrading unit, and sending the converted target upgrading file to the target upgrading unit based on the transmission path, so that the target upgrading unit verifies the target upgrading file, returns a verification result, and responds to the determined verification result as a target result. And instructing the target upgrading unit to perform firmware upgrading on the target upgrading unit based on the target upgrading file. By adopting the technical scheme, the firmware upgrading efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of firmware upgrade technology, and in particular to a firmware upgrade method, an electronic device, a storage medium and a computer program product. Background Art

[0002] With the rapid development of electronic technology, the functions of electronic devices are becoming more and more abundant. For some electronic devices, there is a demand for firmware upgrade of chips in the electronic devices.

[0003] For some electronic devices, such as energy storage devices, users are required to regularly upgrade them on site. Using mobile storage devices such as USB flash drives to upgrade is a more convenient way to upgrade.

[0004] At present, in the solution of using a USB flash drive for firmware upgrade, the user needs to use input devices such as buttons or touch screens to perform upgrade-related operations, or send instructions through a host computer or an application (Application, APP), etc., so that the electronic device enters the USB flash drive upgrade mode. There are many operation steps, the process is cumbersome, and the upgrade efficiency is low. In addition, for energy storage devices without a touch screen, firmware upgrades cannot be achieved through existing upgrade methods. Summary of the invention

[0005] The present invention provides a firmware upgrade method, an electronic device, a storage medium and a computer program product, which can solve the problem of low firmware upgrade efficiency of an electronic device.

[0006] According to one aspect of the present invention, there is provided a firmware upgrade method, which is applied to a first chip in an electronic device, and the method comprises:

[0007] In response to detecting a target event, traversing a file pool of a storage device and determining a target upgrade file, wherein the target event includes at least an insertion event of the storage device;

[0008] Determine a transmission path between the target upgrade file and the target upgrade unit based on a preset rule;

[0009] Based on the communication protocol corresponding to the target upgrade unit, convert the target upgrade file, and send the converted target upgrade file to the target upgrade unit based on the transmission path, so that the target upgrade unit verifies the target upgrade file and returns a verification result;

[0010] In response to determining that the verification result is a target result, the target upgrade unit is instructed to perform a firmware upgrade on the target upgrade unit based on the target upgrade file.

[0011] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0012] at least one processor; and

[0013] a memory communicatively connected to the at least one processor; wherein,

[0014] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the firmware upgrade method described in any embodiment of the present invention.

[0015] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the firmware upgrade method described in any embodiment of the present invention when executed.

[0016] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the firmware upgrade method according to any embodiment of the present invention is implemented.

[0017] In the firmware upgrade scheme of the embodiment of the present invention, the first chip in the electronic device responds to the detection of the target event, traverses the file pool of the storage device and determines the target upgrade file, the target event at least includes the insertion event of the storage device, determines the transmission path between the target upgrade file and the target upgrade unit based on the preset rule, converts the target upgrade file based on the communication protocol corresponding to the target upgrade unit, and sends the converted target upgrade file to the target upgrade unit based on the transmission path, so that the target upgrade unit verifies the target upgrade file and returns the verification result, and in response to determining that the verification result is the target result, instructs the target upgrade unit to perform a firmware upgrade on the target upgrade unit based on the target upgrade file. By adopting the above technical scheme, after detecting the insertion event of the storage device, the target upgrade file in the storage device and the transmission path between the target upgrade file and the target upgrade unit are automatically determined, the target upgrade file is converted based on the communication protocol corresponding to the target upgrade unit and sent to the target upgrade unit for verification, and the target upgrade unit is instructed to perform an automatic firmware upgrade based on the target upgrade file, which can reduce user operations and effectively improve the efficiency of firmware upgrade.

[0018] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0020] Figure 1 is a flowchart of a firmware upgrade method provided according to an embodiment of the present invention;

[0021] Figure 2 is a flowchart of another firmware upgrade method provided according to an embodiment of the present invention;

[0022] Figure 3 It is a framework diagram for implementing a firmware upgrade solution for an energy storage device provided according to an embodiment of the present invention;

[0023] Figure 4 It is a structural schematic diagram of an electronic device for implementing the firmware upgrade method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] Figure 11 is a flowchart of a firmware upgrade method according to an embodiment of the present invention. This embodiment is applicable to the case where a chip in an electronic device is automatically upgraded by inserting a storage device. The method can be executed by a firmware upgrade device. The firmware upgrade device can be implemented in the form of hardware and / or software. The firmware upgrade device can be configured in the electronic device, specifically in the first chip of the electronic device. Figure 1 As shown, the method includes:

[0027] Step 101: In response to detecting a target event, traverse a file pool of a storage device and determine a target upgrade file, wherein the target event at least includes an insertion event of the storage device.

[0028] In the embodiment of the present invention, the specific type and function of the electronic device are not limited, for example, it can be an energy storage device, an embedded device, an industrial control device, a medical device or a transportation device, etc. The electronic device may include multiple chips, and the chip used to execute the method of the embodiment of the present invention is recorded as the first chip. The specific type of the first chip is not limited, and it can be set according to the configuration of the electronic device. The first chip can exchange data with the storage device through the communication interface. The storage device can be a mobile storage device, such as a USB flash drive or a mobile hard disk. The communication interface can be, for example, a Universal Serial Bus (USB).

[0029] Exemplarily, the target event may include an insertion event of a storage device, specifically an event of the storage device being inserted into the above communication interface, and the target event may be detected by software polling or based on a hardware interrupt mechanism. After the target event is detected, the storage device may be identified and the file system of the storage device may be mounted.

[0030] Exemplarily, in a preset folder in a storage device, an upgrade file for performing firmware upgrade on one or more preset chips in a preset chip set in an electronic device, also referred to as a firmware file, is pre-stored. The preset chip in the preset chip set may be a chip in a preset electronic device that supports upgrading using the firmware upgrade method of an embodiment of the present invention, and may include or exclude the first chip. The preset chip set may include all or part of the chips in the electronic device. Among them, the upgrade file may be a file in bin format. After the R&D personnel prepare the upgrade file, a preset folder is created in the storage device, and the upgrade file is stored in the preset folder. In this step, the preset folder can be found by traversing the file pool of the storage device, and the upgrade file in the preset folder can be determined as the target upgrade file.

[0031] Step 102: Determine a transmission path between the target upgrade file and the target upgrade unit based on a preset rule.

[0032] Exemplarily, there may be multiple preset chips in the preset chip set. After determining the target upgrade file, the preset chip to be upgraded corresponding to the target upgrade file may be determined based on preset rules, and recorded as the target upgrade unit. The transmission path between the target upgrade file and the target upgrade unit may specifically be a communication channel between the first chip and the target upgrade unit, and the communication channel may be, for example, an interface or line for data communication between the first chip and the target upgrade unit. The preset rule may be a correspondence between a pre-established file name of the upgrade file and a chip identifier of the preset chip, or a pre-established correspondence between a file name of the upgrade file and a transmission path identifier.

[0033] Step 103: convert the target upgrade file based on the communication protocol corresponding to the target upgrade unit, and send the converted target upgrade file to the target upgrade unit based on the transmission path, so that the target upgrade unit verifies the target upgrade file and returns the verification result.

[0034] Exemplarily, the communication protocols between different preset chips and the first chip may be different. After determining the target upgrade unit to be upgraded, the first chip can obtain the target upgrade file from the storage device, and convert the data of the target upgrade file into data that conforms to the communication protocol between the first chip and the target upgrade unit, and transmit the converted data to the target upgrade unit based on the aforementioned determined transmission path. The specific communication protocol is not limited and can be determined based on the specific type and function of the first chip and the target upgrade unit. During the conversion, a frame header, CRC code, and frame tail can be added to the data of the target upgrade file, and packaged into a data packet that conforms to the internal communication protocol between the first chip and the target upgrade unit to obtain the converted target upgrade file.

[0035] Exemplarily, after receiving the converted target upgrade file, the target upgrade unit can restore the target upgrade file therefrom and verify the target upgrade file. The specific verification process and verification method are not limited, such as verifying whether the firmware version is higher than the existing version, verifying whether the file can be read normally, etc. After the verification is completed, the verification result is returned to the first chip.

[0036] Step 104: In response to determining that the verification result is a target result, instruct the target upgrade unit to perform a firmware upgrade on the target upgrade unit based on the target upgrade file.

[0037] Exemplarily, after receiving the verification result returned by the target upgrade unit, the first chip determines whether the verification result is the target result. The target result is, for example, verification passed. If it is the target result, it can be determined that the target upgrade unit can currently be upgraded. Then, an upgrade instruction can be sent to the target upgrade unit to instruct the target upgrade unit to perform a firmware upgrade on the target upgrade unit based on the target upgrade file. The specific upgrade process is not limited, and the corresponding in-application programming (IAP) operation is executed to perform the firmware upgrade.

[0038] The firmware upgrade method of the embodiment of the present invention automatically determines the target upgrade file in the storage device and the transmission path between the target upgrade file and the target upgrade unit after detecting the insertion event of the storage device, converts the target upgrade file based on the communication protocol corresponding to the target upgrade unit and sends it to the target upgrade unit for verification, and instructs the target upgrade unit to perform automatic firmware upgrade based on the target upgrade file, which can reduce user operations and effectively improve the efficiency of firmware upgrade.

[0039] In some embodiments, the first chip stores a preset folder identifier of a preset folder and a preset file name of each preset upgrade file in the preset upgrade file set, and the preset folder in the storage device is used to store at least one preset upgrade file in the preset upgrade file set; wherein, traversing the file pool of the storage device and determining the target upgrade file includes: traversing the file pool of the storage device based on the preset folder identifier to locate the preset folder; determining the preset upgrade file contained in the preset folder and matching the preset file name as the target upgrade file. Thus, the target upgrade file can be determined quickly and accurately.

[0040] Exemplarily, the preset folder identifier may be the name of the preset folder. For example, if the preset folder is an Update folder, the preset folder identifier is Update, and Update is used to search for the Update folder by traversing the file pool of the storage device. The preset upgrade file set may include files for upgrading all preset chips in the preset chip set, and the first chip pre-stores the preset file name of each preset upgrade file in the preset upgrade file set. For example, if the preset chip set includes 4 preset chips, the preset upgrade file set includes 4 preset upgrade files, and the first chip stores the preset file names corresponding to the 4 preset upgrade files. In actual applications, according to actual upgrade requirements, the preset folder in the storage device may store all or part of the preset upgrade files in the preset upgrade file set. Therefore, after locating the current preset folder in the storage device, the preset upgrade file currently stored therein that matches the preset file name can be determined as the target upgrade file.

[0041] In some embodiments, the first chip also stores the preset correspondence between each preset file name and each preset chip in the preset chip set; wherein, the transmission path between the target upgrade file and the target upgrade unit is determined based on the preset rule, including: based on the preset correspondence, determining the preset chip corresponding to the preset file name of the target upgrade file as the target upgrade unit; determining the communication channel between the first chip and the target upgrade unit as the transmission path between the target upgrade file and the target upgrade unit. The advantage of such a setting is that the object to be transmitted and the transmission method of the currently found target upgrade file can be determined quickly and accurately.

[0042] Exemplarily, the upgrade file is named according to a preset file name, and the upgrade file is stored in a preset folder. There is a preset correspondence between the preset file name and each preset chip in the preset chip set, which can be a one-to-one relationship. The preset correspondence can be pre-stored in the first chip. The preset correspondence can be a correspondence between each preset chip and the storage path of the upgrade file.

[0043] For example, the preset folder is Update, and the preset chip set includes 4 chips, which are respectively recorded as chip a, chip b, chip c and chip d, and the corresponding preset file names are recorded as A.bin, B.bin, C.bin and D.bin. Taking the corresponding relationship between chip a and the corresponding preset file name as an example, the first chip can store: const char apath = '1: / Update / A.bin'.

[0044] Exemplarily, after detecting the insertion event of the storage device, the upgrade file with the preset file name is searched from the preset folder of the storage device. As in the above example, the upgrade files with the file names A.bin, B.bin, C.bin and D.bin are searched from the Update folder. If A.bin is found, chip a is determined as the target upgrade unit, and the communication channel between the first chip and chip a is determined as the transmission path between the target upgrade file and the target upgrade unit.

[0045] Optionally, based on the preset correspondence, a preset chip corresponding to the preset file name of the target upgrade file is determined as a target upgrade unit, including: based on the preset correspondence, setting the upgrade status of each preset chip in the preset chip set, wherein the upgrade status includes to be upgraded or not upgraded, and the upgrade status of the preset chip corresponding to the preset file name of the target upgrade file is set to be upgraded; and determining the preset chip with the upgrade status of to be upgraded as the target upgrade unit.

[0046] In some embodiments, the upgrade status of each preset chip in the preset chip set is set based on the preset correspondence, including: if an upgrade file with a first preset file name is found, the first preset chip corresponding to the first preset file is determined according to the preset correspondence, and the corresponding bit of the upgrade status register corresponding to the first preset chip is set to a first value, wherein the first value is used to indicate that it is to be upgraded; if the upgrade file with a second preset file name is not found, the second preset chip corresponding to the second preset file is determined according to the preset correspondence, and the corresponding bit of the upgrade status register corresponding to the second preset chip is set to a second value, wherein the second value is used to indicate that it is not to be upgraded. Wherein, the target preset chip whose upgrade status is to be upgraded is the preset chip whose corresponding bit of the upgrade status register is the first value. The advantage of such a setting is that, by using register records, the upgrade status of each preset chip can be accurately set, recorded and queried, and the positioning efficiency of the target preset chip can be improved.

[0047] Exemplarily, different preset chips correspond to different bits of the upgrade status register, and the first value may be, for example, 1, and the second value may be, for example, 0. As in the above example, if an upgrade file named A.bin is found in the Update folder, the preset chip corresponding to the upgrade file may be determined to be chip a according to the preset correspondence, and the corresponding bit of the upgrade status register corresponding to chip a is set to 1, such as UpdateFlag.BIT0=1; if an upgrade file named B.bin is not found in the Update folder, the preset chip corresponding to the file name may be determined to be chip b according to the preset correspondence, and the corresponding bit of the upgrade status register corresponding to chip b is set to 0, such as UpdateFlag.BIT1=0.

[0048] In some embodiments, the electronic device is an energy storage device (e.g., an energy storage integrated device), the first chip is an Advanced RISC Machine (ARM) chip, the preset chip set includes the first chip and the second chip, and the second chip includes at least one of a digital signal processing (DSP) chip, a DSP chip, and a battery management system (BMS) chip (specifically, a BMS LINK chip). Thus, the firmware upgrade efficiency of the energy storage device can be improved.

[0049] In the field of standard energy storage, due to the complexity of the system, users need to regularly upgrade the system on site. At present, most manufacturers use a liquid crystal display (LCD) to select upgrade files when using a USB flash drive for upgrading, or send instructions through a host computer or APP or other means to make the device enter the USB flash drive upgrade mode. This method is mostly suitable for scenarios with LCD or USB flash drive upgrade ports and external communication ports with hardware interfaces. The conventional upgrade solution has relatively many operation steps and the process is relatively cumbersome. It is necessary to select the upgrade file first, then instruct the device to enter the USB flash drive upgrade mode, and then read the firmware and complete the upgrade. In this process, due to the small human-machine interface of the energy storage integrated machine, it is inconvenient for users to operate when selecting upgrade files. In addition, the existing USB flash drive upgrade mode requires the upgrade command to be sent through a communication stick before it can be upgraded through a USB flash drive (that is, the device to be upgraded needs to be able to access the communication stick and the USB flash drive at the same time). When encountering a device with only one USB interface (that is, a device that can only access a communication stick or a USB flash drive), the system upgrade cannot be completed using a USB flash drive. By adopting the firmware upgrade solution of the embodiment of the present invention to upgrade the firmware of the energy storage device, there is no need to select the upgrade file, nor to send the upgrade command through the communication stick. By plugging in the U disk, the energy storage device system can be fully automatically upgraded. The upgrade of multiple energy storage chips can be completed at one time without any additional settings or operations by the user, which greatly facilitates the user's operation and use. In addition, in the embodiment of the present invention, the firmware can be automatically upgraded by plugging in the U disk, avoiding the process of the user selecting the upgrade file in the human-machine operation interface, greatly improving the user's usage experience and enhancing the user experience. In addition, the solution does not rely on LCD and additional USB interfaces, can reduce the hardware cost of energy storage equipment products, and has a wider range of applications, such as applicable to cost-sensitive civilian energy storage power supply equipment.

[0050] In the related art, when a USB flash drive is used for firmware upgrade, a serial peripheral interface (SPI) flash memory (FLASH) is often used for buffering, which not only increases the cost, but also adds a step of copying the upgrade file from the USB flash drive to the FLASH, such as adding complex operations such as FLASH-related storage, reading, and verification, which prolongs the upgrade time and reduces the upgrade efficiency.

[0051] In the embodiment of the present invention, a method of directly reading the upgrade file in the storage device and performing real-time upgrade can be adopted to save costs and improve upgrade efficiency.

[0052] In the case where the target preset chip to be upgraded is a preset chip other than the first chip (referred to as the second chip), a direct communication upgrade can be performed by real-time communication between the first chip and the second chip. In some embodiments, each preset chip includes a second chip, and the second chip is different from the first chip; wherein, after determining the preset chip corresponding to the preset file name of the target upgrade file as the target upgrade unit based on the preset corresponding relationship, it also includes: determining whether the target upgrade unit is the second chip; wherein determining the communication channel between the first chip and the target upgrade unit as the transmission path between the target upgrade file and the target upgrade unit includes: when the target upgrade unit is the second chip, determining the communication channel between the first chip and the target upgrade unit as the transmission path between the target upgrade file and the target upgrade unit; wherein, based on the communication protocol corresponding to the target upgrade unit, converting the target upgrade file, and sending the converted target upgrade file to the target upgrade unit based on the transmission path, includes: reading the first file data of the target upgrade file from the preset folder one by one with a first preset data amount, converting the first file data into target data based on the communication protocol corresponding to the target upgrade unit, and sending the target data to the target upgrade file based on the communication channel. . Thus, the firmware upgrade efficiency of the second chip other than the first chip can be improved.

[0053] In addition, the first chip can also be automatically upgraded using the upgrade file in the storage device. In some embodiments, each of the preset chips includes the first chip; the method further includes: when the target upgrade unit is the first chip, entering a preset operation mode, reading the second file data of the preset upgrade file corresponding to the first chip from the preset folder with a second preset data volume, and performing firmware upgrade using the second file data read one by one. In this way, the firmware upgrade efficiency of the first chip can be improved.

[0054] Figure 2 1 is a flowchart of another firmware upgrade method provided according to an embodiment of the present invention. This embodiment is optimized on the basis of the above optional embodiments, and refines the relevant steps of using the upgrade file with the corresponding preset file name in the preset folder to upgrade the firmware of the target preset chip, which can further improve the upgrade efficiency. Figure 2 As shown, the method includes:

[0055] Step 201: In response to detecting a target event, traverse a file pool of a storage device based on a preset folder identifier to locate a preset folder.

[0056] For example, Figure 3It is an implementation framework diagram of a firmware upgrade solution for an energy storage device provided according to an embodiment of the present invention. Taking the electronic device as an energy storage device and the storage device as a USB flash drive as an example, the preset chip set includes an ARM chip, a DSP chip (also called a master DSP), a slave DSP chip (also called a slave DSP) and a BMS LINK chip, wherein the ARM chip is the first chip, the DSP chip, the slave DSP chip and the BMS LINK chip are the second chips, and the second chips are respectively connected to the first chip.

[0057] Step 202: Determine the preset upgrade file that matches the preset file name and is contained in the preset folder as the target upgrade file.

[0058] Exemplarily, the preset file names corresponding to the ARM chip, DSP chip, slave DSP chip and BMS LINK chip are recorded as A.bin, B.bin, C.bin and D.bin respectively. According to whether the upgrade file of each preset file name exists, the corresponding bit of the UpdateFlag register is set. If it exists, it is set to 1, and if it does not exist, it is set to 0. For example: if A.bin exists, BIT0 of UpdateFlag is set to 1, indicating that the ARM chip is upgraded; if B.bin does not exist, BIT1 of UpdateFlag is set to 0, indicating that the DSP is not upgraded; if C.bin exists, BIT2 of UpdateFlag is set to 1, indicating an upgrade from the DSP chip; if D.bin does not exist, BIT3 of UpdateFlag is set to 0, indicating that the BMS LINK chip is not upgraded.

[0059] Step 203: Based on the preset corresponding relationship, determine the preset chip corresponding to the preset file name of the target upgrade file as the target upgrade unit.

[0060] Exemplarily, UpdateFlag.BITx may be queried, where x represents 0-3. When step 203 is performed for the first time, the preset chip corresponding to the first queried bit BITx=1 is determined as the current target upgrade unit.

[0061] It should be noted that if step 205 has been executed, indicating that the first chip has been upgraded, then after executing step 203 again to determine a new target upgrade unit, the new target upgrade unit can be determined to be the second chip, and there is no need to execute step 204 again, and step 206 can be executed directly.

[0062] Step 204 , determine whether the target upgrade unit is the first chip, if so, execute step 205 ; otherwise, execute step 206 .

[0063] Step 205 , entering a preset operation mode, reading second file data of a preset upgrade file corresponding to the first chip from a preset folder with a second preset data volume, and performing firmware upgrade using the second file data read successively, and executing step 209 .

[0064] For example, if the ARM chip currently needs to be upgraded, it can automatically switch to the BOOT operation mode, run the storage device (such as a USB flash drive) reading software in the BOOT software, and read the A.bin file in the storage device through the USB port in a loop, each time reading a second preset data amount (the specific data amount is not limited, for example, it can be 256 bytes) of data (recorded as the second file data), and the read second file data is cyclically written to the ARM firmware storage area through the ARM chip's own IAP until the A.bin file is read, thereby completing the upgrade of the ARM firmware.

[0065] Optionally, before using the read second file data to perform firmware upgrade, the second file data is verified.

[0066] Step 206: determine the communication channel between the first chip and the target upgrade unit as the transmission path between the target upgrade file and the target upgrade unit.

[0067] Step 207: read the first file data of the target upgrade file from the preset folder one by one with the first preset data volume, convert the first file data into target data based on the communication protocol corresponding to the target upgrade unit, and send the target data to the target upgrade unit based on the communication channel, so that the target upgrade unit verifies the target upgrade file and returns the verification result, and executes step 208.

[0068] The target data complies with the communication protocol between the first chip and the target second chip (target upgrade unit).

[0069] Exemplarily, if the second chip that needs to be upgraded is recorded as the target second chip, and it is assumed to be a slave DSP, the ARM chip can cyclically read the C.bin file in the storage device through the USB port, and read the first preset data amount (the specific data amount is not limited, and can be the same or different from the second preset data amount, for example, it can be 256 bytes) of data each time (recorded as the first file data), and add a frame header, a cyclic redundancy check (CRC) code, and a frame tail to the read first file data, and package it into a data packet that complies with the internal communication protocol between the ARM chip and the slave DSP chip, recorded as the target data, and send the target data to the slave DSP, and can instruct the slave DSP to execute the IAP programming action according to the target data by sending an upgrade instruction (such as cmdSlaveDsp) to the slave DSP, until the C.bin file is read and forwarded, so as to realize the firmware upgrade. Similarly, if the target second chip is a BMS LINK chip, the target data sent to the BMSLINK chip complies with the internal communication protocol between the ARM chip and the BMS LINK chip

[0070] Optionally, before converting the first file data into target data, the first file data is verified.

[0071] Optionally, the format of the read first file data is converted (such as base conversion), and the first file data is compiled or assembled in accordance with the firmware upgrade IAP programming action of the target upgrade unit to obtain intermediate data. A frame header, CRC code, and frame tail are added to the intermediate data, and the data is packaged into a data packet that complies with the internal communication protocol between the first chip and the target upgrade unit to obtain the target data. As a result, after receiving the target data, the target upgrade unit can quickly upgrade by reading the intermediate data without compiling or assembling in the target upgrade unit, thereby improving the upgrade efficiency.

[0072] Step 208: In response to determining that the verification result is the target result, instruct the target upgrade unit to perform a firmware upgrade on the target upgrade unit based on the target upgrade file.

[0073] Step 209, determine whether there are any remaining preset chips to be upgraded, if so, return to step 203; otherwise, end the process.

[0074] The firmware upgrade method provided in the embodiment of the present invention is different from the method of transferring the USB flash drive data to the external SPI FLASH and then completing the firmware upgrade of the chip through the data in the SPI FLASH. Instead, it adopts the method of programming while reading the storage device. The entire programming process does not require the user to perform additional settings and other operations, which can save hardware costs, improve communication efficiency, reduce on-site upgrade time, and improve user on-site experience.

[0075] In some embodiments, the detecting of the storage device insertion event includes: detecting the storage device insertion event during the operation of the electronic device. The advantage of such a setting is that it can avoid the problem of repeated identification and repeated upgrading of the storage device caused by automatic resetting after the chip firmware upgrade.

[0076] For example, after the firmware is upgraded, the chip will automatically reset. Since the solution of the embodiment of the present invention is automatic upgrade, it may happen that the storage device is repeatedly identified and upgraded again. In the related art, power off and restart to perform upgrade checks or send commands through LCD or APP to avoid this situation. However, this processing method is cumbersome and increases the cost of manual operation. In the embodiment of the present invention, in order to solve the problem of repeated identification of storage devices after reset, resulting in repeated upgrades, the electronic device is powered on to identify the storage device without upgrading. Only when the user inserts the storage device during the operation of the electronic device, the corresponding upgrade check and software action are performed, thereby avoiding the problem of repeated identification and repeated upgrades of the storage device caused by the user not unplugging the storage device after the upgrade is completed.

[0077] In some embodiments, after the target upgrade unit is instructed to perform a firmware upgrade on the target upgrade unit based on the target upgrade file, the method further includes: in response to the electronic device being powered off and restarted, obtaining the upgrade detection result of the target upgrade unit; if the upgrade detection result is a failure, performing an upgrade failure reminder operation; if the upgrade detection result is a success and the target event is not detected, determining that the upgrade is completed. In this way, timely feedback can be provided on the upgrade result, which is convenient for the user to understand the upgrade result in a timely manner and take corresponding measures when the upgrade fails, such as checking whether the upgrade file or the chip that failed to upgrade is abnormal and eliminating the abnormality.

[0078] For example, after the firmware is upgraded, the chip will be reset. After the power is cut off and the device is restarted, due to the use of an automatic upgrade solution, the first chip will detect the insertion again after the electronic device is powered off and restarted. The meaning is that after the restart, it will detect whether the upgrade is successful. If not, a reminder will be given, and the user can unplug and reinsert the USB flash drive, so it will be detected again. If not detected, it can be determined that the upgrade is completed.

[0079] In some embodiments, it may also include: controlling one or more light-emitting components in the electronic device to display in a preset manner, wherein different preset modes correspond to different progress in the firmware upgrade process. The advantage of such a setting is that the user can intuitively understand the progress of the firmware upgrade process through the different display modes of the light-emitting components, and it can be better applied to scenarios such as the lack of a screen or insufficient communication ports of the electronic device, for example, when a USB flash drive is plugged in, APP communication cannot be performed, and the user cannot select the corresponding upgrade file.

[0080] In the above scenario, although the firmware upgrade solution of the embodiment of the present invention can realize automatic firmware upgrade, it still cannot let the user know the corresponding upgrade status. Therefore, in order to improve the user experience, this solution also sets the status of the upgrade progress accordingly, so that the user can know the progress of the firmware upgrade and whether the upgrade process is successful or failed.

[0081] Exemplarily, the light-emitting component may be an indicator light, specifically a light-emitting diode (LED) indicator light, and existing light-emitting components in the electronic device may be reused, for example, by changing the display mode or using at least two light-emitting components in combination.

[0082] For example, assuming that there are 5 indicator lights in the electronic device, the following strategy is implemented according to the insertion of the storage device, the execution of the upgrade, and the failure, so that the user can diagnose the on-site failure and check the upgrade progress. Assume that the 5 indicator lights are marked as LED6, LED4, LED2, LED3 and LED5 from left to right.

[0083] Plug in the U disk: If the U disk exists correctly and enters the U disk upgrade state, LED6-LED2 lights will all flash at the same frequency; if the U disk is wrong, the red light will flash quickly; if the U disk does not exist, it will directly enter normal operation.

[0084] Upgrading the main DSP: During the upgrade, LED4 flashes and LED6 stays green. If an abnormality occurs, LED6 stays red. If the upgrade is successful, LED4 and LED6 flash at the same time.

[0085] Upgrading from DSP: During upgrading, LED2 flashes and LED6 stays green; if an abnormality occurs, LED6 stays red; if the upgrade is successful, LED2 and LED6 flash at the same time.

[0086] Upgrading ARM: During the upgrade, LED3 flashes and LED6 stays green. If an abnormality occurs, LED6 stays red. If the upgrade is successful, LED3 and LED6 flash at the same time.

[0087] Upgrading BMS-LINK: During the upgrade, LED5 flashes and LED6 stays green. If an abnormality occurs, LED6 stays red. If the upgrade is successful, LED5 and LED6 flash at the same time.

[0088] Waiting for upgrade: When the master DSP or slave DSP enters BOOT, LED6 flashes green for seconds; when the slave enters BOOT abnormally, LED6 flashes yellow.

[0089] By adopting the above solution, during the automatic firmware upgrade process, two LEDs are used in coordination to accurately indicate the status, thereby meeting the user's needs for viewing the upgrade progress and upgrade-related status.

[0090] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0091] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0092] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0093] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a firmware upgrade method.

[0094] In some embodiments, the firmware upgrade method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the firmware upgrade method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the firmware upgrade method in any other appropriate manner (e.g., by means of firmware).

[0095] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0096] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0097] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0098] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0099] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0100] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0101] An embodiment of the present disclosure provides a computer program product, including a computer program, which implements the firmware upgrade method provided in the above embodiment when executed by a processor.

[0102] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0103] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A firmware upgrade method, characterized in that: A first chip applied to an electronic device, the method comprising: In response to detecting a target event, traversing a file pool of a storage device and determining a target upgrade file, wherein the target event includes at least an insertion event of the storage device; Determine a transmission path between the target upgrade file and the target upgrade unit based on a preset rule; Based on the communication protocol corresponding to the target upgrade unit, convert the target upgrade file, and send the converted target upgrade file to the target upgrade unit based on the transmission path, so that the target upgrade unit verifies the target upgrade file and returns a verification result; In response to determining that the verification result is a target result, the target upgrade unit is instructed to perform a firmware upgrade on the target upgrade unit based on the target upgrade file.

2. The method according to claim 1, characterized in that The first chip stores a preset folder identifier of a preset folder and a preset file name of each preset upgrade file in the preset upgrade file set, and the preset folder in the storage device is used to store at least one preset upgrade file in the preset upgrade file set; The step of traversing the file pool of the storage device and determining the target upgrade file includes: Traversing a file pool of a storage device based on the preset folder identifier to locate the preset folder; The preset upgrade file contained in the preset folder and matching the preset file name is determined as the target upgrade file.

3. The method according to claim 2, characterized in that The first chip also stores a preset correspondence between each of the preset file names and each of the preset chips in the preset chip set; Wherein, determining the transmission path between the target upgrade file and the target upgrade unit based on a preset rule includes: Based on the preset corresponding relationship, determining a preset chip corresponding to the preset file name of the target upgrade file as a target upgrade unit; The communication channel between the first chip and the target upgrade unit is determined as a transmission path between the target upgrade file and the target upgrade unit.

4. The method according to claim 3, characterized in that Each of the preset chips includes a second chip, and the second chip is different from the first chip; Wherein, after determining the preset chip corresponding to the preset file name of the target upgrade file as the target upgrade unit based on the preset corresponding relationship, the method further includes: Determining whether the target upgrade unit is the second chip; The step of determining the communication channel between the first chip and the target upgrade unit as the transmission path between the target upgrade file and the target upgrade unit includes: When the target upgrade unit is the second chip, the communication channel between the first chip and the target upgrade unit is determined as the transmission path between the target upgrade file and the target upgrade unit; The method of converting the target upgrade file based on the communication protocol corresponding to the target upgrade unit and sending the converted target upgrade file to the target upgrade unit based on the transmission path includes: The first file data of the target upgrade file is read one by one from the preset folder in a first preset data amount, the first file data is converted into target data based on the communication protocol corresponding to the target upgrade unit, and the target data is sent to the target upgrade unit based on the communication channel.

5. The method according to claim 4, characterized in that The preset chips include the first chip; The method further comprises: When the target upgrade unit is the first chip, a preset operation mode is entered, second file data of the preset upgrade file corresponding to the first chip is read from the preset folder in sequence with a second preset data amount, and firmware upgrade is performed using the second file data read in sequence.

6. The method according to claim 1, characterized in that The detecting of the insertion event of the preset mobile storage device comprises: During the operation of the electronic device, an insertion event of a preset mobile storage device is detected.

7. The method according to claim 1, characterized in that After instructing the target upgrade unit to perform firmware upgrade on the target upgrade unit based on the target upgrade file, the method further includes: In response to the electronic device being powered off and restarted, acquiring an upgrade detection result of the target upgrade unit; If the upgrade detection result is failure, an upgrade failure reminder operation is performed; If the upgrade detection result is successful and the target event is not detected, it is determined that the upgrade is completed.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the firmware upgrade method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the firmware upgrade method according to any one of claims 1 to 7 when executed.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the firmware upgrade method according to any one of claims 1 to 7.