CN117873515A - Firmware updating method, device and equipment - Google Patents

Firmware updating method, device and equipment Download PDF

Info

Publication number
CN117873515A
CN117873515A CN202311722949.8A CN202311722949A CN117873515A CN 117873515 A CN117873515 A CN 117873515A CN 202311722949 A CN202311722949 A CN 202311722949A CN 117873515 A CN117873515 A CN 117873515A
Authority
CN
China
Prior art keywords
updated
memory space
data
configuration information
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311722949.8A
Other languages
Chinese (zh)
Inventor
胡超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Huatai Electronics Co Ltd
Original Assignee
Suzhou Huatai Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Huatai Electronics Co Ltd filed Critical Suzhou Huatai Electronics Co Ltd
Priority to CN202311722949.8A priority Critical patent/CN117873515A/en
Publication of CN117873515A publication Critical patent/CN117873515A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a firmware updating method, device and equipment, and relates to the technical field of power electronics. The method is applied to embedded equipment, wherein the embedded equipment is composite equipment of a large-capacity memory and a virtual serial port; comprising the following steps: when the main equipment to be updated is in communication connection with the embedded equipment, responding to a first information reading instruction initiated by the main equipment to be updated based on the virtual serial port, reading updated configuration information from a file information memory space, and transmitting the updated configuration information to the main equipment to be updated; responding to a second information reading instruction initiated by the main equipment to be updated based on the mass storage or the virtual serial port, reading data to be updated from the target storage memory space, and transmitting the data to be updated to the main equipment to be updated; the main equipment to be updated is used for updating the data to be updated to the corresponding data area according to the updating configuration information. According to the embodiment of the application, the firmware updating difficulty can be reduced to a certain extent, and meanwhile, the firmware updating cost can be reduced.

Description

