Software flashing method, electronic equipment and storage medium
By distinguishing the brushing methods of developing samples and mass-produced products, and performing consistency verification separately, the hardware consistency problem in the development stage is solved, and the rapid upgrade and safe brushing in the mass-produced stage is achieved, which improves the efficiency and safety of automotive software updates.
Patent Information
- Application Number
- CN202410088779.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-22
- Publication Date
- 2025-07-22
AI Technical Summary
In the prior art, frequent changes in automotive software versions lead to frequent software flashing demands, especially in the development stage, when the software version is inconsistent with the hardware, it leads to difficulty in replacing hardware and affecting mass production efficiency and software updates.
By judging whether the equipment is developing samples or mass-produced products, software consistency and hardware consistency verification are carried out separately. The development samples are only hardware consistency verification, and mass-produced products are checked for software and hardware consistency verification to ensure the correctness and security of the flashing data.
It realizes rapid software upgrades for developing samples, saves material costs, and writes the brushing safety of mass-produced products, improving the efficiency of automobile mass production and software update flexibility.
Smart Images

Figure CN120353479A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software flashing, and in particular to a software flashing method, an electronic device, and a storage medium. Background Art
[0002] With the gradual acceleration of the update and iteration speed of automobiles, the development of automotive products also shows a trend of short time, high frequency, and fast speed. Before mass production of automobiles, it is usually necessary to flash the software installed on the hardware of the automobiles, so as to conduct software testing and optimization. For example, the controller on an automobile is hardware, and the installed software can be the control system of the controller. Before mass production of the automobile, it is necessary to repeatedly test whether the version of the control system of the controller can operate normally when applied to the controller, and optimize the control system based on the results of multiple tests to ensure the safety of the automobile. At present, the software flashing of the Electronic Control Unit (ECU) is to send the flashing data to the ECU through the Controller Area Network (CAN) bus for update. And to ensure the correctness of the flashing data, the ECU will perform software and hardware consistency verification on the flashing data after receiving it. If the verification fails, the flashing will be aborted.
[0003] In the development stage, the frequent change of software versions also means that software flashing needs to be performed frequently. When the updated software version differs greatly from the original software version, it will be judged by the ECU that it does not meet the software and hardware consistency verification and cannot perform software flashing. It can only perform software upgrade by replacing new hardware that meets the software and hardware consistency verification. And for situations where it is inconvenient to replace new hardware, for example, the disassembly of the electronic component controlling the airbag on the automobile is relatively complicated and not easy to replace, software flashing is often very restricted, which is more unfavorable for software update after mass production of automobiles. Summary of the Invention
[0004] In view of this, the embodiments of the present application provide a software flashing method, an electronic device, and a storage medium. By judging whether the hardware for software flashing is a development sample or a mass-produced product, and performing software consistency verification and hardware consistency verification, it not only ensures the flashing safety of mass-produced products, but also saves time and material costs for software upgrade of development samples.
[0005] In a first aspect, the present application provides a software flashing method, which is characterized in that it is applied to a first device, and the method includes: obtaining first software data to be flashed, first hardware version information corresponding to the first software data to be flashed, and device information of the first device; if it is determined that the first device is a first type of device based on the device information of the first device, writing the first software data to be flashed into a first memory and a second memory, overwriting the first software data in the first memory and overwriting the second software data in the second memory; matching the first hardware version information with the second hardware version information in the second memory; corresponding to the matching of the first hardware version information and the second hardware version information in the second memory, determining the first software data to be flashed as target software data.
[0006] In a possible implementation of the above first aspect, the first memory includes a read-only memory, and the second memory includes a non-volatile memory.
[0007] In a possible implementation of the above first aspect, both the first memory and the second memory have a page-turning function; when writing the first software data to be flashed into the first memory, the first memory executes the page-turning function to overwrite the first software data in the first memory; when writing the first software data to be flashed into the second memory, the second memory executes the page-turning function to overwrite the second software data in the second memory.
[0008] In a possible implementation of the above first aspect, corresponding to the non-matching of the first hardware version information and the second hardware version information in the second memory, repeatedly execute obtaining the first software data to be flashed, the first hardware version information corresponding to the first software data to be flashed, and the device information of the first device. If it is determined that the first device is a first type of device based on the device information of the first device, write the first software data to be flashed into the first memory and the second memory, and match the first hardware version information with the second hardware version information in the second memory until the first hardware version information and the second hardware version information in the second memory are matched.
[0009] In a possible implementation of the above first aspect, the device information represents the stage where the device is located, and the first type of device is a device in the development stage.
[0010] Second aspect, the present application provides a software flashing method, which is characterized in that it is applied to a second device, and the method includes: obtaining second software data to be flashed and first hardware version information corresponding to the second data to be flashed and device information of the second device; if it is determined that the second device is a second type of device based on the device information of the second device, writing the second software data to be flashed into a first memory, overwriting the first software data in the first memory; matching the second software data to be flashed in the first memory with the second software data in a second memory, and matching the first hardware version information with the second hardware version information in the second memory; corresponding to the matching of the second software data to be flashed in the first memory with the second software data in the second memory, and the matching of the first hardware version information with the second hardware version information in the second memory, determining the second data to be flashed as target software data.
[0011] In a possible implementation of the above second aspect, the first memory includes a read-only memory, and the second memory includes a non-volatile memory.
[0012] In a possible implementation of the above second aspect, the first memory has a page-turning function; when writing the second software data to be flashed into the first memory, the first memory executes the page-turning function to overwrite the first software data in the first memory.
[0013] In a possible implementation of the above second aspect, corresponding to the non-matching of the second software data to be flashed in the first memory with the second software data in the second memory, and the non-matching of the first hardware version information with the second hardware version information in the second memory, repeatedly obtain the second software data to be flashed and the first hardware version information corresponding to the second data to be flashed and the device information of the second device. If it is determined that the second device is a second type of device based on the device information of the second device, match the second software data to be flashed in the first memory with the second software data in the second memory, and match the first hardware version information with the second hardware version information in the second memory until the second software data to be flashed in the first memory matches the second software data in the second memory, and the first hardware version information matches the second hardware version information in the second memory.
[0014] In a possible implementation of the above second aspect, the device identifier indicates the stage where the device is located, and the second type of device is a device in the mass production stage.
[0015] Third aspect, the present application provides an electronic device, including: a memory for storing instructions executed by one or more processors of the electronic device, and a processor, which is one of the one or more processors of the electronic device, for executing the instructions stored in the memory to implement any one of the data flashing methods provided by the above first aspect and various possible implementations and the second aspect and various possible implementations.
[0016] In a fourth aspect, an embodiment of the present invention provides a readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to implement any one of the data writing methods provided in the first aspect and various possible implementations and the second aspect and various possible implementations.
[0017] The beneficial effects of this application are as follows:
[0018] In the embodiment of this application, by determining whether the hardware for software writing is a development sample or a mass-produced product, if it is a development sample, the application program file, const file, and NVM file in the writing data of the development sample are written, and only hardware consistency verification is performed; if it is a mass-produced product, the application program file and const file in the writing data of the mass-produced product are written, and software consistency verification and hardware consistency verification are performed, which not only ensures the writing safety of the mass-produced product, but also saves time and material costs for the software upgrade of the development sample. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 According to some embodiments of the present application, a schematic structural diagram of an ECU is shown;
[0020] Figure 2 According to some embodiments of the present application, a schematic diagram of the composition of an ECU writing file is shown;
[0021] Figure 3 According to some embodiments of the present application, a flowchart of software writing is shown;
[0022] Figure 4 According to some embodiments of the present application, another flowchart of software writing is shown. DETAILED DESCRIPTION
[0023] The illustrative embodiments of this application include but are not limited to a software writing method, an electronic device, and a storage medium.
[0024] It can be understood that the software writing method applicable to the technical solution of this application can be used in any electronic device with a device installed with software, such as an automobile, a smart phone, a wearable device, etc. Hereinafter, the technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the accompanying drawings in the embodiments of the present invention.
[0025] The structure of the EUC will be introduced below, as Figure 1As shown in the figure, the ECU may include a data programming module 101, a consistency verification module 102, a communication processing module 103, a security processing module 104, a memory management module 105, a microcontroller unit 106, a data flash drive 107, and a code flash drive 108.
[0026] Among them, the data programming module 101 is used to receive programming data, call the memory management module 105, and call the consistency verification module 102.
[0027] The consistency verification module 102 is used to verify the software and hardware consistency and send the verification result to the data programming module 101. The software has software version information, and the hardware has hardware version information.
[0028] The communication processing module 103 is used to analyze the programming data, remove the communication protocol data in the programming data, and transmit the programming data after removing the communication protocol data to the data programming module 101.
[0029] The security processing module 104 is used to verify the security of the programming data. For example, the security of the programming data can be verified by sending an encrypted message to the data programming module 101.
[0030] The memory management module 105 is used to store the version information of software and hardware. Among them, the memory management module 105 includes a code flash and a non-volatile memory (NVM).
[0031] The microcontroller unit (such as a host computer, a computer) 106 is used to convert the ECU programming file into programming data and transmit the programming data to the communication processing module 103 through the CAN bus.
[0032] Figure 2 A schematic diagram of the composition of a programming file is shown. The programming file includes an application program file, a parameter file, an NVM file, and factory data pre-burned at the factory. Among them, the application program file includes data flash version information and const parameter version information, the parameter file includes const parameter version information and hardware version information. The NVM file includes data flash version information. The factory data pre-burned at the factory includes hardware version information.
[0033] Among them, the code flash is used to store the application program file and the parameter file. The NVM is used to store the NVM file.
[0034] In some alternative embodiments, the date flash version information in the application file and the date flash version information in the NVM file can be represented as software version information. The const parameter version information of the application file and the const parameter version information of the parameter file can be represented as the parameter version information of the hardware. For example, both the const parameter version information of the application file and the const parameter version information of the parameter file can be represented as the parameters of the ECU power. The hardware version information of the parameter file and the hardware version information of the factory data pre-burned at the time of factory can be represented as the version information of the hardware itself. The hardware version information possessed by the hardware includes the parameter version information of the hardware and the version information of the hardware itself.
[0035] The date flash driver 107 is used to provide an interface for the data writing module 101 to access the NVM in the memory management module 105. The data writing module 101 can implement reading, writing, and deleting of the data stored in the NVM based on the interface provided by the date flash driver 107.
[0036] The code flash driver 108 is used to provide an interface for the data writing module 101 to access the code flash in the memory management module 105. The data writing module 101 can implement reading, writing, and deleting of the data stored in the code flash based on the interface provided by the code flash driver 108.
[0037] In some alternative instances, a method of software and hardware consistency verification can be adopted for Figure 1 the ECU structure shown for software writing. Figure 3 A method of software and hardware consistency verification is shown.
[0038] S301: Start writing.
[0039] In some specific embodiments, the microcontroller unit 106 converts the ECU writing file into writing data and transmits the writing data to the communication processing module 103 through the CAN bus. The communication processing module 103 transmits the writing data to the data writing module 101. After receiving the writing data, the data writing module 101 calls the consistency verification module 102 to perform software and hardware consistency verification. Among them, the writing data includes software version information and hardware version information.
[0040] S302: Verify software and hardware consistency.
[0041] It can be understood that the consistency verification module 102 performing software and hardware consistency verification includes: software consistency verification and hardware consistency verification.
[0042] It can be understood that when the software version information in the flashing data is consistent with the original software version information, and the hardware version information matches the software version information in the flashing data, the necessary conditions for flashing the software of the hardware are met.
[0043] In some specific embodiments, software consistency verification may refer to verifying whether the software version information in the flashing data is consistent with the original software version information in the memory management module 105 when performing ECU software flashing, so as to ensure the correctness of the software version information in the flashing data.
[0044] Hardware consistency verification may refer to verifying whether the hardware version information matches the software version information in the flashing data when performing software flashing, so as to ensure that the flashing data can run on the correct hardware platform.
[0045] In some alternative embodiments, the software version information in the flashing data being consistent with the original software version information may mean that the software version information in the flashing data and the original software version information are sub-software versions under the same version. For example, if the software version information in the flashing data is 1.0.2 and the original software version information is 1.0.1, it can be shown that the software version information in the flashing data is consistent with the original software version information, and both belong to version 1.0. If the software version information in the flashing data is 2.0.1, it means that the software version information in the flashing data is inconsistent with the original software version information, that is, the software version information in the flashing data belongs to version 2.0 and the original software version belongs to version 1.0.
[0046] In some other alternative embodiments, when the software version information in the flashing data is consistent with the hardware version information, it means that the hardware version information matches the software version information in the flashing data; otherwise, it does not match.
[0047] S303: Determine whether the consistency verification passes.
[0048] In some specific embodiments, if the newly flashed software version information is consistent with the original software version information, the software consistency verification is satisfied; otherwise, the software consistency verification is not satisfied, and go to step S305. If the hardware version information matches the newly flashed software version information, the hardware consistency verification is satisfied; otherwise, the software consistency verification is not satisfied, and go to step S305.
[0049] S304: Flash the read-only memory.
[0050] In some specific embodiments, since the NVM files stored in the NVM will include some data that is data recorded by the software during operation (not shown), the data recorded during operation needs to match the software. Therefore, the data recorded during operation has particularity and cannot be overwritten. Therefore, under the condition of software and hardware consistency, the necessary conditions for flashing the software loaded on the hardware are met, and the data flashing module 101 flashes the version information of the software and hardware stored in the read-only memory of the memory management module 105 to the version information of the software and hardware represented by the flashing data.
[0051] S305: Flashing ends.
[0052] In some specific embodiments, after the data flashing module 101 flashes the version information of the software and hardware stored in the read-only memory of the memory management module 105 to the version information of the software and hardware represented by the flashing data, the flag bit representing data flashing in the data flashing module 101 is marked as flashing successfully. For example, the flag bit representing data flashing in the data flashing module 101 is marked as "1" to indicate successful flashing.
[0053] If the software and hardware consistency check fails in step S303, the flag bit representing data flashing in the data flashing module 101 is marked as flashing failed. For example, the flag bit representing data flashing in the data flashing module 101 is marked as "0" to indicate flashing failed.
[0054] Since in the development stage, the frequent change of the software version also means that software flashing needs to be performed frequently. When the software version information in the flashing data differs greatly from the original software version, it will be judged by the consistency check module 102 of the ECU that the software and hardware consistency check is not satisfied, and software flashing cannot be performed. Only by replacing the new hardware that meets the software and hardware consistency check can software be upgraded. And for the situation where it is inconvenient to replace the new hardware, software flashing is often very restricted, which further affects the software update after mass production of the product.
[0055] To solve the above problems, the embodiments of the present application provide a software flashing method. Next, it will continue to be combined with Figure 1 and Figure 2 , and the software flashing method provided by the embodiments of the present application will be introduced in detail. As Figure 4 shown, this software flashing method may include:
[0056] 4001: The flashing data is transmitted to the communication processing module through the CAN bus, and the communication processing module parses the flashing data and hands it over to the data flashing module.
[0057] In some specific embodiments, the ECU flash file cannot be directly transmitted to the data flash module 101, and the micro control unit 106 converts the ECU flash file into flash data, and transmits the flash data to the communication processing module 103 through the CAN bus. Since the flash data will carry the communication protocol data when transmitted through the CAN bus, the micro control unit 106 can transmit the refresh data and the communication protocol data to the communication processing module 103 in the form of a data packet. Therefore, after receiving the data packet, the communication processing module 103 can parse the data packet to obtain the flash data and the communication protocol data, remove the communication protocol data, and transmit the flash data after removing the communication protocol data to the data flash module 101.
[0058] 4002: The data flashing module starts flashing after receiving the flashing data.
[0059] It can be understood that after receiving the flashing data, the data flashing module 101 can start the flashing process.
[0060] 4003: Determine whether it is a development sample.
[0061] It can be understood that the flash data includes non-flashable information (not shown), which contains flags for development samples and mass-produced products. For example, a flag of 1 indicates that the hardware is a development sample, and a flag of 0 indicates that the hardware is a mass-produced product.
[0062] It can be understood that after receiving the flashing data, the data flashing module 101 first determines whether the hardware to be flashed is a development sample according to the flag indicating the development sample or mass production product in the flashing data's non-flashable information. When the data flashing module 101 determines that the hardware to be flashed is a development sample, the process goes to step 4004. When the data flashing module 101 determines that the hardware to be flashed is not a development sample, that is, the hardware to be flashed is a mass production product, the process goes to step 4013.
[0063] 4004: The data flash module calls the memory management module and the code flash driver to flash the application program file.
[0064] It can be understood that the memory management module 105 contains a page turning function, which may refer to an operation in which new data overwrites old data. That is, when the data flash module 101 flashes the application files and parameter files stored in the code flash in the memory management module 105, and the NVM files stored in the NVM, the page turning function of the memory management module 105 will realize the flashing data to overwrite the application files and parameter files stored in the original code flash, and the NVM files stored in the NVM, thereby completing the software flashing.
[0065] In some specific embodiments, it can be understood that when the product to be software-flashed is a development sample, after receiving the flashing data of the development sample, the data flashing module 101 can call the memory management module 105 and the code flash driver 108. The code flash driver 108 provides an interface for accessing the code flash to the data flashing module 101. Based on the interface provided by the code flash driver 108, while the data flashing module 101 performs the writing of the application program file, the memory management module 105 performs the paging function to complete the update of the application program file, where the flashed application program file includes the date flash version information and the const parameter version information.
[0066] 4005: The data flashing module calls the memory management module and the code flash driver to flash the parameter file.
[0067] In some specific embodiments, it can be understood that when the product to be software-flashed is a development sample, after receiving the flashing data of the development sample, the data flashing module 101 can call the memory management module 105 and the code flash driver 108. The code flash driver 108 provides an interface for accessing the code flash to the data flashing module 101. Based on the interface provided by the code flash driver 108, while the data flashing module 101 performs the writing of the parameter file, the memory management module 105 performs the paging function to complete the update of the parameter file, where the flashed parameter file includes the const parameter version information and the hardware information.
[0068] 4006: The data flashing module calls the memory management module and the date flash driver to flash the NVM file.
[0069] In some specific embodiments, it can be understood that when the product to be software-flashed is a development sample, after receiving the flashing data of the development sample, the data flashing module 101 can call the memory management module 105 and the date flash driver 107. The date flash driver 107 provides an interface for accessing the NVM to the data flashing module 101. Based on the interface provided by the date flash driver 107, while the data flashing module 101 performs the writing of the NVM file, the memory management module 105 performs the paging function, where the flashed NVM file includes the date flash version information.
[0070] In some specific embodiments, steps 4004 and 4005 complete the flashing of the code flash, and step 4006 completes the flashing of the NVM memory, that is, steps 4004, 4005, and 4006 complete the flashing of the memory management module 105. In addition, steps 4004, 4005, and 4006 can be executed in the order relationship as shown in Figure 4 or can be executed based on other order relationships.
[0071] 4007: The data flashing module calls the security processing module to verify the signature.
[0072] In some specific embodiments, the ECU further includes a security processing module 104. The security processing module 104 verifies the security of the flashing data by verifying the signature. Among them, verifying the signature can mean that the security processing module 104 sends an encrypted message to the data flashing module 101, and the data flashing module 101 receives the encrypted message and then decrypts it, that is, the signature verification is completed.
[0073] 4008: Determine whether the signature verification passes.
[0074] In some specific embodiments, after the security processing module 104 sends an encrypted message to the data flashing module 101, if the data flashing module 101 receives the encrypted message and successfully decrypts it, it is considered to pass the signature verification, which proves the security of the flashing data and ensures the security of the flashed product.
[0075] When the security processing module 104 sends an encrypted message to the data flashing module 101, if the data flashing module 101 does not receive the encrypted message or fails to decrypt the received encrypted message successfully, it is considered that the signature verification fails and jumps to step 4019.
[0076] 4009: The data flashing module calls the consistency verification module to verify the hardware consistency.
[0077] In some specific embodiments, the application program file, parameter file, and NVM file of the development sample have been flashed, and the software part of the development sample has been completely flashed to the version represented by the flashing data. Therefore, only the hardware consistency of the development sample needs to be verified. After the signature verification passes, the data flashing module 101 calls the consistency verification module 102 to verify the hardware consistency of the development sample.
[0078] Hardware consistency may refer to whether the const parameter version of the application file is consistent with the const parameter version information in the parameter file, and whether the hardware version information in the parameter file is consistent with the hardware version information in the factory data pre-written at the time of factory shipment. That is, compare whether the const parameter version of the application file after flashing in steps 4004 - 4006 is consistent with the const parameter version information in the parameter file, and whether the hardware version information in the parameter file is consistent with the hardware version information in the factory data pre-written at the time of factory shipment.
[0079] 4010: Determine whether the hardware consistency check passes.
[0080] In some specific embodiments, if the const parameter version of the application file is consistent with the const parameter version information in the parameter file, and the hardware version information in the parameter file is consistent with the hardware version information in the factory data pre-written at the time of factory shipment, it means that the hardware consistency check passes, and proceed to step 4011; otherwise, proceed to step 4019.
[0081] 4011: The data flashing module is marked as successfully flashed.
[0082] It can be understood that if the hardware consistency check passes, it can be marked that the software flashing is successful, and the flag bit indicating data flashing in the data flashing module 101 is marked as successfully flashed. For example, the flag bit indicating data flashing in the data flashing module 101 is marked as "1" to indicate successful flashing. Proceed to step 4012 for the end of flashing.
[0083] 4012: The flashing ends.
[0084] 4013: The data flashing module calls the memory management module and the code flash driver to flash the application file.
[0085] In some specific embodiments, it can be understood that when the product for software flashing is a mass-produced product, the data flashing module 101 can, after receiving the flashing data of the mass-produced product, call the memory management module 105 and the code flash driver 108. The code flash driver 108 provides an interface for accessing the code flash to the data flashing module 101. Based on the interface provided by the code flash driver 108, while the data flashing module 101 performs the writing of the application file, the memory management module 105 performs the page turning function to complete the update of the application file, where the flashed application file includes the date flash version information and the const parameter version information.
[0086] 4014: The data flashing module calls the memory management module and the code flash driver to flash the parameter file.
[0087] In some specific embodiments, it can be understood that when the product to be software flashed is a mass-produced product, after the data flashing module 101 receives the flashing data of the mass-produced product, it can call the memory management module 105 and the code flash driver 108. The code flash driver 108 provides an interface for the data flashing module 101 to access the code flash. Based on the interface provided by the code flash driver 108, while the data flashing module 101 writes the parameter file, the memory management module 105 performs the page flipping function to complete the update of the parameter file, where the flashed parameter file includes parameter version information and hardware information.
[0088] In some specific embodiments, steps 4013 and 4014 complete the flashing of the code flash, and steps 4013 and 4014 can be executed in the order relationship as Figure 4 shown, or can be executed based on other order relationships.
[0089] 4015: The data flashing module calls the security processing module to verify the signature.
[0090] In some specific embodiments, the ECU further includes a security processing module 104. The security processing module 104 verifies the security of the flashing data by verifying the signature. Among them, verifying the signature can mean that the security processing module 104 sends an encrypted message to the data flashing module 101, and the data flashing module 101 receives the encrypted message and then decrypts it, that is, the signature verification is completed.
[0091] 4016: Determine whether the signature verification passes.
[0092] In some specific embodiments, after the security processing module 104 sends an encrypted message to the data flashing module 101, if the data flashing module 101 receives the encrypted message and decrypts it successfully, it means that the signature verification passes, proving the security of the flashing file and ensuring the security of the flashed product.
[0093] When the security processing module 104 sends an encrypted message to the data flashing module 101, if the data flashing module 101 does not receive the encrypted message or fails to decrypt the received encrypted message successfully, it means that the signature verification fails and jumps to step 4019.
[0094] 4017: The data flashing module calls the consistency verification module to verify the software and hardware consistency.
[0095] In some specific embodiments, only the application program file and the parameter file are flashed in the mass-produced products. Since the NVM file is stored in the NVM memory and the NVM file needs to be consistent with the running software, if the flashed software is not consistent with the NVM file, it is likely to cause unpredictable consequences. Therefore, software consistency verification and hardware consistency verification need to be performed on the mass-produced products. After the signature verification passes, the data flashing module 101 calls the consistency verification module 102 to verify the software consistency and hardware consistency of the mass-produced products.
[0096] Software consistency verification means whether the date flash version information of the application file is consistent with the date flash version information in the NVM file.
[0097] Hardware consistency can refer to whether the const parameter version of the application program file is consistent with the const parameter version information in the parameter file, and whether the hardware version information of the parameter file is consistent with the hardware version information in the factory data pre-written at the time of factory shipment.
[0098] 4018: Determine whether the software and hardware consistency verification passes.
[0099] In some specific embodiments, if the date flash version information of the application file is consistent with the date flash version information in the NVM file, it means that the software consistency verification passes.
[0100] If the const parameter version of the application program file is consistent with the const parameter version information in the parameter file, and the hardware version information of the parameter file is consistent with the hardware version information in the factory data pre-written at the time of factory shipment, it means that the hardware consistency verification passes. When both the software consistency verification and the hardware consistency verification pass, go to step 4011; otherwise, go to step 4019.
[0101] 4019: The data flashing module is marked as flashing failed.
[0102] If the consistency verification fails, the flag bit indicating data flashing in the data flashing module 101 is marked as flashing failed. For example, the flag bit indicating data flashing in the data flashing module 101 is marked as "0" to indicate flashing failure. Go to step 4012 to end the flashing.
[0103] In the embodiment of the present application, it is determined whether the hardware for software flashing is a development sample or a mass-produced product. If it is a development sample, the application program file, const file, and NVM file in the flashing data of the development sample are flashed, and only hardware consistency verification is performed. If it is a mass-produced product, the application program file and const file in the flashing data of the mass-produced product are flashed, and software consistency verification and hardware consistency verification are performed. This not only ensures the flashing safety of the mass-produced product, but also saves time and material costs for the software upgrade of the development sample.
[0104] The present application provides an electronic device, which includes: a processor; and a memory for storing executable instructions of the processor. Wherein, the processor is configured to execute the executable instructions to implement the software flashing method mentioned in the embodiment of the present application.
[0105] This embodiment is a corresponding embodiment to the above method embodiment, and this embodiment can be implemented in cooperation with the method embodiment. The relevant technical details mentioned in the method embodiment are still valid in this embodiment. To avoid repetition, they are not elaborated here. Correspondingly, the relevant technical details mentioned in this embodiment can also be applied to the method embodiment.
[0106] The present application provides a readable storage medium, on which instructions are stored. When the instructions are executed on an electronic device, the electronic device is caused to execute the software flashing method mentioned in the above embodiment.
[0107] This embodiment is a corresponding embodiment to the above method embodiment, and this embodiment can be implemented in cooperation with the method embodiment. The relevant technical details mentioned in the method embodiment are still valid in this embodiment. To avoid repetition, they are not elaborated here. Correspondingly, the relevant technical details mentioned in this embodiment can also be applied to the method embodiment.
[0108] The following introduces the electronic devices mentioned in this application. It can be understood that the electronic devices can be, but are not limited to: mobile phones (including foldable mobile phones and straight-bar mobile phones), tablet computers, desktop computers, handheld computers, laptop computers, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), portable android devices (PADs), personal digital assistants (PDAs), handheld devices with wireless communication functions, computing devices, in-vehicle devices or wearable devices, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical, wireless terminals in smart grid, wireless terminals in transportation safety, wireless terminals in smart city, wireless terminals in smart home, etc., mobile terminals or fixed terminals, electronic devices with data transmission and synchronization requirements such as power banks.
[0109] It should be noted that in the examples and descriptions of this application, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one" does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.
[0110] Although this application has been illustrated and described by referring to some preferred embodiments of this application, those of ordinary skill in the art should understand that various changes can be made in form and detail without departing from the scope of this application.
Claims
1. A software flashing method, characterized in that, Applied to a first device, the method includes: Obtaining first software data to be flashed, first hardware version information corresponding to the first software data to be flashed, and device information of the first device; If it is determined based on the device information of the first device that the first device is a first type of device, writing the first software data to be flashed into a first memory and a second memory, overwriting the first software data in the first memory and overwriting the second software data in the second memory; Matching the first hardware version information with the second hardware version information in the second memory; Corresponding to the matching of the first hardware version information and the second hardware version information in the second memory, determining the first software data to be flashed as target software data.
2. The method according to claim 1, wherein Including: The first memory includes a read-only memory, and the second memory includes a non-volatile memory.
3. The method according to claim 1, wherein Including: Both the first memory and the second memory have a page-turning function; When writing the first software data to be flashed into the first memory, execute the page-turning function of the first memory to overwrite the first software data in the first memory; When writing the first software data to be flashed into the second memory, execute the page-turning function of the second memory to overwrite the second software data in the second memory.
4. The method according to claim 1, wherein The method further includes: Corresponding to the non-matching of the first hardware version information and the second hardware version information in the second memory, Repeatedly execute obtaining first software data to be flashed, first hardware version information corresponding to the first software data to be flashed, and device information of the first device. If it is determined based on the device information of the first device that the first device is a first type of device, write the first software data to be flashed into a first memory and a second memory, and match the first hardware version information with the second hardware version information in the second memory until the first hardware version information and the second hardware version information in the second memory match.
5. The method according to claim 1, wherein The device information represents the stage where the device is located, and the first type of device is a device in the development stage.
6. A software flashing method, characterized in that Applied to a second device, the method includes: Obtaining second software data to be flashed, first hardware version information corresponding to the second data to be flashed, and device information of the second device; If it is determined based on the device information of the second device that the second device is a second type of device, write the second software data to be flashed into the first memory, overwriting the first software data in the first memory; Matching the second software data to be flashed in the first memory with the second software data in the second memory, and matching the first hardware version information with the second hardware version information in the second memory; Corresponding to the matching of the second software data to be flashed in the first memory with the second software data in the second memory, and the matching of the first hardware version information with the second hardware version information in the second memory, determining the second data to be flashed as target software data.
7. The method according to claim 6, characterized in that Including: The first memory includes a read-only memory, and the second memory includes a non-volatile memory.
8. The method according to claim 6, characterized in that, Including: The first memory has a page turning function; When writing the second software data to be flashed into the first memory, the first memory executes the page turning function to overwrite the first software data in the first memory.
9. The method according to claim 6, wherein The method further includes: Corresponding to the mismatch between the second software data to be flashed in the first memory and the second software data in the second memory, and the mismatch between the first hardware version information and the second hardware version information in the second memory, Repeatedly obtain the second software data to be flashed, the first hardware version information corresponding to the second data to be flashed, and the device information of the second device. If it is determined that the second device is a second type of device based on the device information of the second device, match the second software data to be flashed in the first memory with the second software data in the second memory, and match the first hardware version information with the second hardware version information in the second memory until the second software data to be flashed in the first memory matches the second software data in the second memory, and the first hardware version information matches the second hardware version information in the second memory.
10. The method according to claim 6, characterized in that, The device identifier represents the stage where the device is located, and the second type of device is a device in the mass production stage.
11. An electronic device, characterized in that, Including: A memory for storing instructions executed by one or more processors of the electronic device, and a processor, which is one of the one or more processors of the electronic device, for executing the data flashing method according to any one of claims 1-10.
12. A readable storage medium, characterized in that, Instructions are stored on the readable storage medium, and when the instructions are executed on the electronic device, the electronic device executes the data flashing method according to any one of claims 1-10.