Firmware flashing method and device of equipment, electronic device and medium
By merging the application and the basic upgrade program to the same document to be written, and the test of the target equipment model and the target brush address, the problem of cumbersome and easy to make the traditional firmware upgrade, achieve efficient, accurate and accurate accurate and accurate The firmware upgrade.
Patent Information
- Application Number
- CN202411315632.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-24
AI Technical Summary
In traditional firmware upgrades, since the application and basic upgrade programs need to be upgraded separately, firmware maintenance is cumbersome, time-consuming and error-prone, affecting the normal operation of the product.
Merge the application program and the basic upgrade program into the program to be flashed in the same file to be flashed, and ensure the accuracy and efficiency of flashing by verifying the target device model and target flashing address of the file to be flashed.
It reduces the number of flashing projects, improves the efficiency and accuracy of firmware flashing, ensures the efficiency and accuracy of firmware upgrades, and avoids any impact on the normal operation of the product.
Smart Images

Figure CN119356703A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of firmware upgrade, and in particular to a method, device, electronic device and medium for flashing firmware of a device. Background Art
[0002] As products are constantly updated and iterated, for product maintenance and customer needs, firmware upgrade solutions must be retained during the product life cycle to ensure that the programs within the product can be updated and upgraded.
[0003] However, in traditional firmware upgrades, the firmware content that needs to be upgraded is divided into two independent upgrade parts: the application program and the underlying basic upgrade program. These two upgrade parts are implemented by two independent projects. The two projects cannot be carried out at the same time and must be implemented one by one. Multiple projects make firmware maintenance cumbersome, which is not only time-consuming, but also prone to operational errors that lead to upgrade failures and affect the normal operation of the product.
[0004] Therefore, how to provide a solution to the above technical problems is a problem that those skilled in the art need to solve. Summary of the invention
[0005] In view of this, the embodiments of the present application provide a method, apparatus, electronic device and medium for flashing firmware of a device to solve the problem in the prior art that multiple projects lead to cumbersome, time-consuming and error-prone firmware upgrades.
[0006] According to a first aspect of an embodiment of the present application, a method for flashing firmware of a device is provided, which is applied to a host computer and includes:
[0007] Obtain the file to be flashed, where the program to be flashed in the file to be flashed includes an application program and a basic upgrade program;
[0008] Determine the corresponding target device model and target flashing address from the parameter content of the file to be flashed;
[0009] Verify whether the program to be flashed conforms to the target device model, and verify whether the target flashing address is valid in the specified storage area of the target device model;
[0010] When the program to be flashed conforms to the target device model and the target flashing address is valid in the designated storage area of the target device model, the program to be flashed is flashed to the designated storage area of the target device based on the target flashing address through the target device.
[0011] A second aspect of an embodiment of the present application provides a device firmware flashing method, which is applied to a target device and includes:
[0012] Receive the files to be flashed sent by the host computer, where the programs to be flashed in the files to be flashed include application programs and basic upgrade programs;
[0013] Determine the corresponding target device model and target flashing address from the parameter content of the file to be flashed;
[0014] Verify whether the target device model is consistent with the target device, and verify whether the target flash address is valid in the corresponding designated storage area in the target device;
[0015] When the target device model is consistent with the target device and the target flashing address is valid in the designated storage area, the program to be flashed is flashed to the corresponding designated storage area based on the target flashing address.
[0016] A third aspect of an embodiment of the present application provides a device for flashing firmware of a device, including:
[0017] An acquisition module is used to acquire files to be flashed, and the programs to be flashed in the files to be flashed include application programs and basic upgrade programs;
[0018] A determination module, used to determine the corresponding target device model and target flashing address from the parameter content of the file to be flashed;
[0019] A verification module is used to verify whether the program to be flashed conforms to the target device model and whether the target flashing address is valid in a designated storage area that conforms to the target device model;
[0020] The action module is used to flash the program to be flashed to the designated storage area of the target device based on the target flashing address through the target device when the program to be flashed conforms to the target device model and the target flashing address is valid in the designated storage area conforming to the target device model.
[0021] According to a fourth aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0022] According to a fifth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0023] Compared with the prior art, the embodiments of the present application have at least the following beneficial effects: the embodiments of the present application reduce the number of flashing projects and improve the efficiency of firmware flashing by merging the application program and the basic upgrade program into the same program to be flashed file, and at the same time improve the accuracy of the file to be flashed by verifying the target device model and target flashing address of the file to be flashed, avoiding errors when the program to be flashed is flashed to the designated storage area of the target device. The present application ensures the efficiency and accuracy of product firmware upgrades and ensures that firmware upgrades will not affect the normal operation of the product. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0025] Figure 1 It is a schematic diagram of an application scenario of an embodiment of the present application;
[0026] Figure 2 It is a flowchart of a firmware flashing method for a device provided in an embodiment of the present application;
[0027] Figure 3 It is a flowchart of a firmware flashing method for another device provided in an embodiment of the present application;
[0028] Figure 4 It is a structural schematic diagram of a target device partition provided in an embodiment of the present application;
[0029] Figure 5 It is a structural diagram of a firmware flashing device for a device provided in an embodiment of the present application;
[0030] Figure 6 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0032] The following will describe in detail a firmware flashing method, device, electronic device, and medium for a device according to an embodiment of the present application in conjunction with the accompanying drawings.
[0033] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a server 104 and a network 105.
[0034] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be hardware or software. When the first terminal device 101, the second terminal device 102, and the third terminal device 103 are hardware, they can be various electronic devices with display screens and support communication with the server 104, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers; when the first terminal device 101, the second terminal device 102, and the third terminal device 103 are software, they can be installed in the above electronic devices. The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be implemented as multiple software or software modules, or as a single software or software module, which is not limited in the embodiment of the present application. Further, various applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.
[0035] The server 104 may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with the server, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. The server 104 may be a single server, or a server cluster composed of several servers, or a cloud computing service center, which is not limited in the present embodiment of the application.
[0036] It should be noted that the server 104 can be hardware or software. When the server 104 is hardware, it can be various electronic devices that provide various services for the first terminal device 101, the second terminal device 102, and the third terminal device 103. When the server 104 is software, it can be multiple software or software modules that provide various services for the first terminal device 101, the second terminal device 102, and the third terminal device 103, or it can be a single software or software module that provides various services for the first terminal device 101, the second terminal device 102, and the third terminal device 103, and the embodiment of the present application does not limit this.
[0037] The network 105 can be a wired network connected by coaxial cable, twisted pair and optical fiber, or it can be a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present application.
[0038] It should be noted that the specific types, quantities and combinations of the first terminal device 101, the second terminal device 102, the third terminal device 103, the server 104 and the network 105 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present application do not limit this.
[0039] Figure 2 It is a flowchart of a firmware flashing method for a device provided in an embodiment of the present application. Figure 2 The firmware flashing method can be executed by the host computer, which can be Figure 1 The first terminal device, the second terminal device, the third terminal device or the server is implemented. Figure 2 As shown, the firmware flashing method includes:
[0040] S201: Acquire a file to be flashed, where the program to be flashed in the file to be flashed includes an application program and a basic upgrade program;
[0041] S202: Determine the corresponding target device model and target flashing address from the parameter content of the file to be flashed;
[0042] S203: Verify whether the program to be flashed complies with the target device model, and verify whether the target flashing address is valid in the designated storage area of the target device model;
[0043] S204: When the program to be flashed conforms to the target device model and the target flashing address is valid in the designated storage area of the target device model, the program to be flashed is flashed to the designated storage area of the target device through the target device based on the target flashing address.
[0044] It can be understood that in this embodiment, the host computer is used to flash the firmware of the device, and the object of the firmware flashing is the target device. The host computer is connected to the target device, and after passing steps S201-S203, the program to be flashed is flashed to the connected target device; a designated storage area for firmware flashing is provided in the target device, and the target device, as the object of firmware flashing, finally achieves the purpose of flashing the program to be flashed to the designated storage area through communication with the host computer.
[0045] Among them, both the host computer and the target device can be Figure 1The target device is implemented by a first terminal device, a second terminal device, a third terminal device or a server. It should be noted that the target device is hardware including a memory and a processor, such as a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0046] It can be understood that the file to be flashed in this embodiment includes a program to be flashed and parameter content, wherein the program to be flashed refers to a program to be flashed to a corresponding target device.
[0047] The program to be flashed includes an application and a basic upgrade program, wherein the basic upgrade program is a relatively basic upgrade program that provides support for the firmware flashing of the target device and guides the firmware update, also known as BootLoader, including a communication program that supports the communication function between the target device and the host computer, a flashing program that supports the target device to execute the flashing action based on the received file to be flashed, etc. After the basic upgrade program is flashed to the target device, the target device runs the basic upgrade program to execute actions such as communication between the target device and the host computer, receiving and flashing the file to be flashed, etc.; the application is a program with other functions at a higher level than the basic upgrade program. After being flashed to the target device, the target device runs the application to realize the software function of the application. There is no directional restriction on the software function here, which is determined by the function and life cycle of the target device itself. Therefore, the application can be set according to the actual situation and user needs. For example, the target device is an image acquisition device, and the application is an application for acquiring and preprocessing image signals, or the target device is an audio acquisition device, and the application is an application for filtering and denoising audio signals. In this embodiment, the type of target device and the specific content of the application are not limited.
[0048] Furthermore, the parameter content is the parameters used as the basis for flashing during the flashing process, such as the target device model and the target flashing address, wherein the target device model corresponds to target devices with different configurations and different functions. It can be understood that the program to be flashed can ensure normal operation when it is flashed to the correct target device. The model of the correct target device here is also the target device model, which is used to inform the outside world of the model of the target flashing object of the file to be flashed; further, the target flashing address is the flashing position of the program to be flashed on the correct target device. The program to be flashed can ensure normal operation when it is flashed according to the target flashing address. Therefore, the target flashing address is used to indicate the flashing address of the file to be flashed.
[0049] It is understandable that in the prior art, the application and basic upgrades use two projects to independently implement firmware upgrades, that is, the device program flashing process needs to be executed twice, one time to flash the basic upgrade program, and the other time to flash the application. Due to the complexity of this flashing process, it is not only time-consuming, but also easy to cause confusion due to the cumbersome process, resulting in errors in the flashing content, and then the upgrade fails, affecting the normal operation of the product.
[0050] To this end, in an embodiment of the present application, the application program and the basic upgrade program are merged into the same program to be flashed, and the program to be flashed is flashed at one time, that is, the application program and the basic upgrade program are flashed as one project, thereby reducing the complexity of the flashing process.
[0051] Furthermore, in this embodiment, the program to be flashed and the parameter content are compared and verified to ensure the internal consistency of the file to be flashed, that is, the program to be flashed is for the target device model, and the target flashing address is valid in the designated storage area of the target device model. Whether the specific program to be flashed conforms to the target device model can be confirmed by specific identification features, for example, the program to be flashed conforming to the target device model should contain specific identification features, and for another example, the parameters of the specific identification position of the program to be flashed conforming to the target device model should be within a preset range.
[0052] Furthermore, whether the target flashing address is valid in the specified storage area of the target device model determines whether the program to be flashed can be successfully flashed into the device. If it is valid, the subsequent program to be flashed will be written into the specified storage area according to the target flashing address. If it is invalid, the program to be flashed cannot find the normal storage area and cannot achieve the purpose of flashing in the device.
[0053] It can be understood that the verification of whether the flashing program conforms to the target device model and the verification of whether the target flashing address is valid in the designated storage area of the target device model ensures the consistency of the program to be flashed, the target device model and the target flashing address within the file to be flashed. Only when the verification is consistent can the program to be flashed perform subsequent substantive flashing actions. If any of the verification results is negative, that is, the program to be flashed does not conform to the target device model or the target flashing address is invalid in the designated storage area of the target device model, it indicates that there is a problem with the internal consistency of the file to be flashed, and direct flashing is very likely to cause errors. At this time, an alarm message needs to be issued to prompt the staff to intervene and deal with the problem in the file to be flashed.
[0054] It can be understood that the designated storage area of the target device model refers to the area in the device of the target device model used to store the program to be flashed. According to the specific content of the program to be flashed, the designated storage area can be divided into one or more areas, each area storing different parts of the program to be flashed. For each designated storage area, each part of the program to be flashed corresponds to a target flash address, and the target flash address is valid in the corresponding designated storage area. Valid here means that the designated storage area contains the target flash address, and when the corresponding part of the program to be flashed is flashed starting from the target flash address, the part of the program can be completely flashed into the designated storage area, and the program will not overflow the designated storage area.
[0055] It is understandable that the purpose of setting the designated storage area is to provide a clear and fixed storage partition for the program inside the device, so as to facilitate the operation and upgrade of the program, reduce the tediousness of program operation errors and temporary resource planning, especially in this embodiment, the program to be flashed includes both application programs and basic upgrade programs, and the designated storage area of the target device model is determined in advance, which can ensure that the program to be flashed with more content is correctly flashed to the corresponding location. Therefore, this method can be applied to different device models and achieve the purpose of error prevention.
[0056] It can be understood that the purpose of flashing the file to be flashed is to flash it to the designated storage area of the device corresponding to the target device model, that is, the staff expects to flash the file to be flashed to the designated storage area of the device corresponding to the target device model. When the method of this embodiment is implemented, the host computer connects a device to be flashed as the target device, and the target device should be the device corresponding to the target device model, so that after completing the verification of the program to be flashed, the file to be flashed can be sent to the target device, and the target device will flash the program to be flashed to the internal designated storage area based on the target flashing address.
[0057] It is understandable that in the process of sending the file to be flashed to the target device after verification, in order to further improve the reliability of communication, the command confirmation link between the host computer and the target device, that is, the firmware upgrade command and the firmware upgrade confirmation information, can be added to ensure that the communication connection between the two is normal. Redundant loop verification of the file to be flashed can also be added to ensure that the file to be flashed is completely sent to the target device. Specifically, the process of flashing the program to be flashed to the designated storage area of the target device based on the target flashing address by the target device includes:
[0058] Generate firmware upgrade instructions based on the file to be flashed and send them to the target device;
[0059] When receiving the firmware upgrade confirmation information returned by the target device, the file to be flashed is sent to the target device according to the redundant cycle verification strategy;
[0060] The target device is used to flash the program to be flashed to a specified storage area of the target device based on the target flashing address.
[0061] It is understandable that in the process of data transmission, no matter how perfect the design of the transmission system is, errors will always exist. Such errors may cause one or more frames transmitted on the link to be destroyed, resulting in bit errors, 0 becomes 1, or 1 becomes 0, so that the receiver receives wrong data. In order to improve the accuracy of the data received by the receiver, the receiver needs to perform error detection on the data. The receiver will actually receive the data only when and only when the detection result is correct. There are many ways to detect, the common ones are parity check, Internet check and cyclic redundancy check. The cyclic redundancy check (CRC) strategy is a calculation method for verifying the accuracy of digital transmission on a communication link. The sender uses a formula to calculate a value of the information contained in the transmitted data, and attaches this value to the transmitted data. The receiver performs the same calculation on the same data and should get the same result. If the two CRC results are inconsistent, it means that an error occurred in the transmission, and the receiver can ask the sender to resend the data.
[0062] It is understandable that in order to improve the security of communication, the encryption and decryption of the file to be flashed is added in the method of this embodiment, that is, before the host computer sends the file to be flashed to the target device, the file to be flashed is encrypted, the encrypted file to be flashed is sent by the host computer to the target device, the target device decrypts the file to be flashed and then executes the action of flashing the program to be flashed to the designated storage area of the target device based on the target flashing address. Therefore, before the method of this embodiment sends the file to be flashed to the target device according to the redundant cyclic check strategy, it also includes:
[0063] Encrypt the files to be flashed according to the preset encryption algorithm;
[0064] The target device is also used to decrypt the file to be flashed according to a preset decryption algorithm corresponding to the preset encryption algorithm.
[0065] It can be understood that the method of this embodiment merges the application program and the basic upgrade program into the same program to be flashed, and the two projects are merged into one. All project contents can be implemented under the same project, such as development, burning, simulation, online debugging, maintenance management, etc., which speeds up the research and development progress, facilitates later maintenance and management, and saves manpower and time in the burning stage.
[0066] The method of the embodiment of the present application reduces the number of flashing projects and improves the efficiency of firmware flashing by merging the application program and the basic upgrade program into the same program to be flashed file, and at the same time improves the accuracy of the file to be flashed by verifying the target device model and target flashing address of the file to be flashed, thereby avoiding errors when the program to be flashed is flashed to the designated storage area of the target device. The present application ensures the efficiency and accuracy of product firmware upgrades and ensures that firmware upgrades will not affect the normal operation of the product.
[0067] All the above optional technical solutions can be combined in any way to form optional embodiments of the present application, and will not be described in detail here. It should be understood that the size of the sequence number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0068] Figure 3 It is a flowchart of a firmware flashing method for a device provided in an embodiment of the present application. Figure 3 The firmware flashing method is executed by a target device, and the target device can be Figure 1 The first terminal device, the second terminal device, the third terminal device or the server in the hardware is implemented. Figure 3 As shown, the firmware flashing method includes:
[0069] S301: receiving a file to be flashed sent by a host computer, where the program to be flashed in the file to be flashed includes an application program and a basic upgrade program;
[0070] S302: Determine the corresponding target device model and target flashing address from the parameter content of the file to be flashed;
[0071] S303: Verify whether the target device model is consistent with the target device, and verify whether the target flash address is valid in the corresponding designated storage area in the target device;
[0072] S304: When the target device model is consistent with the target device and the target flashing address is valid in the designated storage area, the program to be flashed is flashed to the corresponding designated storage area based on the target flashing address.
[0073] It can be understood that the firmware flashing method applied to the target device and the firmware flashing method applied to the host computer have the same file to be flashed, corresponding to two different execution entities. When executing the firmware flashing, the host computer verifies the internal target device model and target flashing address of the file to be flashed, and then sends the file to be flashed to the target device, and flashes the program to be flashed through the target device. In fact, Figure 3 The firmware flashing method applied to the target device is a specific process of flashing the program to be flashed on the target device.
[0074] Among them, after receiving the file to be flashed, the target device verifies the parameter content of the file to be flashed. The purpose of the verification here is to verify whether the file to be flashed matches the target device, rather than whether the program to be flashed and the parameter content of the file to be flashed are consistent. When it is confirmed that the target device model of the file to be flashed is the target device, and the target flashing address is valid in the corresponding designated storage area of the target device, the flashing action is executed to flash the program to be flashed to the corresponding designated storage area. If the verification finds that the macro program to be flashed does not match the target device model or the target flashing address is invalid in the target flashing address of the target device, the flashing action is not executed, and the file error information is returned to the host computer. It can be understood that the verification that occurs before the flashing action ensures the validity and reliability of the flashing action, and avoids the situation where the program to be flashed whose content does not match the target device or the target flashing address is invalid is flashed to the designated storage area, resulting in flashing errors and failures.
[0075] It is understandable that, since the application program and the basic upgrade program are in the same file to be flashed, the upgrade of the application program and the basic upgrade program can be completed with one project of the file to be flashed, saving the upgrade process and time.
[0076] Furthermore, since the program to be flashed includes an application program and a basic upgrade program, different programs to be flashed will be assigned corresponding designated storage areas and designated loading areas according to preset correspondences to ensure that each part of the program to be flashed can be correctly flashed to the corresponding location and run smoothly. Therefore, before flashing the program to be flashed to the designated storage area of the corresponding target device, it also includes:
[0077] By reading a preset configuration file in the target device, the configuration parameters in the preset configuration file are determined;
[0078] Determine, according to the configuration parameters, a plurality of designated storage areas and a designated loading area corresponding to each designated storage area;
[0079] The program in each designated storage area is executed based on the corresponding designated load area.
[0080] It is understandable that the preset configuration file is a file written to the target device in advance, and the preset configuration file specifies the specific location of each designated storage area and each designated loading area by setting configuration parameters. The designated storage area here is usually divided in the storage area of the target device, such as flash, and the designated loading area is usually divided in the loading area of the target device, such as RAM. The designated storage area and the designated loading area are not necessarily strictly one-to-one corresponding. The designated loading area can correspond to one or more designated storage areas, and each designated storage area must correspond to a designated loading area. The program written into the designated storage area will be loaded into the corresponding designated loading area to run at runtime.
[0081] Specifically, according to the subdivision of the program by function in the application program and the basic upgrade program, multiple designated storage areas and corresponding designated loading areas are determined, for example Figure 4 As shown, the designated storage area includes a static variable area corresponding to the basic upgrade program, an upgrade program storage area corresponding to the basic upgrade program, an application startup area, and an application storage area corresponding to the application;
[0082] The designated loading area includes an upgrade program loading area corresponding to the basic upgrade program and an application program loading area corresponding to the application program.
[0083] It can be understood that the basic upgrade program includes underlying operation interface library data and upgrade key data, and the designated storage area corresponding to the underlying operation interface library data is the upgrade program storage area;
[0084] The designated storage area corresponding to the upgrade key data is the static variable area.
[0085] It is understandable that the compiler in the target device assigns the variables, methods, and libraries in the program to be flashed to the designated storage area and the designated loading area. The designated storage area includes:
[0086] A static variable area for storing static variables of the basic upgrade program; the static variables include upgrade key data;
[0087] An upgrade program storage area for storing an upgrade program of a basic upgrade program; the upgrade program includes underlying operation interface library data;
[0088] An application startup area that stores a startup program for starting an application. Based on the flashing requirements, if the startup program also needs to be flashed and updated, the startup program will also be included in the programs to be flashed. If the startup program does not need to be flashed and updated, the startup program may not be included in the programs to be flashed. The original startup program is retained in the application startup area, and the original startup program can be used after the application in the program to be flashed is flashed to the designated storage area.
[0089] The application storage area where applications are stored.
[0090] Among them, the static variable area and the upgrade program storage area are used to store different parts of the basic upgrade program respectively. When the program is running, the designated loading area corresponding to the basic upgrade program is the same upgrade program loading area. Similarly, the designated loading area corresponding to the application is the same application loading area.
[0091] Furthermore, in addition to the above specific areas, the storage area and loading area of the device can also be divided into other areas according to needs. For example, the loading area also includes a boot solidification area, a stack area, a special variable running area, and an application's variable-dedicated area. The storage area also includes an upgrade flag storage area, a model storage area, etc. The specific settings can be made according to actual conditions and user needs, and are not limited here.
[0092] It can be understood that the method of this embodiment merges the application program and the basic upgrade program into the same program to be flashed, and the two projects are merged into one. All project contents can be implemented under the same project, such as development, burning, simulation, online debugging, maintenance management, etc., which speeds up the research and development progress, facilitates later maintenance and management, and saves manpower and time in the burning stage.
[0093] The method of the embodiment of the present application reduces the number of flashing projects and improves the efficiency of firmware flashing by merging the application program and the basic upgrade program into the same program to be flashed file, and at the same time improves the accuracy of the file to be flashed by verifying the target device model and target flashing address of the file to be flashed, thereby avoiding errors when the program to be flashed is flashed to the designated storage area of the target device. The present application ensures the efficiency and accuracy of product firmware upgrades and ensures that firmware upgrades will not affect the normal operation of the product.
[0094] All the above optional technical solutions can be combined in any way to form optional embodiments of the present application, and will not be described in detail here. It should be understood that the size of the sequence number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0095] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0096] Figure 5 Schematic diagram of a firmware flashing device for a device provided in an embodiment of the present application. Figure 5 As shown, the firmware flashing device of the device includes:
[0097] An acquisition module 501 is used to acquire a file to be flashed, where the program to be flashed in the file to be flashed includes an application program and a basic upgrade program;
[0098] A determination module 502 is used to determine the corresponding target device model and target flashing address from the parameter content of the file to be flashed;
[0099] Verification module 503, used to verify whether the program to be flashed conforms to the target device model, and to verify whether the target flashing address is valid in the designated storage area that conforms to the target device model;
[0100] The action module 504 is used to flash the program to be flashed to the designated storage area of the target device based on the target flashing address through the target device when the program to be flashed conforms to the target device model and the target flashing address is valid in the designated storage area conforming to the target device model.
[0101] The device of the embodiment of the present application combines the application program and the basic upgrade program into the same program to be flashed file, thereby reducing the number of flashing projects and improving the efficiency of firmware flashing. At the same time, by verifying the target device model and target flashing address of the file to be flashed, the accuracy of the file to be flashed is improved, and errors are avoided when the program to be flashed is flashed to the designated storage area of the target device. The present application ensures the efficiency and accuracy of product firmware upgrades and ensures that firmware upgrades will not affect the normal operation of the product.
[0102] In an exemplary embodiment, the action module is specifically used to:
[0103] Generate firmware upgrade instructions based on the file to be flashed and send them to the target device;
[0104] When receiving the firmware upgrade confirmation information returned by the target device, the file to be flashed is sent to the target device according to the redundant cycle verification strategy;
[0105] The target device is used to flash the program to be flashed to a specified storage area of the target device based on the target flashing address.
[0106] In an exemplary embodiment, before the action module sends the file to be flashed to the target device according to the redundant cycle check strategy, it is also used to:
[0107] Encrypt the files to be flashed according to the preset encryption algorithm;
[0108] The target device is also used to decrypt the file to be flashed according to a preset decryption algorithm corresponding to the preset encryption algorithm.
[0109] Figure 6 Schematic diagram of an electronic device 6 provided in an embodiment of the present application. Figure 6 As shown, the electronic device 6 of this embodiment includes: a processor 601, a memory 602, and a computer program 603 stored in the memory 602 and executable on the processor 601. When the processor 601 executes the computer program 603, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 601 executes the computer program 603, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0110] The electronic device 6 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 6 may include, but is not limited to, a processor 601 and a memory 602. Those skilled in the art will appreciate that Figure 6 The electronic device 6 is merely an example and does not limit the electronic device 6 . The electronic device 6 may include more or less components than those shown in the figure, or different components.
[0111] The processor 601 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0112] The memory 602 may be an internal storage unit of the electronic device 6, for example, a hard disk or memory of the electronic device 6. The memory 602 may also be an external storage device of the electronic device 6, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 6. The memory 602 may also include both an internal storage unit of the electronic device 6 and an external storage device. The memory 602 is used to store computer programs and other programs and data required by the electronic device.
[0113] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0114] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0115] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for flashing firmware of a device, characterized in that: Applied to the host computer, including: Obtaining a file to be flashed, wherein the program to be flashed in the file to be flashed includes an application program and a basic upgrade program; Determine the corresponding target device model and target flashing address from the parameter content of the file to be flashed; Verify whether the program to be flashed complies with the target device model, and verify whether the target flashing address is valid in the designated storage area of the target device model; When the program to be flashed conforms to the target device model and the target flashing address is valid in the designated storage area of the target device model, the program to be flashed is flashed to the designated storage area of the target device based on the target flashing address through the target device.
2. The method according to claim 1, characterized in that The process of flashing the program to be flashed to the designated storage area of the target device based on the target flashing address by the target device includes: Generate a firmware upgrade instruction based on the file to be flashed, and send it to the target device; When receiving the firmware upgrade confirmation information returned by the target device, sending the file to be flashed to the target device according to the redundant cycle verification strategy; The target device is used to flash the program to be flashed to the designated storage area of the target device based on the target flashing address.
3. The method according to claim 2, characterized in that Before sending the to-be-written file to the target device according to the redundant cycle check strategy, the method further includes: Encrypting the file to be flashed according to a preset encryption algorithm; The target device is further used to decrypt the file to be flashed according to a preset decryption algorithm corresponding to the preset encryption algorithm.
4. A method for flashing firmware of a device, characterized in that: Applied to target devices, including: Receiving a file to be flashed sent by a host computer, wherein the program to be flashed in the file to be flashed includes an application program and a basic upgrade program; Determine the corresponding target device model and target flashing address from the parameter content of the file to be flashed; Verify whether the target device model is consistent with the target device, and verify whether the target flash address is valid in the corresponding designated storage area of the target device; When the target device model is consistent with the target device and the target flashing address is valid in the designated storage area, the program to be flashed is flashed to the corresponding designated storage area based on the target flashing address.
5. The method according to claim 4, characterized in that Before flashing the program to be flashed to the corresponding designated storage area of the target device, the method further includes: Determine configuration parameters in the preset configuration file by reading the preset configuration file in the target device; Determine, according to the configuration parameters, a plurality of the designated storage areas and a designated loading area corresponding to each of the designated storage areas; The program in each of the designated storage areas is executed based on the corresponding designated loading area.
6. The method according to claim 5, characterized in that The designated storage area includes a static variable area corresponding to the basic upgrade program, an upgrade program storage area corresponding to the basic upgrade program, an application startup area, and an application storage area corresponding to the application; The designated loading area includes an upgrade program loading area corresponding to the basic upgrade program and an application program loading area corresponding to the application program.
7. The method according to claim 6, characterized in that The basic upgrade program includes underlying operation interface library data and upgrade key data, and the designated storage area corresponding to the underlying operation interface library data is the upgrade program storage area; The designated storage area corresponding to the upgrade key data is the static variable area.
8. A device for flashing firmware of a device, characterized in that: include: An acquisition module, used for acquiring a file to be flashed, wherein the program to be flashed in the file to be flashed includes an application program and a basic upgrade program; A determination module, used to determine the corresponding target device model and target flashing address from the parameter content of the file to be flashed; A verification module, used to verify whether the program to be flashed conforms to the target device model, and to verify whether the target flashing address is valid in a designated storage area that conforms to the target device model; The action module is used to flash the program to be flashed to the designated storage area of the target device based on the target flashing address through the target device when the program to be flashed conforms to the target device model and the target flashing address is valid in the designated storage area conforming to the target device model.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the processor implements the steps of the method according to any one of claims 1 to 3 or the steps of the method according to any one of claims 4 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 3 or the steps of the method according to any one of claims 4 to 7.