Firmware updating method, device and equipment
Technical Field
The application belongs to the technical field of power electronics, and particularly relates to a firmware updating method, device and equipment.
Background
In general, firmware update (Download Firmware Updata Class, DFU for short) is mainly performed by the current embedded device through two ways, and common firmware update modes include update through a serial port, update through a network port, update through a USB interface, and the like. The firmware updating means of the existing embedded device often needs to introduce additional equipment or be implemented based on a specific communication protocol, and meanwhile, the problems of complex code and flow and the like are easy to exist, so that the difficulty and cost of firmware updating are increased.
Disclosure of Invention
The embodiment of the application provides a firmware updating method, device and equipment, which can reduce firmware updating difficulty to a certain extent and is beneficial to reducing firmware updating cost.
In a first aspect, an embodiment of the present application provides a firmware update method, which is applied to an embedded device, where the embedded device is a composite device of a mass storage and a virtual serial port; the firmware updating method comprises the following steps:
under the condition that the main equipment to be updated is in communication connection with the embedded equipment, responding to a first information reading instruction initiated by the main equipment to be updated based on the virtual serial port, reading updated configuration information from a file information memory space, and transmitting the updated configuration information to the main equipment to be updated;
Responding to a second information reading instruction initiated by the main equipment to be updated based on the mass storage or the virtual serial port, reading data to be updated from the target storage memory space, and transmitting the data to be updated to the main equipment to be updated;
the embedded device comprises a file information memory space and/or a target storage memory space, and/or is in communication connection with the target storage device comprising the file information memory space and/or the target storage memory space; the main equipment to be updated is used for updating the data to be updated to the corresponding data area according to the updating configuration information.
According to one possible implementation manner of the application, before responding to a first information reading instruction initiated by the main device to be updated based on the virtual serial port, and before responding to a second information reading instruction initiated by the main device to be updated based on the mass storage or the virtual serial port, the firmware updating method further comprises:
under the condition that the embedded equipment is in communication connection with the terminal equipment, the updating configuration information is written into the file information memory space and the data to be updated is written into the target storage memory space in response to a first data writing instruction sent by the terminal equipment based on the virtual serial port.
According to one possible implementation manner of the application, before responding to a first information reading instruction initiated by the main device to be updated based on the virtual serial port, and before responding to a second information reading instruction initiated by the main device to be updated based on the mass storage or the virtual serial port, the firmware updating method further comprises:
under the condition that the embedded equipment is in communication connection with the terminal equipment, responding to a file moving request initiated by the terminal equipment based on the mass storage, and moving the target file to a target storage memory space; the target file at least comprises data to be updated.
According to a possible embodiment of the present application, in a case where the update configuration information is not included in the object file, the firmware update method further includes:
and writing the updated configuration information into the file information memory space in response to a second data writing instruction initiated by the terminal equipment based on the virtual serial port.
According to a possible embodiment of the present application, in the case that the update configuration information is included in the target file, after the target file is moved to the target storage memory space, the firmware update method further includes:
analyzing the target file, and extracting to-be-updated data and updated configuration information;
And re-storing the data to be updated in the target storage memory space, and storing the updated configuration information in the file information memory space.
According to one possible implementation manner of the application, the embedded device further comprises a first memory space, wherein the first memory space is used for storing and running bootloader code; before analyzing the target file and extracting the data to be updated and the update configuration information, the firmware update method further comprises the following steps:
adding a high-capacity memory file system in a first memory space;
analyzing the target file, extracting to-be-updated data and updating configuration information, including:
analyzing the target file in the target storage memory space by operating the high-capacity storage file system in the first memory space, and extracting to-be-updated data and updated configuration information.
According to one possible implementation manner of the application, the embedded device further comprises a second memory space, wherein the second memory space is used for storing and running application program application code; the second memory space comprises a first functional code module for realizing a virtual serial port and a second functional code module for realizing a mass storage;
Responding to a first information reading instruction initiated by the main equipment to be updated based on the virtual serial port, reading updating configuration information from the file information memory space, and transmitting the updating configuration information to the main equipment to be updated, wherein the method comprises the following steps:
the method comprises the steps of receiving and responding to a first information reading instruction by controlling and running a first functional code module in a second memory space, reading updated configuration information from a file information memory space, and transmitting the updated configuration information to a main device to be updated;
the method for reading the data to be updated from the target storage memory space and transmitting the data to be updated to the master device to be updated comprises the following steps of:
and the first functional code module or the second functional code module in the second memory space is controlled to be operated so as to receive and respond to the second information reading instruction, read the data to be updated from the target storage memory space, and transmit the data to be updated to the main equipment to be updated.
According to one possible embodiment of the present application, the update configuration information includes at least one of an update data start address, an update data length, and a check value.
In a second aspect, an embodiment of the present application provides a firmware update apparatus, which is applied to an embedded device, where the embedded device is a composite device of a mass storage and a virtual serial port; the firmware updating apparatus includes:
the first response module is used for responding to a first information reading instruction initiated by the main equipment to be updated based on the virtual serial port under the condition that the main equipment to be updated is in communication connection with the embedded equipment, reading updated configuration information from the file information memory space, and transmitting the updated configuration information to the main equipment to be updated;
the second response module is used for responding to a second information reading instruction initiated by the main equipment to be updated based on the mass storage or the virtual serial port, reading data to be updated from the target storage memory space and transmitting the data to be updated to the main equipment to be updated;
the embedded device comprises a file information memory space and/or a target storage memory space, and/or is in communication connection with the target storage device comprising the file information memory space and/or the target storage memory space; the main equipment to be updated is used for updating the data to be updated to the corresponding data area according to the updating configuration information.
In a third aspect, an embodiment of the present application provides a firmware update apparatus, including:
a processor and a memory storing computer program instructions;
the processor, when executing the computer program instructions, implements a firmware update method as provided in any one of the embodiments of the present application.
In a fourth aspect, embodiments of the present application provide a computer storage medium having stored thereon computer program instructions that, when executed by a processor, implement a firmware update method as provided in any of the embodiments of the present application described above.
In a fifth aspect, embodiments of the present application provide a computer program product, where instructions in the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform a firmware update method as provided in any of the embodiments of the present application.
As can be seen from the foregoing description, the firmware updating method, apparatus and device according to the embodiments of the present application are applied to an embedded device, and by configuring the embedded device as a composite device of a mass storage and a virtual serial port in advance, in this way, in the case that a host device to be updated is in communication connection with the embedded device, the host device to be updated may acquire update configuration information in the file information memory space based on the virtual serial port, and the host device to be updated may flexibly acquire data to be updated stored in the target storage memory space based on the mass storage or the virtual serial port, so as to update the data to be updated into a corresponding data area in the host device to be updated according to the acquired update configuration information. In summary, the firmware updating method, device and equipment provided by the embodiment of the application update the firmware by the composite equipment comprising the mass storage and the virtual serial port, and the main equipment to be updated can flexibly acquire the data to be updated and the update configuration file without introducing additional equipment or other communication protocols in the firmware updating process, so that the firmware updating difficulty can be reduced to a certain extent, the overall firmware updating efficiency is improved, and the cost consumed by firmware updating is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described, and it is possible for a person skilled in the art to obtain other drawings according to these drawings without inventive effort.
FIG. 1 is a flowchart of a firmware update method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a system working frame between a host device to be updated and an embedded device according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a firmware update apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a firmware update apparatus according to an embodiment of the present application.
Detailed Description
Features and exemplary embodiments of various aspects of the present application are described in detail below to make the objects, technical solutions and advantages of the present application more apparent, and to further describe the present application in conjunction with the accompanying drawings and the detailed embodiments. It should be understood that the specific embodiments described herein are intended to be illustrative of the application and are not intended to be limiting. It will be apparent to one skilled in the art that the present application may be practiced without some of these specific details. The following description of the embodiments is merely intended to provide a better understanding of the present application by showing examples of the present application.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
As described in the background section, in the communication between the design to be tested and the verification platform including the third party verification component, the design to be tested can be reset at any time of operation, but is particularly applied to the scene of the verification platform including the third party component, since the state of the third party component cannot be timely determined when the design to be tested is reset, and the internal operation structure of the third party component cannot be estimated generally.
Therefore, if the reset operation of the design to be tested is selected in the process of data transmission of the third party component, the phenomena of data contrast disorder and the like of the verification platform may occur, so that the verification efficiency is reduced.
In view of the foregoing, the embodiments of the present application provide a firmware updating method, apparatus, device, storage medium and program product, so as to solve the problems in the related art. It should be noted that the examples provided herein are not intended to limit the scope of the disclosure.
The firmware updating method provided by the embodiment of the present application is first described below.
Fig. 1 is a flow chart illustrating a firmware update method according to an embodiment of the present application, where the firmware update method is applied to an embedded device. The embedded device may be a composite device that is previously configured by encoding or the like into a mass memory (Mass Storage Class, MSC, also known as mass storage class) and a Virtual serial Port (VCP). The embedded device prototype may be a universal serial bus (Universal Serial Bus, USB) device in particular.
As shown in fig. 1 in detail below, the firmware update method includes the steps of:
S110, under the condition that the main equipment to be updated is in communication connection with the embedded equipment, responding to a first information reading instruction initiated by the main equipment to be updated based on the virtual serial port, reading updated configuration information from a file information memory space, and transmitting the updated configuration information to the main equipment to be updated;
and S120, responding to a second information reading instruction initiated by the main equipment to be updated based on the mass storage or the virtual serial port, reading the data to be updated from the target storage memory space, and transmitting the data to be updated to the main equipment to be updated.
The embedded device comprises a file information memory space and/or a target storage memory space, and/or is in communication connection with the target storage device comprising the file information memory space and/or the target storage memory space; the main equipment to be updated is used for updating the data to be updated to the corresponding data area according to the updating configuration information.
As can be seen from the foregoing description, the firmware updating method of the embodiments of the present application is applied to an embedded device, and by configuring the embedded device as a composite device of a mass storage and a virtual serial port in advance, in this way, when a host device to be updated is in communication connection with the embedded device, the host device to be updated may acquire update configuration information in the file information memory space based on the virtual serial port, and the host device to be updated may flexibly acquire data to be updated stored in the target storage memory space based on the mass storage or the virtual serial port, so as to update the data to be updated into a corresponding data area in the host device to be updated according to the acquired update configuration information.
In summary, according to the firmware updating method provided by the embodiment of the application, the firmware updating is performed based on the composite device including the mass storage and the virtual serial port, and the main device to be updated can flexibly acquire the data to be updated and the update configuration file without introducing additional device devices or other communication protocols in the firmware updating process, so that the firmware updating difficulty can be reduced to a certain extent, the overall firmware updating efficiency is improved, and meanwhile, the cost consumed by firmware updating is reduced.
The specific implementation of the steps 110 to 120 will be described in detail below.
In S110, the host device to be updated may be an electronic device such as a mobile terminal, a personal computer (personal computer), or a PC, which is not strictly limited in the embodiment of the present application. In the actual firmware upgrade scenario, the host device to be updated and the embedded device may be connected in communication through a USB data bus or through a slot.
In the specific implementation, under the condition that the main equipment to be updated is in communication connection with the embedded equipment, the main equipment to be updated responds to a first information reading instruction initiated by the main equipment to be updated based on the virtual serial port, reads the update configuration information from the file information memory space, and transmits the update configuration information to the main equipment to be updated. When the update configuration information is transmitted to the main device to be updated, the transmission of the update configuration information from the file information memory space to the main device to be updated can be realized based on the virtual serial port.
According to some embodiments of the present application, more specifically, in connection with an actual firmware upgrade update scenario, at least one of an update data start address, an update data length, and a verification value may be included in the update configuration information.
In S120, in a specific implementation, under a condition that the to-be-updated master device is in communication connection with the embedded device, the embedded device responds to a second information reading instruction initiated by the to-be-updated master device based on the mass storage or the virtual serial port, reads to-be-updated data from the target storage memory space, and transmits the to-be-updated data to the to-be-updated master device. The data to be updated may be, for example, a bin file.
The embedded device comprises a file information memory space and/or a target storage memory space, and/or is in communication connection with the target storage device comprising the file information memory space and/or the target storage memory space.
For example, the embedded device may use a portion of its own memory space as the file information memory space. And, in view of the fact that the data to be updated is generally large in data size, in order to facilitate effective capacity expansion, the above target storage memory space may be a memory space in a target storage device, where the target storage device may be, for example, an SPI (serial peripheral interface ) Flash (Flash memory), specifically may be, for example, an SPI norflash, etc., and the present example is not limited strictly herein.
After the main device to be updated obtains the update configuration information and the data to be updated through the first information reading instruction and the second information reading instruction, the main device to be updated can be used for updating the data to be updated to the corresponding data area according to the update configuration information.
For example, in the case that the update configuration information includes the update data start address, the update data length, and the check value, the master device to be updated may be the content of the update data start address and the length of the update data length by erasing the memory start address, and then write the data to be updated into the erased data area, so that the data update is efficiently implemented.
It should be noted that, in the embodiment of the present application, the step 110 and the step 120 are not strictly executed in sequence, and the step 110 may precede or be later than the step 120, or the step 110 and the step 120 are executed simultaneously, which may be flexibly set according to the actual configuration,
According to some embodiments of the present application, optionally, in order to more reasonably implement writing of relevant update configuration information and update configuration information in the embedded device, before responding to a first information reading instruction initiated by the to-be-updated master device based on the virtual serial port, and before responding to a second information reading instruction initiated by the to-be-updated master device based on the mass storage or the virtual serial port, the firmware updating method may further include:
Under the condition that the embedded equipment is in communication connection with the terminal equipment, the updating configuration information is written into the file information memory space and the data to be updated is written into the target storage memory space in response to a first data writing instruction sent by the terminal equipment based on the virtual serial port.
In particular, for example, the embedded device may be inserted into a USB interface of the terminal device, for example, a PC, in advance, so as to implement a communication connection between the embedded device and the terminal device.
In this case, the virtual serial port tool (for example, secure crt) may be invoked in the terminal device, and the corresponding developer may send the first data writing instruction to the embedded device based on the virtual serial port tool, so that the read, write, erase, etc. on the file information memory space may be completed, the update configuration information may be written into the file information memory space, and the data to be updated may be written into the target storage memory space.
According to some embodiments of the present application, optionally, for reasons similar to the foregoing embodiments, in order to more reasonably implement writing of relevant update configuration information and update configuration information in the embedded device, in addition to the foregoing virtual serial port implementation data pre-writing, data acquisition may also be implemented by using an MSC configured by the embedded device. Specifically, before the first information reading instruction initiated by the to-be-updated main device based on the virtual serial port is responded, and before the second information reading instruction initiated by the to-be-updated main device based on the mass storage or the virtual serial port is responded, the firmware updating method may further include:
Under the condition that the embedded equipment is in communication connection with the terminal equipment, responding to a file moving request initiated by the terminal equipment based on the mass storage, and moving the target file to a target storage memory space; the target file may include at least data to be updated.
In this embodiment, the embedded device is inserted into the USB interface of the terminal device PC, so as to implement communication connection between the embedded device and the terminal device. Because the embedded device is a composite device of the mass memory MSC and the virtual serial port VCP, the terminal device PC can identify one MSC device (which can be regarded as a U disk) after being connected with the embedded device, so that the target file to be stored in the embedded device can be moved to the MSC device, and the MSC device uses the target memory space to store the target file. The target file may specifically be, for example, a bin file or a hex file, which is not strictly limited in this embodiment, and the target file at least includes the data to be updated.
According to some embodiments of the present application, optionally, considering the requirement of the subsequent master device to be updated for the data to be updated and the update configuration data, and combining the MSC and VCP composite features of the embedded device, where the update configuration information is not included in the above object file, the firmware update method may further include:
And writing the updated configuration information into the file information memory space in response to a second data writing instruction initiated by the terminal equipment based on the virtual serial port.
In particular, when the target file does not include the update configuration information, the corresponding update configuration information needs to be additionally stored in the embedded device. Based on this, in the case that the embedded device is communicatively connected to the terminal device, the terminal device may initiate a second data writing instruction to the embedded device based on the virtual serial port, so that the corresponding update configuration information is written into the file information memory space through the second data writing instruction.
According to some embodiments of the present application, optionally, considering that, in order to facilitate a subsequent implementation of firmware update of the to-be-updated master device, the to-be-updated master device may reasonably and efficiently obtain to-be-updated data and update configuration information, in the case that the above-mentioned target file may include update configuration information, after moving the above-mentioned target file to the target storage memory space, the firmware update method may further include:
analyzing the target file, and extracting to-be-updated data and updated configuration information;
And re-storing the data to be updated in the target storage memory space, and storing the updated configuration information in the file information memory space.
Specifically, for example, if the target file is a hex file including both data to be updated and update configuration information, then the target file stored in the target storage memory space needs to be parsed.
In the specific analysis, the data to be updated and the update configuration information can be respectively extracted by means of field analysis, disassembly and the like. And then, re-storing the data to be updated into the target storage memory space, and storing the updated configuration information into the file information memory space.
In addition, in consideration of reasonable utilization of the target storage memory space, the data to be updated is re-stored in the target storage memory space, the updated configuration information is stored in the file information memory space, and the target file in the target storage memory space can be deleted.
According to some embodiments of the present application, more specifically, in order to more reasonably achieve parsing of the target file, the embedded device may further include a first memory space, where the first memory space is used to store and run bootloader code; before analyzing the target file and extracting the data to be updated and the update configuration information, the firmware update method may further include:
Adding a high-capacity memory file system in a first memory space;
analyzing the target file, and extracting to-be-updated data and update configuration information may include:
analyzing the target file in the target storage memory space by operating the high-capacity storage file system in the first memory space, and extracting to-be-updated data and updated configuration information.
In a specific implementation, in combination with an embedded scenario, a portion of the memory space may be divided into the first memory space in the embedded device, where the first memory space may be used to store and run bootloader code, which is also referred to as bootloader code space. In this embodiment, an MSC file system is added to a bootloader in an embedded device in advance, so as to detect and parse a target file.
Specifically, whether the target file is a compound file including data to be updated and update configuration information is detected by invoking and running the MSC file system. For example, if it is detected that the target file is in the hex file format, it is confirmed that the target file needs to be further parsed. When the specific target file is analyzed, the target file in the target storage memory space can be analyzed by calling and running the corresponding function of the MSC file system, so that the data to be updated and the update configuration information are extracted.
According to some embodiments of the present application, in particular, in combination with the embedded scenario, the composite compatibility of the embedded device with the MSC and the VCP is more reasonably achieved, where the embedded device may further include a second memory space, where the second memory space is used to store and run application code. The second memory space may include a first function code module for implementing a virtual serial port, and a second function code module for implementing a mass storage.
The above-mentioned responding to the first information reading instruction initiated by the to-be-updated master device based on the virtual serial port reads the update configuration information from the file information memory space, and transmits the update configuration information to the to-be-updated master device, which may include:
the method comprises the steps of receiving and responding to a first information reading instruction by controlling and running a first functional code module in a second memory space, reading updated configuration information from a file information memory space, and transmitting the updated configuration information to a main device to be updated;
the above-mentioned responding to the second information reading instruction initiated by the main device to be updated based on the mass storage or the virtual serial port reads the data to be updated from the target storage memory space, and transmits the data to be updated to the main device to be updated, may include:
And the first functional code module or the second functional code module in the second memory space is controlled to be operated so as to receive and respond to the second information reading instruction, read the data to be updated from the target storage memory space, and transmit the data to be updated to the main equipment to be updated.
In order to facilitate a more intuitive understanding of the firmware updating method provided in the above embodiment, the firmware updating method is described in the following in an embodiment of a specific scenario. Referring to fig. 2, fig. 2 is a schematic diagram of a system working frame between a host device to be updated and an embedded device according to an embodiment of the present application.
As shown in fig. 2, the application scenario of the present scenario embodiment may be: the embedded device to be updated (main device to be updated) is in communication connection with the embedded device through a USB data bus so as to update and upgrade the firmware of the embedded device to be updated, wherein the embedded device to be updated can be a USB device, and the embedded device to be updated can be an electronic device such as a PC (personal computer), a tablet and the like.
In this embodiment of the present scenario, before firmware update is performed on the embedded device to be updated, related preparation work needs to be performed, where the preparation work is specifically as follows:
1) The memory in the embedded device is divided into three types of spaces, namely a bootloader code space, an application code space and a file information memory space.
Specifically, the bootloader code space corresponds to the first memory space in the foregoing embodiment, an MSC file system is added in the bootloader, the application code space corresponds to the second memory space in the foregoing embodiment, and the second memory space may include a first function code module for implementing a virtual serial port and a second function code module for implementing a mass memory, so as to facilitate composite compatibility of the embedded device for MSC and VCP. The embedded device is externally connected with a target storage device, the target storage device specifically comprises SPI Nor Flash, and the target storage device comprises the target storage memory space.
2) This embedded device is reset to MSC and VCP. MSC memory can use the goal memory space in SPI Nor Flash;
3) The developer inserts the embedded device into the USB interface of the terminal device PC so as to write the data to be updated and the update configuration information into the embedded device, and the specific writing method is as follows:
method 1: the terminal device PC invokes a virtual serial port tool (e.g., a secure crt) to open, and the developer sends the first data writing instruction to the embedded device based on the virtual serial port tool, so as to complete the operations of reading, writing, erasing, etc. on the file information memory space, write the update configuration information into the file information memory space, and write the data to be updated into the target storage memory space.
Method 2: after the terminal equipment PC is connected with the embedded equipment, the embedded equipment is a composite equipment of a large-capacity memory MSC and a virtual serial port VCP, so that the PC can simultaneously identify the embedded equipment as one MSC equipment (can be regarded as a U disk), a developer can directly move a target file to be stored in the embedded equipment into the MSC equipment through operations such as simple copying and pasting, and the MSC equipment uses the target storage memory space in the SPI Nor Flash to store the target file.
And under the condition that the target file does not comprise the update configuration information, the terminal equipment can continuously initiate a second data writing instruction to the embedded equipment based on the virtual serial port, so that the corresponding update configuration information is written into the file information memory space through the second data writing instruction.
In the case that the update configuration information may be included in the target file, the embedded device may be configured to detect and parse the target file by adding an MSC file system to a bootloader in the embedded device in advance. It is illustratively detected whether the target file is a compound file comprising data to be updated and update configuration information by invoking and running the MSC file system. For example, if it is detected that the target file is in the hex file format, it is confirmed that the target file needs to be further parsed. When the specific target file is analyzed, the target file in the target storage memory space can be analyzed by calling and running the corresponding function of the MSC file system, so that the data to be updated and the update configuration information are extracted. Thus, the data to be updated is restored in the target storage memory space, and the updated configuration information is stored in the file information memory space.
After the data to be updated is written into the target storage memory space through the preparation operation and the update configuration information is stored into the file information memory space, the firmware update flow of the embedded device to be updated is specifically as follows:
1) And the embedded device to be updated (the main device to be updated) is in communication connection with the embedded device, and the main device to be updated can identify the embedded device through bootloader codes.
2) Under the condition that the embedded device is identified as the composite device compatible with the MSC and the VCP, the embedded device to be updated can capture the update configuration information in the file information memory space of the composite device through the VCP, and the update configuration information can comprise an update data starting address, an update data length and a check value.
3) The embedded device to be updated can obtain the data to be updated in the target memory space by reading through MSC or VCP, and the data to be updated can be a bin file.
4) The embedded device to be updated erases the content of the initial address of the data with the length being the length of the updated data, and writes the data to be updated into the erased data area to realize the firmware update.
In summary, according to the firmware updating scheme provided by the embodiment, the firmware is updated based on the composite device including the mass memory and the virtual serial port, and the main device to be updated can flexibly acquire the data to be updated and the update configuration file without introducing additional device devices or other communication protocols in the firmware updating process, so that the firmware updating difficulty can be reduced to a certain extent, the overall firmware updating efficiency is improved, and the cost consumed by firmware updating is reduced.
Based on the firmware updating method provided by the above embodiment, the present application further provides a firmware updating apparatus corresponding to the firmware updating method, and the firmware updating apparatus is described in detail below through fig. 3.
Fig. 3 is a schematic structural diagram of a firmware updating apparatus according to an embodiment of the present application, where the firmware updating apparatus is applied to an embedded device, and the embedded device is a composite device of a mass storage and a virtual serial port; the firmware updating apparatus 300 shown in fig. 3 includes:
the first response module 310 is configured to, in case that the to-be-updated master device is communicatively connected to the embedded device, respond to a first information reading instruction initiated by the to-be-updated master device based on the virtual serial port, read update configuration information from the file information memory space, and transmit the update configuration information to the to-be-updated master device;
the second response module 320 is configured to respond to a second information reading instruction initiated by the to-be-updated master device based on the mass storage or the virtual serial port, read to-be-updated data from the target storage memory space, and transmit the to-be-updated data to the to-be-updated master device;
the embedded device comprises a file information memory space and/or a target storage memory space, and/or is in communication connection with the target storage device comprising the file information memory space and/or the target storage memory space; the main equipment to be updated is used for updating the data to be updated to the corresponding data area according to the updating configuration information.
As can be seen from the foregoing description, the firmware updating apparatus of the embodiments of the present application is applied to an embedded device, and by configuring the embedded device as a composite device of a mass storage and a virtual serial port in advance, in this way, in the case that a host device to be updated is in communication connection with the embedded device, the host device to be updated may acquire update configuration information in the file information memory space based on the virtual serial port, and the host device to be updated may flexibly acquire data to be updated stored in the target storage memory space based on the mass storage or the virtual serial port, so as to update the data to be updated into a corresponding data area in the host device to be updated according to the acquired update configuration information.
In summary, the firmware updating apparatus provided in the embodiments of the present application performs firmware updating based on a composite device including a mass storage and a virtual serial port, and can flexibly achieve the acquisition of data to be updated and an update configuration file by a main device to be updated without introducing additional device devices or other communication protocols in the firmware updating process, so that the firmware updating difficulty can be reduced to a certain extent, which is beneficial to improving the overall firmware updating efficiency, and is beneficial to reducing the cost consumed by firmware updating.
According to some embodiments of the present application, optionally, before the first information reading instruction initiated by the to-be-updated master device based on the virtual serial port and before the second information reading instruction initiated by the to-be-updated master device based on the mass storage device or the virtual serial port, the firmware updating apparatus may further include:
the third response module may be configured to, when the embedded device is in communication connection with the terminal device, respond to a first data writing instruction sent by the terminal device based on the virtual serial port, write the update configuration information into the file information memory space, and write the data to be updated into the target storage memory space.
According to some embodiments of the present application, optionally, before responding to a first information reading instruction initiated by the to-be-updated master device based on the virtual serial port, and before responding to a second information reading instruction initiated by the to-be-updated master device based on the mass storage or the virtual serial port, the firmware updating apparatus may further include:
the fourth response module can be used for responding to a file moving request initiated by the terminal equipment based on the mass storage under the condition that the embedded equipment is in communication connection with the terminal equipment, and moving the target file to the target storage memory space; the target file may include at least data to be updated.
According to some embodiments of the present application, optionally, in a case where the update configuration information is not included in the above-mentioned object file, the firmware updating apparatus may further include:
and the fifth response module can be used for responding to a second data writing instruction initiated by the terminal equipment based on the virtual serial port and writing the updated configuration information into the file information memory space.
According to some embodiments of the present application, optionally, in the case that the update configuration information may be included in the target file, after the target file is moved to the target storage memory space, the firmware updating apparatus may further include:
the analysis module can be used for analyzing the target file and extracting data to be updated and update configuration information;
the storage module can be used for re-storing the data to be updated into the target storage memory space and storing the update configuration information into the file information memory space.
According to some embodiments of the present application, optionally, the above embedded device may further include a first memory space, where the first memory space is used to store and run bootloader code; before analyzing the target file and extracting the data to be updated and the update configuration information, the firmware updating apparatus may further include:
The adding module can be used for adding a high-capacity memory file system in the first memory space;
the analyzing module, analyzing the target file, extracts the data to be updated and the update configuration information, which may specifically include:
analyzing the target file in the target storage memory space by operating the high-capacity storage file system in the first memory space, and extracting to-be-updated data and updated configuration information.
According to some embodiments of the present application, optionally, the embedded device may further include a second memory space, where the second memory space is used to store and run application code; the second memory space can comprise a first functional code module for realizing a virtual serial port and a second functional code module for realizing a mass storage;
the first response module, in response to a first information reading instruction initiated by the to-be-updated master device based on the virtual serial port, reads update configuration information from the file information memory space, and transmits the update configuration information to the to-be-updated master device, and may specifically include:
the method comprises the steps of receiving and responding to a first information reading instruction by controlling and running a first functional code module in a second memory space, reading updated configuration information from a file information memory space, and transmitting the updated configuration information to a main device to be updated;
The second response module, in response to a second information reading instruction initiated by the to-be-updated master device based on the mass storage or the virtual serial port, reads to-be-updated data from the target storage memory space, and transmits the to-be-updated data to the to-be-updated master device, may include:
and the first functional code module or the second functional code module in the second memory space is controlled to be operated so as to receive and respond to the second information reading instruction, read the data to be updated from the target storage memory space, and transmit the data to be updated to the main equipment to be updated.
According to some embodiments of the present application, optionally, at least one of an update data start address, an update data length, and a check value may be included in the update configuration information.
Based on the firmware updating method provided by the above embodiment of the present application, a firmware updating apparatus provided by the present application is described below. Referring to fig. 4, fig. 4 is a schematic structural diagram of a firmware update apparatus according to an embodiment of the present application.
The firmware update apparatus may comprise a processor 401 and a memory 402 in which computer program instructions are stored.
In particular, the processor 401 described above may include a Central Processing Unit (CPU), or an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or may be configured to implement one or more integrated circuits of embodiments of the present application.
Memory 402 may include mass storage for data or instructions. By way of example, and not limitation, memory 402 may comprise a Hard Disk Drive (HDD), floppy Disk Drive, flash memory, optical Disk, magneto-optical Disk, magnetic tape, or universal serial bus (Universal Serial Bus, USB) Drive, or a combination of two or more of the foregoing. Memory 402 may include removable or non-removable (or fixed) media, where appropriate. Memory 402 may be internal or external to the integrated gateway disaster recovery device, where appropriate. In a particular embodiment, the memory 402 is a non-volatile solid state memory.
The memory may include Read Only Memory (ROM), random Access Memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical, or other physical/tangible memory storage devices. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software comprising computer-executable instructions and when the software is executed (e.g., by one or more processors) it is operable to perform the operations described with reference to methods in accordance with aspects of the present disclosure.
The processor 401 implements any of the firmware update methods of the above embodiments by reading and executing computer program instructions stored in the memory 402.
In one example, the data firmware update apparatus may further include a communication interface 403 and a bus 410. As shown in fig. 4, the processor 401, the memory 402, and the communication interface 403 are connected by a bus 410 and perform communication with each other.
The communication interface 403 is mainly used to implement communication between each module, device, unit and/or apparatus in the embodiments of the present application.
Bus 410 includes hardware, software, or both, coupling components of the firmware update apparatus to each other. By way of example, and not limitation, the buses may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an infiniband interconnect, a Low Pin Count (LPC) bus, a memory bus, a micro channel architecture (MCa) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a video electronics standards association local (VLB) bus, or other suitable bus, or a combination of two or more of the above. Bus 410 may include one or more buses, where appropriate. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
The firmware updating apparatus executes the firmware updating method in the embodiment of the present application, thereby realizing the firmware updating method described in fig. 1.
In addition, in combination with the firmware updating method in the above embodiment, the embodiment of the application may be implemented by providing a computer storage medium. The computer storage medium has stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the firmware update methods of the above embodiments.
Based on the firmware updating method in the above embodiments, the embodiments of the present application provide a computer program product, where instructions in the computer program product when executed by a processor of an electronic device cause the electronic device to execute the firmware updating method as provided in any one of the embodiments of the present application.
It should be clear that the present application is not limited to the particular arrangements and processes described above and illustrated in the drawings. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present application are not limited to the specific steps described and illustrated, and those skilled in the art can make various changes, modifications, and additions, or change the order between steps, after appreciating the spirit of the present application.
The functional blocks shown in the above-described structural block diagrams may be implemented in hardware, software, firmware, or a combination thereof. When implemented in hardware, it may be, for example, an electronic circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, a plug-in, a function card, or the like. When implemented in software, the elements of the present application are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine readable medium or transmitted over transmission media or communication links by a data signal carried in a carrier wave. A "machine-readable medium" may include any medium that can store or transfer information. Examples of machine-readable media include electronic circuitry, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio Frequency (RF) links, and the like. The code segments may be downloaded via computer networks such as the internet, intranets, etc.
It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above-described steps, that is, the steps may be performed in the order mentioned in the embodiments, may be different from the order in the embodiments, or several steps may be performed simultaneously.
Aspects of the present disclosure are described above with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions/acts specified in the flowchart and/or block diagram block or blocks. Such a processor may be, but is not limited to being, a general purpose processor, a special purpose processor, an application specific processor, or a field programmable logic circuit. It will also be understood that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware which performs the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In the foregoing, only the specific embodiments of the present application are described, and it will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the systems, modules and units described above may refer to the corresponding processes in the foregoing method embodiments, which are not repeated herein. It should be understood that the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present application, which are intended to be included in the scope of the present application.

