CN117215604A - Software updating method and device, vehicle controller and readable storage medium - Google Patents

Software updating method and device, vehicle controller and readable storage medium Download PDF

Info

Publication number
CN117215604A
CN117215604A CN202210621042.1A CN202210621042A CN117215604A CN 117215604 A CN117215604 A CN 117215604A CN 202210621042 A CN202210621042 A CN 202210621042A CN 117215604 A CN117215604 A CN 117215604A
Authority
CN
China
Prior art keywords
address
software
check
loading
updated
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210621042.1A
Other languages
Chinese (zh)
Inventor
于广
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Haomo Zhixing Technology Co Ltd
Original Assignee
Haomo Zhixing Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Haomo Zhixing Technology Co Ltd filed Critical Haomo Zhixing Technology Co Ltd
Priority to CN202210621042.1A priority Critical patent/CN117215604A/en
Publication of CN117215604A publication Critical patent/CN117215604A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a software updating method, a device, a vehicle controller and a readable storage medium, which can update guide software in the vehicle controller by installing automatic updating software in the vehicle controller and can avoid the situation of damage to the vehicle controller caused by accidental interruption of the updating process, thus providing a high-reliability guide software updating method, reducing the operation complexity of updating the guide software and improving the reliability of updating the guide software.

Description

Software updating method and device, vehicle controller and readable storage medium
Technical Field
The present invention relates to the field of automotive technologies, and in particular, to a software updating method and apparatus, a vehicle controller, and a readable storage medium.
Background
With the advancement of technology, the types and numbers of controllers included in vehicles are increasing, and in the development and calibration stage of the vehicles, the boot software in each controller is often required to be updated.
In the related art, in order to update the guiding software in the controller, the controller needs to be removed from the bus network of the vehicle, the shell of the controller is opened to expose the circuit board therein, the special controller is directly connected with the circuit board of the controller through the brushing tool, the guiding software of the controller is updated through the brushing tool, and the controller shell is reloaded after the updating is completed.
However, in the method for updating the boot software, the controller needs to be disassembled and assembled, which is not only cumbersome to operate, but also easy to damage.
Disclosure of Invention
In view of the above, the present invention is directed to a software updating method, a device, a vehicle controller and a readable storage medium, so as to solve the problems that the operation of writing the boot software in the vehicle controller is complicated and the controller is easy to be damaged in the prior art.
In order to achieve the above purpose, the technical scheme of the invention is realized as follows:
a software update method applied to a vehicle controller, the method comprising:
receiving automatic updating software, storing the automatic updating software in a second loading address, and erasing first check data in a first check address corresponding to a first loading address;
updating the software to be updated in the first loading address by running the automatic updating software, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed;
when the vehicle controller is restarted, if the first check data in the first check address is determined to not pass the verification, determining that the updating operation of the software to be updated is not completed, continuously running the automatic updating software in the second loading address to update the software to be updated in the first loading address, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed;
When the vehicle controller is restarted, if the first verification data in the first verification address is confirmed to pass verification, the updating operation of the software to be updated in the first loading address is confirmed to be completed, and the updated software to be updated in the first loading address is operated.
A software updating apparatus, the apparatus comprising:
the receiving module is used for receiving automatic updating software, storing the automatic updating software in a second loading address and erasing first check data in a first check address corresponding to the first loading address;
the operation module is used for updating the software to be updated in the first loading address by operating the automatic updating software, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed;
the first loading module is used for determining that the updating operation of the software to be updated is not completed if the first check data in the first check address is determined to not pass the verification when the vehicle controller is restarted, continuously running the automatic updating software in the second loading address to update the software to be updated in the first loading address, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed;
And the second loading module is used for determining that the updating operation of the software to be updated in the first loading address is completed and running the updated software to be updated in the first loading address if the first verification data in the first verification address is determined to pass the verification when the vehicle controller is restarted.
A vehicle controller comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the software update method described above when executing the computer program.
A readable storage medium having stored thereon a program or instructions which when executed by a processor implement the software update method described above.
A vehicle comprises the vehicle controller.
Compared with the prior art, the software updating method, the device, the vehicle controller and the readable storage medium have the following advantages:
in summary, an embodiment of the present invention provides a software updating method, including: receiving automatic updating software, storing the automatic updating software in a second loading address, and erasing first check data in a first check address corresponding to the first loading address; updating the software to be updated stored in the first loading address into updated software to be updated by running automatic updating software, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed; when the vehicle controller is restarted, if the first check data in the first check address is determined to not pass the verification, the update operation for the software to be updated is determined to be incomplete, the automatic update software in the second loading address is continuously operated to update the software to be updated stored in the first loading address into updated software to be updated, and the first check data in the first check address corresponding to the first loading address is recovered after the update is completed; when the vehicle controller is restarted, if the first verification data in the first verification address passes verification, the updating operation of updating the software to be updated stored in the first loading address into the updated software to be updated is determined to be completed, and the updated software to be updated in the first loading address is operated. In the embodiment of the invention, the guide software in the vehicle controller can be updated by installing the automatic update software in the vehicle controller, and the condition that the vehicle controller is damaged due to accidental interruption of the update process can be avoided, so that the guide software update method with high reliability is provided, the operation complexity of updating the guide software is reduced, and the reliability of updating the guide software is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention. In the drawings:
FIG. 1 is a flowchart of a software update method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of another software updating method according to an embodiment of the present invention;
FIG. 3 is a flowchart of a software update method according to an embodiment of the present invention
Fig. 4 is a block diagram of a software updating apparatus according to an embodiment of the present invention.
Detailed Description
It should be noted that, without conflict, the embodiments of the present invention and features of the embodiments may be combined with each other.
The invention will be described in detail below with reference to the drawings in connection with embodiments.
Referring to fig. 1, a flowchart of steps of a software updating method according to an embodiment of the present invention is shown.
Step 101, receiving automatic update software, storing the automatic update software in a second loading address, and erasing first check data in a first check address.
In the stages of vehicle development, matching, adjustment and the like, controllers provided by suppliers of vehicle parts have various problems in the vehicle test process, and in places where development requirements cannot be met, applications carried on the controllers need to be adjusted to adapt to vehicles under development.
To update the applications onboard the controller, it is typically possible to re-write them by bootstrapping software (e.g. Bootloader) based on controller area network (Controller Area Network, CAN) or ethernet control automation technology (Ethernet Control Automation Technology, etherCAT). However, the boot software for the flashing application may also have some bugs or be in place where it is not practical, and the boot software itself needs to be flashed to update it. However, due to authority setting, interface setting and other reasons, the boot software cannot be updated from an external interface (such as a bus interface) of the controller, for some controllers which are difficult to update the boot software, a new controller is generally required to be directly replaced, for some controllers which can update the boot software, the controller is generally required to be disassembled to expose a main board, and then the main board is connected with a special debugger to re-brush the boot software. Some controllers, such as BATTERY management system (BATTERY MANAGEMENT SYSTEM, BMS), are time consuming and labor intensive to disassemble and replace.
In the embodiment of the invention, when the guiding software in the vehicle controller needs to be updated, the vehicle controller can be removed from the vehicle controller network and is connected with the application installation terminal through the bus interface of the vehicle controller, the automatic updating software is written into the vehicle controller, and the guiding software in the vehicle controller is updated through the automatic updating software running in the vehicle controller. The application installation terminal is used for installing an executable application program in the vehicle controller.
Specifically, after the vehicle controller receives the automatic update software, the automatic update software may be stored in a second loading address, where the second loading address is used to indicate a block of storage space in the memory of the vehicle controller, and storing the automatic update software in the second loading address refers to storing the automatic update software in the storage space in the memory indicated by the second loading address.
Because in the embodiment of the invention, the updatable software includes the software at the lower layer in the vehicle controller, such as the boot software, if the boot software is damaged in the updating process (for example, the boot software is in an unavailable state because the vehicle controller is suddenly powered off in the updating process), the vehicle controller may be damaged and cannot be used continuously. Therefore, by storing the automatic updating software in the second loading address, the automatic updating program can be continuously started from the second loading address to continuously update the guiding software in the vehicle controller under the condition that the subsequent updating is not completed until the guiding software is successfully updated, and the damage to the vehicle controller caused by accidents in the updating process is avoided.
In the embodiment of the invention, after the automatic update software is stored in the second loading address, the first check data in the first check address corresponding to the first loading address can be erased. When the vehicle controller is started and loads software, verification data corresponding to each loading address can be verified according to the sequence of the loading addresses, and the software in the loading address corresponding to the verification data which passes verification first is loaded.
For example, if the vehicle controller includes a first loading address and a second loading address, after the vehicle controller is started, the vehicle controller will first try to run the software in the first loading address, and if the first verification data in the first verification address corresponding to the first loading address is complete, the software in the first loading address is run, so as to complete the starting process of the vehicle controller. However, if the first check data in the first check address corresponding to the first loading address is not complete in the process of attempting to run the software in the first loading address, loading the software in the first loading address fails, and continuing to attempt to run the software in the second loading address.
Therefore, in the embodiment of the invention, if the first check data in the first check address corresponding to the first loading address is erased, the integrity of the first check data in the first check address is destroyed, and when the vehicle controller is restarted, the first check data in the first check address is incomplete and cannot pass the verification, the software to be updated stored in the first loading address is not loaded, but the automatic update software in the second loading address is tried to be loaded, and the software to be updated is continuously updated.
It should be noted that, the software to be updated in the embodiment of the present invention may be boot software, a start program, a baseband program, firmware, etc. in the vehicle controller.
And 102, updating the software to be updated in the first loading address by running the automatic updating software, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed.
In the embodiment of the invention, since the software to be updated can be the bottom software (such as the boot software) of the vehicle controller, when the bottom software is damaged, the damage to the vehicle controller is easily caused, and the vehicle controller cannot be used continuously. Therefore, before the software to be updated stored in the first loading address is actually updated by the automatic updating software, the related operation in step 101 may be performed, so as to ensure that, in the process that the automatic updating software actually updates the software to be updated stored in the first loading address, even if an unexpected situation (for example, sudden power-off of the controller) occurs, the software to be updated fails to be updated and cannot be operated, the automatic updating software may be reloaded and operated after the vehicle controller is restarted to retry to complete the updating of the software to be updated, so that the situation that the vehicle controller is damaged due to the failure of updating is thoroughly avoided.
Specifically, the specific operation of updating the software to be updated stored in the first loading address may be: the software to be updated stored in the first loading address is updated into updated software to be updated. The updated data packet of the software to be updated can be stored in the automatic updating software, and the data packet is entered into the vehicle controller together with the automatic updating software when the automatic updating software is installed in the vehicle controller.
Since the vehicle controller is required to load and run the updated software to be updated from the first loading address when the vehicle controller is started after updating the software to be updated stored in the first loading address to the updated software to be updated, the first verification data in the first verification address corresponding to the first loading address can be restored to a state before the erasing step is executed in step 101 after updating the software to be updated stored in the first loading address to the updated software to be updated, so that the vehicle controller can verify that the first verification data in the first verification address corresponding to the first loading address passes when attempting to load the updated software to be updated in the first loading address.
Step 103, when the vehicle controller is restarted, if it is determined that the first verification data in the first verification address is not verified, it is determined that the update operation for the software to be updated is not completed, and the automatic update software in the second loading address is continuously operated to update the software to be updated in the first loading address.
In the embodiment of the invention, two conditions exist in the update operation of the software to be updated, one is that after the automatic update software is installed in the vehicle controller, the automatic update software runs and smoothly updates the software to be updated in the vehicle controller into the updated software to be updated, and the update of the software to be updated is completed.
Secondly, after the automatic updating software is installed in the vehicle controller, the vehicle controller fails to power down and the like before the automatic updating software completes updating of the software to be updated, so that the updating operation of the software to be updated is interrupted, and after the vehicle controller is restarted, the vehicle controller tries to run the software to be updated in the first loading address, but the automatic updating software in the second loading address is continuously loaded due to incomplete first checking data in the first checking address so as to continuously update the software to be updated after the updating is interrupted.
The vehicle controller can generally perform software loading operation during startup through a sequential loading mode, and in the sequential loading mode, the vehicle controller can verify the verification data corresponding to each loading address according to the sequence of a plurality of loading addresses and load software in the loading address corresponding to the verification data which passes the verification first. Therefore, in the embodiment of the invention, under the condition of erasing the first check data in the first check address corresponding to the first loading address, when the vehicle controller is started, the check of the first check data cannot be completed, and then the software in the first loading address cannot be loaded, at this time, the vehicle controller continues to load the software in the second loading address in sequence, namely, automatically updating the software, and the updating of the software to be updated in the vehicle controller is restarted.
It should be noted that, in the embodiment of the present invention, after the update is completed, the restoration of the first check data in the first check address corresponding to the first loading address is performed by the automatic update software running in the vehicle controller, and after the vehicle controller restarts and runs the automatic update software again, if the automatic update software completes the update of the software to be updated, the step of restoring the first check data in the first check address corresponding to the first loading address is performed, so that the updated software to be updated can be loaded and run by the vehicle controller smoothly.
Step 104, when the vehicle controller is restarted, if it is determined that the first verification data in the first verification address passes the verification, it is determined that the updating operation of updating the software to be updated in the first loading address is completed, and the updated software to be updated in the first loading address is operated.
When the automatic updating software updates the software to be updated stored in the first loading address into updated software to be updated (namely, the updating of the software to be updated is completed) and restores the first check data in the first check address corresponding to the first loading address, if the vehicle controller is restarted at the moment, the first check space corresponding to the first loading address has complete first check data, the first check data can pass the verification, and the updated software to be updated in the first storage space is subjected to actual loading action, so that the updated software to be updated is operated and the starting operation of the vehicle controller is completed.
It should be noted that, after the software to be updated is updated to the updated software to be updated, since the updated software to be updated only exists in the first loading address at this time and is not actually loaded and operated, the vehicle controller needs to be restarted, so that the vehicle controller loads and operates the updated software to be updated from the first loading address. Therefore, in the embodiment of the invention, after the updating is completed and the first check data in the first check address corresponding to the first loading address is recovered, the restarting operation of the vehicle controller is automatically triggered, so that the vehicle controller loads and runs the updated software to be updated from the first loading address.
In summary, an embodiment of the present invention provides a software updating method, including: receiving automatic updating software, storing the automatic updating software in a second loading address, and erasing first check data in a first check address corresponding to the first loading address; updating the software to be updated stored in the first loading address into updated software to be updated by running automatic updating software, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed; when the vehicle controller is restarted, if the first check data in the first check address is determined to not pass the verification, the update operation for the software to be updated is determined to be incomplete, the automatic update software in the second loading address is continuously operated to update the software to be updated stored in the first loading address into updated software to be updated, and the first check data in the first check address corresponding to the first loading address is recovered after the update is completed; when the vehicle controller is restarted, if the first verification data in the first verification address passes verification, the updating operation of updating the software to be updated stored in the first loading address into the updated software to be updated is determined to be completed, and the updated software to be updated in the first loading address is operated. In the embodiment of the invention, the guide software in the vehicle controller can be updated by installing the automatic update software in the vehicle controller, and the condition that the vehicle controller is damaged due to accidental interruption of the update process can be avoided, so that the guide software update method with high reliability is provided, the operation complexity of updating the guide software is reduced, and the reliability of updating the guide software is improved.
Referring to fig. 2, fig. 2 is a flowchart illustrating steps of another software updating method according to an embodiment of the present invention.
Step 201, configuring a software loading mode corresponding to a plurality of loading addresses into a sequential loading mode; the plurality of loading addresses at least comprise a first loading address and a second loading address, and the sequential loading mode is used for sequentially starting software in each loading address after the vehicle controller is started.
Because the vehicle controller may have multiple software loading modes, the current software loading mode may not meet the requirement of the software updating method of the present invention, and therefore, parameters in the vehicle controller may be configured before the automatic updating software is installed, so that the configuration parameters of the vehicle controller meet the operation requirement of the software updating method of the present invention.
Because of the variety of vehicle controllers, the configuration methods of each vehicle controller are not the same, and the software updating method provided by the embodiment of the invention is applicable to the vehicle controller with a sequential loading mode, and takes a micro control unit (Microcontroller Unit, MCU) TC27X of the Infrax Aurix series as an example of the vehicle controller for explanation.
First, it is necessary to configure a vehicle controller with four start tags (Boot Mode Header), which are BMHD0, BMHD1, BMHD2, and BMHD3, respectively. Each start tag contains 32 bytes. Wherein, the address of the 32-byte space preset by each start tag is as follows
Table 1 shows:
TABLE 1
By the start address and the end address of the start tag, the data in the start tag can be modified, so that the configuration of each start tag is adjusted. Where the H at the end of the address indicates that the address is 16.
In addition, the 32-byte space contained by the start tag corresponds to the configuration item shown in Table 2 below:
TABLE 2
The configuration items contained by each start tag may include: a usercodesettartaddress, a software load mode (BMI), a checkspace start address (ChkStart), a checkspace end address (chknend), and other related configuration items.
Specifically, a target address of a configuration item of each starting tag in a storage space can be determined according to a tag start address of the starting tag and an offset of the configuration item relative to the tag start address, and a software loading mode of each starting tag is matched into a sequential loading mode (Alternate Boot Mode) by modifying data in the target address, and in the sequential loading mode, after a vehicle controller is started, software in each loading address is started in sequence.
Step 202, storing first check data in a first check address corresponding to the first loading address, and storing second check data in a second check address corresponding to the second loading address.
After the software loading modes corresponding to the first loading address and the second loading address are configured into the sequential loading mode, the verification space starting address and the verification space ending address of the starting tag corresponding to each loading address are also required to be configured, so that the verification address corresponding to each loading address is obtained, wherein the verification address is used for storing the verification data corresponding to the loading address. And storing preset check data at each check address.
The first loading address can be configured to correspond to a verification space starting address and a verification space ending address in the starting tag to obtain a first verification address corresponding to the first loading address, and preset first verification data are stored in the first verification address.
The first check space start address and the check space end address in the start tag corresponding to the second loading address can be configured to obtain a second check address corresponding to the second loading address, and then preset second check data is stored in the second check address.
It should be noted that, the minimum loading address required for implementing the software updating method in the embodiment of the present invention includes a first loading address and a second loading address, so that the method only includes configuring the startup tags corresponding to the first loading address and the second loading address, and in the case that more loading addresses are included, the configuration method of the startup tag corresponding to the more loading addresses is the same as the configuration method of the startup tag corresponding to the second loading address, and the more loading addresses are used for storing the automatic updating software as the redundant addresses of the second loading address.
Step 203, receiving automatic update software, storing the automatic update software in a second loading address, and erasing first check data in a first check address corresponding to the first loading address.
And 204, updating the software to be updated in the first loading address by running the automatic updating software, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed.
Optionally, step 204 may further include:
in sub-step 2041, in case the update complete flag bit indicates an incomplete state, the software to be updated is erased from said first load address.
The automatic update software may further include an update completion flag, where the update completion flag may indicate whether the update of the software to be updated is completed, for example, the update completion flag may default to 0 in an initial state, that is, when the automatic update software is installed in the vehicle controller.
In addition, in order to secure the security of the data stored in the vehicle controller, some vehicle controllers are equipped with a Read-Only Memory (ROM) in which the software to be updated is stored, because of the specificity of the vehicle controller, in which case, in order to update the software to be updated to the updated software to be updated, the software to be updated needs to be erased from the first loading address.
And step 2042, writing the updated software to be updated into the first loading address, and adjusting the completion flag bit to a completion state.
After the software to be updated is erased, the updated software to be updated is written into the first loading address, and the updating of the software to be updated is completed. After the update is completed, the completion flag bit may be adjusted to a completion state and sent to the user to prompt the user that the software update is completed. For example, after the updated software to be updated is written, the completion flag bit may be adjusted to 1 and sent to the user.
It should be noted that, the update completion flag bit may also be used as a starting condition for automatically updating the software to be updated. For example, after the automatic update software is installed in the vehicle controller, the automatic update software is run, and when the update completion flag indicates that the update is not completed, the automatic update software performs the update step. If the updating process is interrupted accidentally, the automatic updating software runs again after restarting, and the updating completion flag bit is detected to indicate that the updating is not completed, the automatic updating process is started again.
Step 205, when the vehicle controller is restarted, if it is determined that the first check data in the first check address does not pass the verification, it is determined that the update operation for the software to be updated is not completed, the automatic update software in the second loading address is continuously operated to update the software to be updated in the first loading address, and the first check data in the first check address corresponding to the first loading address is recovered after the update is completed.
Optionally, step 205 may further include:
sub-step 2051, validating the second parity data stored in said second parity address.
In the embodiment of the invention, before running the software in the loading address, the vehicle controller needs to verify the stored verification data in the verification address corresponding to the loading address. In the above step, since the first check data in the first loading address corresponding to the first check data is deleted in the update process, if the update process is interrupted accidentally, the first check data in the first loading address is in an incomplete state, and cannot pass verification, the software in the first loading address will not be executed, but the verification of the second check data in the second check address is continued.
Sub-step 2052, in case the second parity data stored in the second parity address passes the verification, of starting the automatic updating software stored in the second loading address.
If the second checking data can pass the verification, executing the software stored in the second loading address corresponding to the second checking address, namely automatically updating the software, and continuously updating the software to be updated.
Sub-step 2053, in case the second parity data stored in the second parity address fails the verification, verifying the third parity data stored in the third parity address.
In this embodiment of the present invention, the vehicle controller may include more than two load addresses, in which case, a third load address other than the first load address and the second load address in all load addresses may be used as a redundant backup, where the third load address stores the automatic update software in the same way as the second load address, and when the automatic update software in the second load address cannot be started, an attempt is made to start the automatic update software in the third load address.
It should be noted that the third load address may be one load address or may be a plurality of load addresses. In order to avoid that the data in the second check address is destroyed to influence the execution of the software in the third loading address, the third check address and the second check address may be different, and the third check data and the second check data may be the same or different. In the case where the third load address includes a plurality of load addresses, the check data stored in the check address corresponding to each of the third load addresses may be the same or different.
Sub-step 2054, running the auto-update software stored in the third load address if the third check data stored in the third check address passes the check.
When the third load address includes a plurality of load addresses, checking the check data corresponding to each load address in the third load address in sequence, and running the software in the load address corresponding to the check data passing the first check.
Sub-step 2055, deleting the automatically updated software in the second load address and restarting the vehicle controller.
After the first check data in the first check address corresponding to the first loading address is recovered, the vehicle controller can be restarted automatically, so that the vehicle controller loads and runs the updated software to be updated in the first loading address.
In addition, since the vehicle controller may already run the updated software to be updated after the restart after recovering the first check data in the first check address corresponding to the first load address, that is, the update is completed for the software to be updated, in order to save the memory space consumption of the vehicle controller, the automatic update software in the second load address may also be deleted after recovering the first check data in the first check address corresponding to the first load address.
It should be noted that, in the embodiment of the present invention, the automatic update software in the second loading address may not be deleted, so that the automatic update software is kept in the second loading address for a long period after the update of the software to be updated is completed, and when the updated software to be updated in the first loading address cannot be loaded due to the hardware or software failure of the vehicle controller, the repair operation of the software in the first loading address may still be attempted by loading the automatic update software in the second loading address, so as to avoid the damage of the system when the updated software to be updated cannot be loaded.
Step 206, when the vehicle controller is restarted, if it is determined that the first verification data in the first verification address passes the verification, it is determined that the update operation of updating the software to be updated in the first loading address is completed, and the updated software to be updated in the first loading address is operated.
Optionally, step 206 further includes:
sub-step 2061, storing an initial check code corresponding to the first check data; and the initial check code is obtained by calculating the first check data through a preset algorithm.
In order to verify the first check data, a corresponding initial check code needs to be generated in advance according to the first check data, and the initial check code can be obtained by performing encryption calculation on the first check data through a preset encryption algorithm, for example, a CRC32 value corresponding to the first check data in the first check address can be calculated based on an IEEE 802.3 standard, and the CRC32 value and a reversal value corresponding to the CRC32 value are used as the initial check code corresponding to the first check data.
It should be noted that, the above process of configuring the initial check code may be completed when configuring the start tag corresponding to the first loading address.
Specifically, taking a micro control unit (Microcontroller Unit, MCU) TC27X of the Infraria Aurix series as an example of a vehicle controller, each start tag of the vehicle controller further includes a CRCrange Filed, andwherein CRCrage Filed is used for storing CRC32 value of first check data stored in the first check address corresponding to the starting tag, < ->And the inverting value is obtained by inverting the CRC32 value of the first check data stored in the first check address corresponding to the starting tag according to the bit. Wherein (1)>The upper bar is a reversing mark.
In step 2062, a target check code corresponding to the data stored in the first check address is calculated by the preset algorithm.
After the vehicle controller is started, reading data contained in a storage space indicated by the first check address, and calculating a CRC32 value corresponding to the data through a preset algorithm (such as IEEE 802.3 standard) to obtain a target check code containing the CRC32 value and a reversal value of the CRC32 value.
It should be noted that, the preset algorithm is not limited to IEEE 802.3 standard, and other algorithms may be used to calculate the CRC32 value of the first check data and the data in the first check address, which is not limited in this embodiment of the present invention.
Sub-step 2063, determining that the first check data stored in the first check address passes the check if the target check code matches the initial check code.
And comparing the CRC32 value in the target check code with the CRC32 value in the initial check code, if the two values are matched, continuously comparing the inverted value in the target check code with the inverted value in the initial check code, and if the comparison result shows that the two values are matched, determining that the first check data stored in the first check address passes the check.
In order to more clearly illustrate the software updating method provided by the embodiment of the present invention, referring to fig. 3, fig. 3 shows a flowchart of the software updating method provided by the embodiment of the present invention, as shown in fig. 3, a micro control unit (Microcontroller Unit, MCU) TC27X of the inflight Aurix series is taken as an example of a vehicle controller, and the vehicle controller performs step 301: starting up; step 302 is performed after power-on: judging whether the memory is started up in error, if yes, executing step 303: reporting error memory exception, if the judgment result is no, executing step 304: check the nth start tag (n is 0 in initial value) and execute step 305: judging that the nth start tag is valid, if the judgment result is no, executing step 306: determining whether n is equal to 3, if n is equal to 3, then step 307 is performed: reporting that all the start tags are invalid, if n is not equal to 3, then step 308 is performed: enter the next start tag (add 1 to n), and go back to step 304 to continue execution, if the n-th start tag is valid, then step 309 is executed: determining whether n is equal to 0, if n is equal to 0, then step 310 is performed: loading boot software (since n=0 corresponds to the first boot tag, i.e. to the first load address in the first boot tag, the boot software is stored by default in the first load address); after the boot software is loaded, the vehicle controller is started, and at this time, the automatic update software may be installed to the vehicle controller, and after the automatic update software is installed, the vehicle controller executes step 311: starting automatic updating software; step 312 is performed after the automatic update software is started: judging whether the update completion flag is not complete, if the completion flag indicates that the update has been completed, executing step 318: ending the update flow, if the completion flag bit indicates that the update is not complete, then step 313 is performed: erasing first check data in the first check address; after erasing the first verification data, step 314 is performed: erasing the boot software in the first loading address; step 315 is performed after the boot software is erased: writing updated boot software in the first loading address, namely updating the software to be updated into updated software to be updated; step 316 is performed after the updated boot software is written: restoring the first check data in the first check address; after recovering the first check data, step 317 is performed: setting the update completion flag bit to an update completion state; finally, step 318 is entered: and ending the updating flow.
It should be noted that, after the execution of the completion step 313 and before the execution of the completion step 316, if the update is interrupted due to a fault such as an unexpected power failure of the vehicle controller, the execution will be resumed from the step 301, because in the embodiment of the present invention, the automatic update is written into the other loading addresses except the first loading address when the automatic update is installed, and the first verification data in the first verification address has been erased in the step 313, the boot software cannot be loaded through the first loading address after the execution is resumed from the step 301, but the automatic update is loaded through the other loading addresses, and the execution is continued from the step 311.
In summary, the embodiment of the invention provides another software updating method, which comprises the following steps: receiving automatic updating software, storing the automatic updating software in a second loading address, and erasing first check data in a first check address corresponding to the first loading address; updating the software to be updated stored in the first loading address into updated software to be updated by running automatic updating software, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed; when the vehicle controller is restarted, if the first check data in the first check address is determined to not pass the verification, the update operation for the software to be updated is determined to be incomplete, the automatic update software in the second loading address is continuously operated to update the software to be updated stored in the first loading address into updated software to be updated, and the first check data in the first check address corresponding to the first loading address is recovered after the update is completed; when the vehicle controller is restarted, if the first verification data in the first verification address passes verification, the updating operation of updating the software to be updated stored in the first loading address into the updated software to be updated is determined to be completed, and the updated software to be updated in the first loading address is operated. In the embodiment of the invention, the guide software in the vehicle controller can be updated by installing the automatic update software in the vehicle controller, and the condition that the vehicle controller is damaged due to accidental interruption of the update process can be avoided, so that the guide software update method with high reliability is provided, the operation complexity of updating the guide software is reduced, and the reliability of updating the guide software is improved.
On the basis of the embodiment, the embodiment of the invention also provides a software updating device.
Referring to fig. 4, fig. 4 shows a block diagram of a software updating apparatus according to an embodiment of the present invention:
a receiving module 401, configured to receive automatic update software, store the automatic update software in a second loading address, and erase first check data in a first check address corresponding to the first loading address;
an operation module 402, configured to update software to be updated in the first load address by operating the automatic update software, and restore first check data in a first check address corresponding to the first load address after the update is completed;
a first loading module 403, configured to, when the vehicle controller is restarted, determine that the update operation for the software to be updated is not completed if it is determined that the first check data in the first check address does not pass the verification, continue to run the automatic update software in the second loading address to update the software to be updated in the first loading address, and restore the first check data in the first check address corresponding to the first loading address after the update is completed;
And the second loading module 404 is configured to determine that the updating operation of the software to be updated in the first loading address is completed if it is determined that the first verification data in the first verification address passes the verification when the vehicle controller is restarted, and run the updated software to be updated in the first loading address.
Optionally, the apparatus further includes:
the configuration sub-module is used for configuring the software loading modes corresponding to the loading addresses into a sequential loading mode; the plurality of loading addresses at least comprise a first loading address and a second loading address, and the sequential loading mode is used for sequentially starting software in each loading address after the vehicle controller is started;
and the check storage sub-module is used for storing the first check data in a first check address corresponding to the first loading address and storing the second check data in a second check address corresponding to the second loading address.
Optionally, the operation module includes:
the erasing sub-module is used for erasing the software to be updated from the first loading address under the condition that the update completion flag bit indicates an incomplete state;
and the writing sub-module is used for writing the updated software to be updated into the first loading address and adjusting the completion zone bit into a completion state.
Optionally, the first loading module includes:
a verification sub-module for verifying the second verification data stored in the second verification address;
and the promoter module is used for starting the automatic updating software stored in the second loading address under the condition that the second check data stored in the second check address passes the check.
Optionally, the apparatus further includes:
the initial check sub-module is used for storing an initial check code corresponding to the first check data; the initial check code is obtained by calculating the first check data through a preset algorithm;
the target check sub-module is used for calculating a target check code corresponding to the data stored in the first check address through the preset algorithm;
and the verification sub-module is used for determining that the first verification data stored in the first verification address passes verification under the condition that the target verification code is matched with the initial verification code.
Optionally, the apparatus further includes:
the redundancy sub-module is used for storing third check data in a third check address corresponding to the third loading address and storing the automatic updating software in the third loading address;
A redundancy check sub-module that verifies the third check data stored in the third check address in the case where the second check data stored in the second check address fails to pass the check;
and the redundant operation sub-module is used for operating the automatic updating software stored in the third loading address under the condition that the third check data stored in the third check address passes the check.
Optionally, the apparatus further includes:
and the post-processing sub-module is used for deleting the automatic updating software in the second loading address after recovering the first check data in the first check address corresponding to the first loading address, and restarting the vehicle controller.
In summary, an embodiment of the present invention provides a software updating apparatus, including: receiving automatic updating software, storing the automatic updating software in a second loading address, and erasing first check data in a first check address corresponding to the first loading address; updating the software to be updated stored in the first loading address into updated software to be updated by running automatic updating software, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed; when the vehicle controller is restarted, if the first check data in the first check address is determined to not pass the verification, the update operation for the software to be updated is determined to be incomplete, the automatic update software in the second loading address is continuously operated to update the software to be updated stored in the first loading address into updated software to be updated, and the first check data in the first check address corresponding to the first loading address is recovered after the update is completed; when the vehicle controller is restarted, if the first verification data in the first verification address passes verification, the updating operation of updating the software to be updated stored in the first loading address into the updated software to be updated is determined to be completed, and the updated software to be updated in the first loading address is operated. In the embodiment of the invention, the guide software in the vehicle controller can be updated by installing the automatic update software in the vehicle controller, and the condition that the vehicle controller is damaged due to accidental interruption of the update process can be avoided, so that the guide software update method with high reliability is provided, the operation complexity of updating the guide software is reduced, and the reliability of updating the guide software is improved.
The embodiment of the invention also provides a vehicle controller, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, and is characterized in that the processor executes the software updating method.
The embodiment of the invention also provides a vehicle, which comprises the vehicle controller.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing apparatus embodiments, and are not repeated herein.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, and alternatives falling within the spirit and principles of the invention.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (10)

