Program flashing method, device, computer equipment and medium for vehicle body controller
By setting multiple Flash memory areas and ROM memory areas in the body controller, and using multiple security checksum Bootloader boot program jump mechanism, the crash problem caused by accidental interruption during body controller update is solved, ensuring the program The integrity and stability of the brushing process.
Patent Information
- Application Number
- CN202111588261.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-12-23
AI Technical Summary
In the prior art, the body controller is prone to accidental interruption during the Bootloader update application process, causing the controller to "brick" to crash, and lacks an effective verification mechanism to ensure the integrity of the program flashing process.
By setting multiple Flash memory areas and ROM memory areas in the body controller, the multiple security checksum Bootloader boot program jump mechanism is used to ensure that even if the secondary verification fails during the program flashing process, it can be redirected to Back up user programs to avoid crashes caused by accidental interrupts.
It can ensure the integrity of the original user program when any verification failure occurs, avoiding the controller "bricking" crash caused by unexpected interrupts during program flushing, and improving the reliability and stability of program updates.
Smart Images

Figure CN114296819B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to vehicle body controller technology, and more particularly to a vehicle body controller program flashing method, device, computer equipment and medium. Background Art
[0002] As the degree of electrification of unmanned logistics vehicles increases, vulnerabilities will inevitably exist in the different controller applications in the vehicle. Generally, the Bootloader software is used through the vehicle CAN network to update the application software code in the body controller.
[0003] In the prior art, there is a risk of bricking the controller due to an unexpected interruption of the body controller during the process of updating the application by the Bootloader. Summary of the invention
[0004] The present invention provides a method, device, computer equipment and medium for flashing a program of a vehicle body controller, which ensures the integrity of the original user program when any verification failure occurs during the program flashing process, thereby avoiding the controller becoming "bricked" and freezing due to accidental interruption of the program flashing process.
[0005] In a first aspect, an embodiment of the present invention provides a method for flashing a program of a vehicle body controller; the vehicle body controller includes a ROM memory area and a Flash memory area; the Flash memory area includes a first Flash memory area, a second Flash memory area, a third Flash memory area and a fourth Flash memory area; a Bootloader boot program is solidified in the first Flash memory area; a user program is stored in the second Flash memory area; the user program is stored in the third Flash memory area; and a flag upgrade bit is stored in the fourth Flash memory area; the method for flashing a program includes:
[0006] Entering an upgrade state of executing the user program according to the flag upgrade bit;
[0007] Receive a data file sent by the host computer, and send the data file to the ROM memory area;
[0008] Perform a security check on the data files in the ROM memory area;
[0009] If the one-time security check succeeds, the user program in the second Flash area is erased according to the erase instruction of the host computer, and the data file is sent from the ROM memory area to the second Flash memory;
[0010] Performing a secondary security check on the data file in the second Flash memory;
[0011] If the secondary security check succeeds, the user program in the third Flash memory area is erased according to the erase instruction of the host computer, and the data file is sent from the second Flash memory area to the third Flash memory area; if the secondary security check fails, the execution of the Bootloader program jumps to the execution of the user program in the third Flash memory area;
[0012] Performing three security checks on the data files in the third Flash memory area;
[0013] If the three security checks are successful, the execution of the Bootloader program jumps to the execution of the data file in the third Flash memory area to complete the program flashing.
[0014] Optionally, the fourth Flash memory area further stores a flag status bit; after performing a security check on the data file in the ROM memory area, the method further includes:
[0015] If the primary security check fails, determining the flag status bit;
[0016] If the flag status bit is the first flag status bit, the execution of the Bootloader program jumps to the execution of the user program in the second Flash memory area;
[0017] If the flag status bit is the second flag status bit, the execution of the Bootloader program jumps to the execution of the user program in the third Flash memory area.
[0018] Optionally, after performing three security checks on the data files in the third Flash memory area, the method further includes:
[0019] If the three security checks fail, the execution of the Bootloader program jumps to the execution of the user program in the second Flash memory area.
[0020] Optionally, a security check is performed on the data files in the ROM memory area, including:
[0021] Receive a check code obtained by the host computer performing a CRC-16 check on the data file;
[0022] Performing the CRC-16 check on the data file received in the ROM memory area to obtain a first check result;
[0023] A security check is performed on the data file in the ROM memory area according to the first check result and the check code.
[0024] Optionally, performing a secondary security check on the data files in the second Flash memory area includes:
[0025] Performing the CRC-16 check on the data file in the second Flash memory area to obtain a second check result;
[0026] Performing a secondary security check on the data files in the second Flash memory area according to the first check result and the second check result;
[0027] Perform three security checks on the data files in the third Flash memory area, including:
[0028] Performing the CRC-16 check on the data file in the third Flash memory area to obtain a third check result;
[0029] Perform three security checks on the data files in the third Flash memory area according to the second check result and the third check result.
[0030] Optionally, before receiving a data file sent by a host computer and sending the data file to the ROM memory area, the method further includes:
[0031] Different identifiers are sent to the host computer via the CAN network.
[0032] Optionally, after executing the Bootloader program and jumping to executing the data file in the third Flash memory area to complete the program flashing, the method further includes:
[0033] Output a flag upgrade bit, and store the flag upgrade bit in the fourth Flash memory area.
[0034] In a second aspect, an embodiment of the present invention further provides a program flashing module for a vehicle body controller, the program flashing module comprising:
[0035] The upgrade state entry module is used to enter the upgrade state of executing the user program according to the flag upgrade bit;
[0036] The first data file sending module is used to receive the data file sent by the host computer and send the data file to the ROM memory area;
[0037] A primary security check module, used for performing a primary security check on the data files in the ROM memory area;
[0038] A second data file sending module, used for erasing the user program in the second Flash memory area according to the erase instruction of the host computer when the first security check is successful, and sending the data file from the ROM memory area to the second Flash memory area;
[0039] A secondary security verification module, used for performing a secondary security verification on the data files in the second Flash memory area;
[0040] A third data file sending module, used for erasing the user program in the third Flash memory area according to the erase instruction of the host computer when the secondary security check is successful, and sending the data file from the second Flash memory area to the third Flash memory area;
[0041] A jump execution module, used for jumping from executing the Bootloader to executing the user program in the third Flash memory area when the secondary security check fails;
[0042] A secondary security check module, used for performing a third security check on the data files in the third Flash memory area;
[0043] The program flashing module is used to jump from executing the Bootloader to executing the data file in the third Flash memory area to complete the program flashing when the three security checks are successful.
[0044] In a third aspect, an embodiment of the present invention further provides a computer device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a method for flashing a program of a vehicle body controller as described in any one of the first aspects above.
[0045] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for flashing a program of a vehicle body controller as described in any one of the first aspects.
[0046] The embodiment of the present invention enters the upgrade state of executing the user program according to the flag upgrade bit; receives the data file sent by the host computer, and sends the data file to the ROM memory area; performs a security check on the data file in the ROM memory area; if the first security check is successful, erases the user program in the second Flash memory area according to the erase instruction of the host computer, and sends the data file from the ROM memory area to the second Flash memory area; performs a secondary security check on the data file in the second Flash memory area; if the secondary security check is successful, erases the user program in the third Flash memory area according to the erase instruction of the host computer, and sends the data file from the second Flash memory area to the third Flash memory area. In the third Flash memory area; if the secondary security check fails, the Bootloader will jump to the user program in the third Flash memory area; the data files in the third Flash memory area are security checked three times; if the three security checks are successful, the Bootloader will jump to the data files in the third Flash memory area to complete the program flashing. In this way, the ROM memory area, the second Flash memory area and the third Flash memory area are used to ensure the integrity of the original user program if the secondary check fails during the program flashing process, thereby avoiding the controller "bricking" and freezing caused by accidental interruption of the program flashing process. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a flow chart of a method for flashing a program of a vehicle body controller provided by an embodiment of the present invention;
[0048] Figure 2 is a flow chart of another method for flashing a program of a vehicle body controller provided by an embodiment of the present invention;
[0049] Figure 3 It is a structural block diagram of a program flashing device for a vehicle body controller provided by an embodiment of the present invention;
[0050] Figure 4 It is a structural schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0052] Figure 1is a flow chart of a method for flashing a program of a vehicle body controller provided by an embodiment of the present invention. This embodiment is applicable to flashing a program of a vehicle body controller. The method can be executed by a flashing device for flashing a program of a vehicle body controller, such as Figure 1 As shown, the program flashing method specifically includes the following steps:
[0053] S110, entering the upgrade state of executing the user program according to the flag upgrade bit.
[0054] Among them, the body controller includes a ROM memory area and a Flash memory area; the Flash memory area includes a first Flash memory area, a second Flash memory area, a third Flash memory area and a fourth Flash memory area; the Bootloader is solidified in the first Flash memory area; the user program is stored in the second Flash memory area; the user program is stored in the third Flash memory area; the fourth Flash memory area stores the upgrade flag bit; if the upgrade flag bit is not empty, the user program has completed the update work; if the upgrade flag bit is empty, the user program has not completed the update work, and the user program is in a waiting for upgrade state; in this embodiment, when the upgrade flag bit is not empty, the Bootloader control enters the upgrade state of executing the user program. At the same time, the Bootloader completes the handshake action with the host computer through the CAN communication network.
[0055] S120, receiving the data file sent by the host computer, and sending the data file to the ROM memory area.
[0056] Among them, when the Bootloader completes the handshake action with the host computer through the CAN communication network, the Bootloader enters the data receiving mode, receives the data file sent by the host computer, and temporarily caches the data file in the ROM memory area.
[0057] S130, performing a security check on the data files in the ROM memory area.
[0058] Among them, the host computer performs CRC-16 check on the data file to obtain a check code, and sends the check code to the body controller. The Bootloader in the body controller receives the check code sent by the host computer, and at the same time performs CRC-16 check on the data file received in the ROM memory area to obtain a first check result; then when the first check result is consistent with the check code, a security check is completed on the data file in the ROM memory area.
[0059] S140: If a security check succeeds, the user program in the second Flash memory area is erased according to the erase instruction of the host computer, and the data file is sent from the ROM memory area to the second Flash memory area.
[0060] Among them, when the first verification result and the verification code are consistent, the data file sent by the host computer to the ROM memory area is not lost, and a security verification is successful, ensuring the integrity of the data file sent by the host computer to the ROM memory area; then the Bootloader boot program replies to the host computer, the host computer sends an erase command, and the Bootloader boot program erases the user program in the second Flash memory area according to the erase instruction of the host computer, and sends the data file from the ROM memory area to the second Flash memory area.
[0061] S150: Perform a secondary security check on the data files in the second Flash memory area.
[0062] Among them, in order to ensure the integrity of the data files sent to the second Flash memory area, the Bootloader boot program performs a secondary security check on the data files in the second Flash memory area; specifically, the data files in the second Flash memory area are subjected to a CRC-16 check to obtain a second check result; then the second check result is compared with the first check result obtained by performing a CRC-16 check on the data files received in the ROM memory area to complete the secondary security check on the data files in the second Flash memory area.
[0063] S160: If the secondary security check is successful, the user program in the third Flash area is erased according to the erase instruction of the host computer, and the data file is sent from the second Flash area to the third Flash memory.
[0064] Among them, when the second verification result is consistent with the first verification result obtained by performing CRC-16 verification on the data file received in the ROM memory area, the secondary security verification is successful, ensuring the integrity of the data file sent from the ROM memory area to the second Flash area; then the Bootloader boot program replies to the host computer, and the host computer sends the erase command again. The Bootloader boot program erases the user program in the third Flash area according to the erase instruction of the host computer, and sends the data file from the second Flash memory area to the third Flash memory area.
[0065] S170: If the secondary security check fails, the execution of the Bootloader program jumps to the execution of the user program in the third Flash memory area.
[0066] Among them, when the second verification result is inconsistent with the first verification result obtained by performing CRC-16 verification on the data file received in the ROM memory area, the secondary security check fails, the data file sent from the ROM memory area to the second Flash memory area is incomplete, and the user program upgrade fails; since the user program is retained in the third Flash memory area, at this time, the execution of the Bootloader boot program can jump to the execution of the user program in the third Flash memory area, avoiding the controller "bricking" and freezing caused by accidental interruption of the program flashing process.
[0067] S180, performing three security checks on the data files in the third Flash memory area.
[0068] Among them, when three security checks are successful and the data file is sent from the second Flash memory area to the third Flash memory, in order to ensure the integrity of the data file sent to the third Flash memory area, three security checks are performed on the data file in the third Flash memory area. Specifically, a CRC-16 check is performed on the data file in the third Flash memory area to obtain a third check result; the third check result is compared with the second check result obtained by performing a CRC-16 check on the data file received in the second Flash memory area to complete the three security checks on the data file in the third Flash memory area.
[0069] S190: If the three security checks are successful, the Bootloader program jumps to execute the data file in the third Flash memory area to complete the program flashing.
[0070] Among them, when the third check result is consistent with the second check result obtained by performing CRC-16 check on the data file received in the second Flash memory area, the three security checks are successful, and the Bootloader jumps to the data file in the third Flash memory area to complete the program flashing. In this way, this proposal realizes the program flashing through the ROM memory area, the second Flash memory area and the third Flash memory area; in the process of completing the program flashing, if the second check fails, the integrity of the original user program can be guaranteed, avoiding the controller "bricking" and freezing caused by accidental interruption of the program flashing process.
[0071] Based on the above embodiment, further optimization is performed. Figure 2 FIG. 1 is a flowchart of another method for flashing a program of a vehicle body controller provided by an embodiment of the present invention. Figure 2 As shown, the program flashing method includes the following steps:
[0072] S210, entering the upgrade state of executing the user program according to the flag upgrade bit.
[0073] S220, sending different identifiers to the host computer via the CAN network.
[0074] Among them, after the Bootloader control enters the user program upgrade state, the Bootloader sends different identifiers through the CAN communication network, and the host computer sends different data files to different body controllers according to different identifiers; the Bootloader in the subsequent body controller completes the upgrade process of the user program jumped by the Bootloader to the third Flash memory area according to the received data file. In this way, different body controllers are flashed by the Bootloader, the flashing methods for different body controllers are unified, and one-click flashing of user programs for different body controllers is realized, which solves the problem of using different flashing methods for flashing programs of different body controllers in the prior art.
[0075] S230, receiving the data file sent by the host computer, and sending the data file to the ROM memory area.
[0076] S240: Perform a security check on the data files in the ROM memory area.
[0077] S250: If a security check succeeds, the user program in the second Flash memory area is erased according to the erase instruction of the host computer, and the data file is sent from the ROM memory area to the second Flash memory area.
[0078] S260: If a safety check fails, determine the flag status bit.
[0079] Among them, when the first verification result and the verification code are inconsistent, the data file sent by the host computer to the ROM memory area is lost, then a security check fails, and the subsequent user program upgrade fails; at this time, the flag status bit is judged. It should be noted here that the flag status bit includes a first flag status bit and a second flag status bit; the first flag status bit represents the last time the user program in the second Flash memory area was executed; the second flag status bit represents the last time the user program in the third Flash memory area was executed.
[0080] S261: If the flag status bit is the first flag status bit, the execution of the Bootloader program jumps to the execution of the user program in the second Flash memory area.
[0081] Among them, when a security check fails, the query flag status bit is the first flag status bit, then the current execution of the Bootloader jumps to the execution of the user program in the second Flash memory area, avoiding the controller "bricking" and crashing caused by accidental interruption of the program flashing process.
[0082] S262: If the flag status bit is the second flag status bit, the execution of the Bootloader program jumps to the execution of the user program in the third Flash memory area.
[0083] Among them, when a security check fails, the query flag status bit is the second flag status bit, then the current execution of the Bootloader jumps to the execution of the user program in the third Flash memory area, which also avoids the controller "bricking" and freezing caused by accidental interruption of the program flashing process.
[0084] S270: Perform a secondary security check on the data file in the second Flash memory.
[0085] S280: If the secondary security check is successful, the user program in the third Flash memory area is erased according to the erase instruction of the host computer, and the data file is sent from the second Flash memory area to the third Flash memory area.
[0086] S290: If the secondary security check fails, the execution of the Bootloader program jumps to the execution of the user program in the third Flash memory area.
[0087] S300, performing three security checks on the data files in the third Flash memory area.
[0088] S310: If the three security checks are successful, the execution of the Bootloader program jumps to the execution of the data file in the third Flash memory area to complete the program flashing.
[0089] S320: If the three security checks fail, the execution of the Bootloader program jumps to the execution of the user program in the second Flash memory area.
[0090] Among them, when the third verification result is inconsistent with the second verification result obtained by performing CRC-16 verification on the data file received in the second Flash memory area, the three security checks fail, the data file sent from the second Flash memory area to the third Flash memory area is incomplete, and the user program upgrade fails; since the user program is retained in the second Flash memory area and the user program in the third Flash memory area is erased, at this time, the execution of the Bootloader boot program jumps to the execution of the user program in the second Flash memory area, avoiding the controller "bricking" and freezing caused by accidental interruption of the program flashing process.
[0091] S330 , outputting the flag upgrade bit, and storing the flag upgrade bit in the fourth Flash memory area.
[0092] Among them, after passing the first security check, the second security check and the third security check, the program completes the flashing, outputs the flag upgrade bit, and stores the flag upgrade bit in the fourth Flash memory area. Based on the above embodiment, this solution sends different identifiers to the host computer through the Bootloader boot program, and the host computer sends different data files to complete the one-key program flashing process for different body controllers in the future, reducing the complex flashing process and greatly improving the efficiency of program updates; at the same time, the data file completes the first security check, the second security check and the third security check during the transmission process; it also achieves that the integrity of the original user program can be guaranteed when the first security check and the third security check fail, avoiding the controller "bricking" and freezing caused by accidental interruption of flashing.
[0093] An embodiment of the present invention further provides a program flashing device for a vehicle body controller, which can execute the program flashing method for a vehicle body controller provided by any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method. Figure 3 is a structural block diagram of a program flashing device for a vehicle body controller provided by an embodiment of the present invention, such as Figure 3 As shown, the program flashing device of the vehicle body controller includes:
[0094] An upgrade state entry module 10 is used to enter an upgrade state for executing a user program according to an upgrade flag bit;
[0095] The first data file sending module 20 is used to receive the data file sent by the host computer and send the data file to the ROM memory area;
[0096] A primary security check module 30, used for performing a primary security check on the data files in the ROM memory area;
[0097] The second data file sending module 40 is used to erase the user program in the second Flash memory area according to the erase instruction of the host computer when a security check succeeds, and send the data file from the ROM memory area to the second Flash memory area;
[0098] A secondary security check module 50, used for performing a secondary security check on the data files in the second Flash memory area;
[0099] The third data file sending module 60 is used to erase the user program in the third Flash memory area according to the erase instruction of the host computer when the secondary security check is successful, and send the data file from the second Flash memory area to the third Flash memory area;
[0100] The jump execution module 70 is used to jump from executing the Bootloader program to executing the user program in the third Flash memory area when the secondary security check fails;
[0101] A secondary security check module 80 is used to perform a third security check on the data file in the third Flash memory;
[0102] The program flashing module 90 is used to jump from executing the Bootloader program to executing the data file in the third Flash memory to complete the program flashing when the three security checks are successful.
[0103] An embodiment of the present invention also provides a computer device, Figure 4 is a schematic diagram of the structure of a computer device provided by an embodiment of the present invention, such as Figure 4 As shown, the device includes a processor 70, a memory 71, an input device 72 and an output device 73; the number of processors 70 in the device can be one or more. Figure 3 A processor 70 is taken as an example; the processor 70, the memory 71, the input device 72 and the output device 73 in the device can be connected by a bus or other means. Figure 4 The example of connecting through bus is taken in the following.
[0104] The memory 71 is a computer-readable storage medium that can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the program flashing method of the vehicle body controller in the embodiment of the present invention. The processor 70 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 71, that is, realizing the program flashing method of the vehicle body controller described above.
[0105] The memory 71 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 71 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 71 may further include a memory remotely arranged relative to the processor 70, and these remote memories may be connected to the device / terminal / server via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0106] The input device 72 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 73 may include a display device such as a display screen.
[0107] An embodiment of the present invention further provides a storage medium containing computer executable instructions, wherein the computer executable instructions are used to execute a method for flashing a program of a vehicle body controller when executed by a computer processor, the method comprising:
[0108] Entering an upgrade state of executing the user program according to the flag upgrade bit;
[0109] Receive a data file sent by the host computer, and send the data file to the ROM memory area;
[0110] Perform a security check on the data files in the ROM memory area;
[0111] If the one-time security check succeeds, the user program in the second Flash area is erased according to the erase instruction of the host computer, and the data file is sent from the ROM memory area to the second Flash memory area;
[0112] Performing a secondary security check on the data file in the second Flash memory;
[0113] If the secondary security check succeeds, the user program in the third Flash area is erased according to the erase instruction of the host computer, and the data file is sent from the second Flash memory area to the third Flash memory area; if the secondary security check fails, the Bootloader jumps to execute the user program in the third Flash memory area;
[0114] Performing three security checks on the data files in the third Flash memory area;
[0115] If the three security checks are successful, the Bootloader program is executed to jump to the data file in the third Flash memory area to complete the program flashing.
[0116] Of course, the storage medium containing computer executable instructions provided in an embodiment of the present invention is not limited to the method operations described above, and can also execute related operations in a program flashing method for a vehicle body controller provided in any embodiment of the present invention.
[0117] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0118] It is worth noting that in the embodiment of the above-mentioned search device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0119] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for flashing a program of a vehicle body controller, characterized in that: The vehicle body controller includes a ROM memory area and a Flash memory area; the Flash memory area includes a first Flash memory area, a second Flash memory area, a third Flash memory area and a fourth Flash memory area; the Bootloader is solidified in the first Flash memory area; The second Flash memory area stores user programs; The user program is stored in the third Flash memory area; The fourth Flash memory area stores a flag upgrade bit; the program flashing method comprises: Send different identifiers to the host computer through the CAN network so that the host computer sends different data files to different body controllers according to different identifiers; Entering an upgrade state of executing the user program according to the flag upgrade bit; Receive the data file sent by the host computer, and send the data file to the ROM memory area; Perform a security check on the data files in the ROM memory area; Perform a security check on the data files in the ROM memory area, including: Receive a check code obtained by the host computer performing a CRC-16 check on the data file; Performing the CRC-16 check on the data file received in the ROM memory area to obtain a first check result; Perform a security check on the data file in the ROM memory area according to the first check result and the check code; If the one-time security check succeeds, the user program in the second Flash memory area is erased according to the erase instruction of the host computer, and the data file is sent from the ROM memory area to the second Flash memory; Performing a secondary security check on the data file in the second Flash memory; The second security check of the data files in the second Flash memory area includes: Performing the CRC-16 check on the data file in the second Flash memory area to obtain a second check result; Performing a secondary security check on the data files in the second Flash memory area according to the first check result and the second check result; If the secondary security check succeeds, the user program in the third Flash memory area is erased according to the erase instruction of the host computer, and the data file is sent from the second Flash memory area to the third Flash memory area; if the secondary security check fails, the execution of the Bootloader program jumps to the execution of the user program in the third Flash memory area; Performing three security checks on the data files in the third Flash memory area; The data files in the third Flash memory area are subjected to three security checks, including: Performing the CRC-16 check on the data file in the third Flash memory area to obtain a third check result; Performing three security checks on the data files in the third Flash memory area according to the second check result and the third check result; If the three security checks are successful, the execution of the Bootloader program jumps to the execution of the data file in the third Flash memory area to complete the program flashing.
2. The program flashing method of the vehicle body controller according to claim 1, characterized in that: The fourth Flash memory area also stores a flag status bit; after performing a security check on the data file in the ROM memory area, the method further includes: If the primary security check fails, determining the flag status bit; If the flag status bit is the first flag status bit, the execution of the Bootloader program jumps to the execution of the user program in the second Flash memory area; If the flag status bit is the second flag status bit, the execution of the Bootloader program jumps to the execution of the user program in the third Flash memory area.
3. The program flashing method of the vehicle body controller according to claim 1, characterized in that: After performing three security checks on the data files in the third Flash memory area, the method further includes: If the three security checks fail, the execution of the Bootloader program jumps to the execution of the user program in the second Flash memory area.
4. The program flashing method of the vehicle body controller according to claim 1, characterized in that: After executing the Bootloader program to jump to executing the data file in the third Flash memory area to complete the program flashing, it also includes: Output a flag upgrade bit, and store the flag upgrade bit in the fourth Flash memory area.
5. A program flashing module for a vehicle body controller, characterized in that: include: An identification sending module, used for sending different identifications to a host computer via a CAN network so that the host computer sends different data files to different vehicle body controllers according to different identifications; The upgrade state entry module is used to enter the upgrade state of executing the user program according to the flag upgrade bit; A data file first sending module, used for receiving a data file sent by the host computer, and sending the data file to the ROM memory area; A primary security check module, used for performing a primary security check on the data files in the ROM memory area; The data files in the ROM memory area are subjected to a security check, including: Receive a check code obtained by the host computer performing a CRC-16 check on the data file; Performing the CRC-16 check on the data file received in the ROM memory area to obtain a first check result; Perform a security check on the data file in the ROM memory area according to the first check result and the check code; A second data file sending module, used for erasing the user program in the second Flash memory area according to the erase instruction of the host computer when the first security check is successful, and sending the data file from the ROM memory area to the second Flash memory area; A secondary security verification module, used for performing a secondary security verification on the data files in the second Flash memory area; The second security check of the data files in the second Flash memory area includes: Performing the CRC-16 check on the data file in the second Flash memory area to obtain a second check result; Performing a secondary security check on the data files in the second Flash memory area according to the first check result and the second check result; A third data file sending module, used for erasing the user program in the third Flash memory area according to the erase instruction of the host computer when the secondary security check is successful, and sending the data file from the second Flash memory area to the third Flash memory area; A jump execution module, used for jumping from executing the Bootloader to executing the user program in the third Flash memory area when the secondary security check fails; A secondary security check module, used for performing a third security check on the data files in the third Flash memory area; The data files in the third Flash memory area are subjected to three security checks, including: Performing the CRC-16 check on the data file in the third Flash memory area to obtain a third check result; Performing three security checks on the data files in the third Flash memory area according to the second check result and the third check result; The program flashing module is used to jump from executing the Bootloader to executing the data file in the third Flash memory area to complete the program flashing when the three security checks are successful.
6. A computer device, characterized in that: The computer device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement a program flashing method for a vehicle body controller as described in any one of claims 1-4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a program flashing method for a vehicle body controller as described in any one of claims 1 to 4 is implemented.