Claims (10)

1. The firmware updating method is characterized by being applied to embedded equipment, wherein the embedded equipment is a composite equipment of a mass storage and a virtual serial port; the method comprises the following steps:
under the condition that a main device to be updated is in communication connection with the embedded device, responding to a first information reading instruction initiated by the main device to be updated based on the virtual serial port, reading updating configuration information from a file information memory space, and transmitting the updating configuration information to the main device to be updated;
responding to a second information reading instruction initiated by the main equipment to be updated based on the mass storage or the virtual serial port, reading data to be updated from a target storage memory space, and transmitting the data to be updated to the main equipment to be updated;
the embedded device comprises a file information memory space and/or a target storage memory space, and/or is in communication connection with a target storage device comprising the file information memory space and/or the target storage memory space; the main equipment to be updated is used for updating the data to be updated to the corresponding data area according to the updating configuration information.
2. The method of claim 1, wherein prior to the responding to the first information read instruction initiated by the to-be-updated master device based on the virtual serial port, and prior to the responding to the second information read instruction initiated by the to-be-updated master device based on the mass storage device or the virtual serial port, the method further comprises:
and under the condition that the embedded equipment is in communication connection with the terminal equipment, the updating configuration information is written into the file information memory space and the data to be updated is written into the target storage memory space in response to a first data writing instruction sent by the terminal equipment based on the virtual serial port.
3. The method of claim 1, wherein prior to the responding to the first information read instruction initiated by the to-be-updated master device based on the virtual serial port, and prior to the responding to the second information read instruction initiated by the to-be-updated master device based on the mass storage device or the virtual serial port, the method further comprises:
under the condition that the embedded equipment is in communication connection with the terminal equipment, responding to a file moving request initiated by the terminal equipment based on the mass storage, and moving a target file to the target storage memory space; the target file at least comprises the data to be updated.
4. A method according to claim 3, wherein in case the updated configuration information is not included in the target file, the method further comprises:
and responding to a second data writing instruction initiated by the terminal equipment based on the virtual serial port, and writing the updated configuration information into the file information memory space.
5. The method of claim 3, wherein in the event that the updated configuration information is included in the target file, after the moving the target file to the target storage memory space, the method further comprises:
analyzing the target file, and extracting to-be-updated data and the updated configuration information;
and re-storing the data to be updated into the target storage memory space, and storing the update configuration information into the file information memory space.
6. The method of claim 5, wherein the embedded device further comprises a first memory space for storing and running bootloader code; before the target file is parsed and the data to be updated and the update configuration information are extracted, the method further comprises:
Adding a high-capacity memory file system in the first memory space;
the analyzing the target file, extracting the data to be updated and the update configuration information, including:
and analyzing the target file in the target storage memory space by operating the high-capacity storage file system in the first memory space, and extracting to-be-updated data and the updating configuration information.
7. The method of claim 1, wherein the embedded device further comprises a second memory space for storing and running application code; the second memory space comprises a first functional code module for realizing the virtual serial port and a second functional code module for realizing the mass storage;
the responding to the first information reading instruction initiated by the main equipment to be updated based on the virtual serial port reads the updating configuration information from the file information memory space and transmits the updating configuration information to the main equipment to be updated, and the responding to the first information reading instruction initiated by the virtual serial port comprises the following steps:
reading the updated configuration information from the file information memory space by controlling the first function code module in the second memory space to be operated so as to receive and respond to the first information reading instruction, and transmitting the updated configuration information to the main equipment to be updated;
The responding to the second information reading instruction initiated by the main equipment to be updated based on the mass storage or the virtual serial port reads data to be updated from a target storage memory space, and transmits the data to be updated to the main equipment to be updated, and the responding to the second information reading instruction initiated by the main equipment to be updated comprises the following steps:
and by controlling and running the first functional code module or the second functional code module in the second memory space, the data to be updated is read from the target storage memory space and transmitted to the main equipment to be updated, and the second information reading instruction is received and responded.
8. The method according to any one of claims 1-7, wherein the update configuration information includes at least one of an update data start address, an update data length, and a check value.
9. The firmware updating device is characterized by being applied to embedded equipment, wherein the embedded equipment is a composite equipment of a mass memory and a virtual serial port; the device comprises:
the first response module is used for responding to a first information reading instruction initiated by the main equipment to be updated based on the virtual serial port under the condition that the main equipment to be updated is in communication connection with the embedded equipment, reading updated configuration information from a file information memory space, and transmitting the updated configuration information to the main equipment to be updated;
The second response module is used for responding to a second information reading instruction initiated by the main equipment to be updated based on the mass storage or the virtual serial port, reading data to be updated from a target storage memory space, and transmitting the data to be updated to the main equipment to be updated;
the embedded device comprises a file information memory space and/or a target storage memory space, and/or is in communication connection with a target storage device comprising the file information memory space and/or the target storage memory space; the main equipment to be updated is used for updating the data to be updated to the corresponding data area according to the updating configuration information.
10. A firmware update apparatus, the apparatus comprising: a processor and a memory storing computer program instructions;
the processor, when executing the computer program instructions, implements a firmware update method as claimed in any one of claims 1-8.
CN202311722949.8A 2023-12-14 2023-12-14 Firmware updating method, device and equipment Pending CN117873515A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311722949.8A CN117873515A (en) 2023-12-14 2023-12-14 Firmware updating method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311722949.8A CN117873515A (en) 2023-12-14 2023-12-14 Firmware updating method, device and equipment