1. A software updating method, applied to a vehicle controller, comprising:
receiving automatic updating software, storing the automatic updating software in a second loading address, and erasing first check data in a first check address corresponding to a first loading address;
updating the software to be updated in the first loading address by running the automatic updating software, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed;
when the vehicle controller is restarted, if the first check data in the first check address is determined to not pass the verification, determining that the updating operation of the software to be updated is not completed, continuously running the automatic updating software in the second loading address to update the software to be updated in the first loading address, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed;
when the vehicle controller is restarted, if the first verification data in the first verification address is confirmed to pass verification, the updating operation of the software to be updated in the first loading address is confirmed to be completed, and the updated software to be updated in the first loading address is operated.
2. The method of claim 1, wherein prior to the running the automatic update software, the method further comprises:
configuring a software loading mode corresponding to the plurality of loading addresses into a sequential loading mode; the plurality of loading addresses at least comprise a first loading address and a second loading address, and the sequential loading mode is used for sequentially starting software in each loading address after the vehicle controller is started;
storing first check data in a first check address corresponding to the first loading address, and storing second check data in a second check address corresponding to the second loading address.
3. The method of claim 1, wherein the updating the software to be updated in the first load address comprises:
under the condition that the update completion flag bit indicates an incomplete state, erasing software to be updated from the first loading address;
writing the updated software to be updated into the first loading address, and adjusting the completion flag bit to be in a completion state.
4. The method of claim 2, wherein the continuing to run the automatically updated software in the second load address comprises:
Verifying second verification data stored in the second verification address;
and under the condition that the second check data stored in the second check address passes the check, starting the automatic updating software stored in the second loading address.
5. The method according to claim 1, wherein the method further comprises:
storing an initial check code corresponding to the first check data; the initial check code is obtained by calculating the first check data through a preset algorithm;
calculating a target check code corresponding to the data stored in the first check address through the preset algorithm;
and under the condition that the target check code is matched with the initial check code, determining that the first check data stored in the first check address passes the check.
6. The method of claim 2, wherein the memory space further comprises a third load address corresponding to a third check address, the method further comprising:
storing third check data in a third check address corresponding to the third loading address, and storing the automatic updating software in the third loading address;
verifying the third verification data stored in the third verification address in case the second verification data stored in the second verification address fails verification;
And under the condition that the third check data stored in the third check address passes the check, running the automatic updating software stored in the third loading address.
7. The method of claim 1, wherein after recovering the first check data in the first check address corresponding to the first load address, the method further comprises:
and deleting the automatic updating software in the second loading address, and restarting the vehicle controller.
8. A software updating apparatus, the apparatus comprising:
the receiving module is used for receiving automatic updating software, storing the automatic updating software in a second loading address and erasing first check data in a first check address corresponding to the first loading address;
the operation module is used for updating the software to be updated in the first loading address by operating the automatic updating software, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed;
the first loading module is used for determining that the updating operation of the software to be updated is not completed if the first check data in the first check address is determined to not pass the verification when the vehicle controller is restarted, continuously running the automatic updating software in the second loading address to update the software to be updated in the first loading address, and recovering the first check data in the first check address corresponding to the first loading address after the updating is completed;
And the second loading module is used for determining that the updating operation of the software to be updated in the first loading address is completed and running the updated software to be updated in the first loading address if the first verification data in the first verification address is determined to pass the verification when the vehicle controller is restarted.
9. A vehicle controller comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the software update method according to any one of claims 1 to 7 when executing the computer program.
10. A readable storage medium having stored thereon a program or instructions which when executed by a processor implements the software update method of any of claims 1 to 7.
CN202210621042.1A 2022-06-02 2022-06-02 Software updating method and device, vehicle controller and readable storage medium Pending CN117215604A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210621042.1A CN117215604A (en) 2022-06-02 2022-06-02 Software updating method and device, vehicle controller and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210621042.1A CN117215604A (en) 2022-06-02 2022-06-02 Software updating method and device, vehicle controller and readable storage medium

Publications (1)

Publication Number Publication Date
CN117215604A true CN117215604A (en) 2023-12-12

Family

ID=89044890

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210621042.1A Pending CN117215604A (en) 2022-06-02 2022-06-02 Software updating method and device, vehicle controller and readable storage medium

Country Status (1)

Country Link
CN (1) CN117215604A (en)

Similar Documents

Publication Publication Date Title
TWI384367B (en) System of updating firmware and method thereof
US11163886B2 (en) Information handling system firmware bit error detection and correction
CN106775610B (en) Electronic equipment starting method and electronic equipment
US7689981B1 (en) Mobile handset with efficient interruption point detection during a multiple-pass update process
CN101329631A (en) Method and apparatus for automatically detecting and recovering start-up of embedded system
CN111552592A (en) Double-backup starting method and system
CN111182033B (en) Method and equipment for restoring switch
CN109634781B (en) Double-area backup image system based on embedded program and starting method
CN112433769A (en) BMC starting method and device, computer equipment and storage medium
CN108345464A (en) A kind of the startup method and Android vehicle device of Android system
CN113157303A (en) Upgrading method, embedded system, terminal and computer storage medium
CN105183580A (en) Storage method and fault recovery method for bootstrap program, and devices
CN111273928B (en) Bootloader design method for self-upgrading
CN117608627A (en) Method for upgrading firmware, electronic device and storage medium
JP2005284902A (en) Terminal device, control method and control program thereof, host device, control method and control program thereof, and method, system, and program for remote updating
CN116909611A (en) Electronic device firmware updating method, cleaning device and storage medium
CN113377425B (en) BMC firmware generation method and device, BMC starting method and device and storage medium
CN112579338B (en) Starting method and system of equipment and storage medium
CN117215604A (en) Software updating method and device, vehicle controller and readable storage medium
CN113176891B (en) Bootloader-based ECU (electronic control Unit) program programming method with backup function
CN106325912B (en) The starting method and device of embedded OS
US9529581B2 (en) Circuit and method for writing program codes of basic input/output system
CN114741091A (en) Firmware loading method and device, electronic equipment and computer readable storage medium
WO2019064644A1 (en) Electronic control device and control program verification method
CN114356658A (en) Processing method of firmware upgrading exception, computer equipment and readable storage medium

Legal Events

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