Publications (1)

Publication Number Publication Date
CN117873515A true CN117873515A (en) 2024-04-12

Family

ID=90593764

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311722949.8A Pending CN117873515A (en) 2023-12-14 2023-12-14 Firmware updating method, device and equipment

Country Status (1)

Country Link
CN (1) CN117873515A (en)

Similar Documents

Publication Publication Date Title
CN109587252A (en) Loading method, device, electronic equipment and the storage medium of operator parameter
CN108650287B (en) Upgrading method and device for terminal device in Internet of things and computer readable medium
CN109218393B (en) Push implementation method, device, equipment and computer storage medium
CN111581994B (en) Near field communication NFC communication method and device and electronic equipment
CN103455349A (en) Method and device for accessing intelligent card by application program
CN111756858A (en) Remote development processing system, method and device of embedded equipment
CN103338306B (en) A kind of backup and restoring user data method and device
CN104731626A (en) Application installation method and device
CN108647131B (en) Output system of running log
CN117873515A (en) Firmware updating method, device and equipment
US7281246B1 (en) Method for loading user interface software
CN115827543A (en) Method, system, device and medium for realizing eSIP communication based on FPGA
CN107885674B (en) Bluetooth device simulator, working method thereof and Bluetooth device operating system
CN105183673A (en) Method and apparatus for supporting hot swap of external storage device under recovery mode
CN112540729A (en) Data downloading method and device, smart card and storage medium
CN111722858A (en) Online upgrading method and terminal equipment
CN103713964A (en) Data backup and recovery method and electronic equipment
CN108037942B (en) Adaptive data recovery and update method and device for embedded equipment
CN110874233A (en) Vehicle software updating system and updating method
KR102541439B1 (en) Method and apparatus for management control of vehicle ota update
US9672390B2 (en) IC card and command processing method for IC card
CN109039392B (en) Bluetooth device
CN118034730A (en) Program upgrading method, program upgrading device, electronic equipment and readable storage medium
CN116450550A (en) Communication method and system between controller chips, electronic equipment and storage medium
CN117950729A (en) Command execution method and device of RTOS (real time operating System), electronic equipment, medium and vehicle

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination