Switch firmware upgrading method and device

By generating and verifying the security verification information between the MCU and the tester, the security of the switch firmware upgrade process is ensured, and the data forwarding function caused by the on-board network is solved due to the abnormality of the switch firmware, and the normal operation of the vehicle is improved. Data communication reliability.

CN118972352APending Publication Date: 2024-11-15CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411130639.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

The data forwarding function of the on-board Ethernet network is damaged due to abnormal switch firmware, which may cause the entire vehicle network to be paralyzed and affect normal operation and data communication.

Method used

By generating and verifying the security verification information of the firmware upgrade instructions between the MCU and the tester, ensure the security of the switch firmware upgrade process and avoiding firmware damage caused by false triggering.

Benefits of technology

Improve the security of switch firmware upgrades, prevent switch damage caused by false triggering, and thus avoid the impact on the normal operation of the vehicle and data communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972352A_ABST
    Figure CN118972352A_ABST
Patent Text Reader

Abstract

The invention relates to a switch firmware upgrading method and device. The method comprises the following steps: acquiring a firmware upgrading instruction for a switch; wherein the MCU and the switch are arranged in an electronic control unit (ECU) of a vehicle; in response to the firmware upgrading instruction, first security verification information corresponding to the firmware upgrading instruction is generated, and second security verification information corresponding to the firmware upgrading instruction is acquired from the tester; verifying the firmware upgrading instruction according to the first security verification information and the second security verification information; and if the verification is passed, writing firmware upgrading data corresponding to the firmware upgrading instruction into the switch so as to carry out firmware upgrading on the switch. By adopting the method, the security of firmware upgrading of the switch can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of switches, and in particular to a method and device for upgrading switch firmware. Background Art

[0002] As new energy vehicles are rapidly developing towards electrification and intelligence, the number of sensors integrated into vehicles has increased significantly, resulting in a sharp increase in the amount of data generated and processed during vehicle operation, which has put forward higher requirements on the bandwidth of the vehicle network. Based on this, many electronic control units (ECUs) have turned to Ethernet connections to achieve more efficient data communication.

[0003] At present, switches, such as switch chips, need to be integrated into ECUs to support the forwarding of vehicle Ethernet data. However, when the switch program causes part of the firmware to be erased or damaged due to an abnormality, it will directly affect the data forwarding function of the gateway controller, which may paralyze the entire vehicle Ethernet network, seriously affecting the normal operation and data communication of the vehicle. Summary of the invention

[0004] Based on this, it is necessary to provide a switch firmware upgrade method and device to address the above technical issues, which can improve the security of switch firmware upgrade.

[0005] In a first aspect, the present application provides a switch firmware upgrade method, which is applied to a microcontroller unit (MCU), comprising:

[0006] Obtaining a firmware upgrade instruction for the switch; wherein the MCU and the switch are set in an electronic control unit ECU of the vehicle;

[0007] In response to the firmware upgrade instruction, generating first security verification information corresponding to the firmware upgrade instruction, and acquiring second security verification information corresponding to the firmware upgrade instruction from the tester;

[0008] Verifying the firmware upgrade instruction according to the first security verification information and the second security verification information;

[0009] If the verification passes, the firmware upgrade data corresponding to the firmware upgrade instruction is written to the switch to perform the firmware upgrade on the switch.

[0010] In one of the embodiments, first security verification information corresponding to a firmware upgrade instruction is generated, and second security verification information corresponding to the firmware upgrade instruction is obtained from a tester, including: obtaining a first verification string corresponding to the firmware upgrade instruction sent by the tester; generating a second verification string corresponding to the firmware upgrade instruction, and sending the second verification string to the tester; generating first security verification information corresponding to the firmware upgrade instruction based on the first verification string and the second verification string; and obtaining second security verification information generated by the tester based on the first verification string and the second verification string.

[0011] In one of the embodiments, the first security verification information and the second security verification information are both generated using a preset encryption algorithm; accordingly, the firmware upgrade instruction is verified based on the first security verification information and the second security verification information, including: if the first security verification information is the same as the second security verification information, it is determined that the firmware upgrade instruction verification has passed; if the first security verification information is different from the second security verification information, it is determined that the firmware upgrade instruction verification has failed.

[0012] In one of the embodiments, a firmware data storage area and a firmware data backup area are provided in the MCU; the firmware data storage area stores the firmware upgrade data corresponding to the current firmware upgrade, and the firmware data backup area stores the firmware upgrade data backed up after each successful firmware upgrade; if the instruction initiator of the firmware upgrade instruction is different from the tester, the latest backup data stored in the firmware data backup area is used to replace the firmware upgrade data in the firmware data storage area.

[0013] In one of the embodiments, if the verification passes, the firmware upgrade data corresponding to the firmware upgrade instruction is written to the switch, including: if the verification passes, the access mode of the switch is adjusted from a read-only mode to a writable mode; in the writable mode, the firmware upgrade data corresponding to the firmware upgrade instruction is written to the switch; after the writing is completed, the access mode is adjusted from a writable mode to a read-only mode.

[0014] In a second aspect, the present application also provides a switch firmware upgrade method, which is applied to a tester, comprising:

[0015] Sending a firmware upgrade instruction for the switch to the MCU, so that the MCU generates first security verification information corresponding to the firmware upgrade instruction;

[0016] The second security verification information for the firmware upgrade instruction is sent to the MCU, so that when the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information, the MCU writes the firmware upgrade data corresponding to the firmware upgrade instruction into the switch to perform the firmware upgrade.

[0017] In one of the embodiments, sending second security verification information for a firmware upgrade instruction to an MCU includes: sending a first verification string corresponding to the firmware upgrade instruction to the MCU, so that the MCU generates first security verification information based on the first verification string and a second verification string generated by itself for the firmware upgrade instruction; receiving a second verification string sent by the MCU; generating second security verification information corresponding to the firmware upgrade instruction based on the first verification string and the second verification string; and sending the second security verification information to the MCU.

[0018] In one of the embodiments, the first security verification information and the second security verification information are both generated using a preset encryption algorithm; accordingly, the verification of the firmware upgrade instruction is a consistency check of the first security verification information and the second security verification information.

[0019] In one of the embodiments, sending second security verification information for a firmware upgrade instruction to the MCU includes: determining whether a firmware upgrade instruction is sent to the MCU within a preset time period; if so, sending second security verification information for the firmware upgrade instruction to the MCU; if not, prohibiting sending second security verification information for the firmware upgrade instruction to the MCU.

[0020] In a third aspect, the present application also provides a switch firmware upgrade device, configured in an MCU, comprising:

[0021] An instruction acquisition module, used to acquire a firmware upgrade instruction for the switch; wherein the MCU and the switch are arranged in an electronic control unit ECU of the vehicle;

[0022] An information acquisition module, configured to generate first security verification information corresponding to the firmware upgrade instruction in response to the firmware upgrade instruction, and to acquire second security verification information corresponding to the firmware upgrade instruction from the tester;

[0023] An information verification module, used to verify the firmware upgrade instruction according to the first security verification information and the second security verification information;

[0024] The firmware upgrade module is used to write the firmware upgrade data corresponding to the firmware upgrade instruction into the switch if the verification passes, so as to upgrade the firmware of the switch.

[0025] In a fourth aspect, the present application further provides a switch firmware upgrade device, which is configured on a tester and includes:

[0026] An instruction sending module, used for sending a firmware upgrade instruction for the switch to the MCU, so that the MCU generates first security verification information corresponding to the firmware upgrade instruction;

[0027] The information sending module is used to send the second security verification information for the firmware upgrade instruction to the MCU, so that when the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information, the MCU writes the firmware upgrade data corresponding to the firmware upgrade instruction into the switch to perform the firmware upgrade.

[0028] In a fifth aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0029] Obtaining a firmware upgrade instruction for the switch; wherein the MCU and the switch are set in an electronic control unit ECU of the vehicle;

[0030] In response to the firmware upgrade instruction, generating first security verification information corresponding to the firmware upgrade instruction, and acquiring second security verification information corresponding to the firmware upgrade instruction from the tester;

[0031] Verifying the firmware upgrade instruction according to the first security verification information and the second security verification information;

[0032] If the verification passes, the firmware upgrade data corresponding to the firmware upgrade instruction is written to the switch to perform the firmware upgrade on the switch.

[0033] In a sixth aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0034] Sending a firmware upgrade instruction for the switch to the MCU, so that the MCU generates first security verification information corresponding to the firmware upgrade instruction;

[0035] The second security verification information for the firmware upgrade instruction is sent to the MCU, so that when the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information, the MCU writes the firmware upgrade data corresponding to the firmware upgrade instruction into the switch to perform the firmware upgrade.

[0036] In a seventh aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:

[0037] In response to the firmware upgrade instruction, generating first security verification information corresponding to the firmware upgrade instruction, and acquiring second security verification information corresponding to the firmware upgrade instruction from the tester;

[0038] Verifying the firmware upgrade instruction according to the first security verification information and the second security verification information;

[0039] If the verification passes, the firmware upgrade data corresponding to the firmware upgrade instruction is written to the switch to perform the firmware upgrade on the switch.

[0040] In an eighth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:

[0041] Sending a firmware upgrade instruction for the switch to the MCU, so that the MCU generates first security verification information corresponding to the firmware upgrade instruction;

[0042] The second security verification information for the firmware upgrade instruction is sent to the MCU, so that when the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information, the MCU writes the firmware upgrade data corresponding to the firmware upgrade instruction into the switch to perform the firmware upgrade.

[0043] In a ninth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0044] In response to the firmware upgrade instruction, generating first security verification information corresponding to the firmware upgrade instruction, and acquiring second security verification information corresponding to the firmware upgrade instruction from the tester;

[0045] Verifying the firmware upgrade instruction according to the first security verification information and the second security verification information;

[0046] If the verification passes, the firmware upgrade data corresponding to the firmware upgrade instruction is written to the switch to perform the firmware upgrade on the switch.

[0047] In a tenth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0048] Sending a firmware upgrade instruction for the switch to the MCU, so that the MCU generates first security verification information corresponding to the firmware upgrade instruction;

[0049] The second security verification information for the firmware upgrade instruction is sent to the MCU, so that when the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information, the MCU writes the firmware upgrade data corresponding to the firmware upgrade instruction into the switch to perform the firmware upgrade.

[0050] In the above switch firmware upgrade method and device, after receiving the firmware upgrade instruction, the MCU generates the first security verification information corresponding to the firmware upgrade instruction before writing the firmware upgrade data corresponding to the firmware upgrade instruction to the switch, and obtains the second security verification information corresponding to the firmware upgrade instruction generated by the tester, and then verifies the firmware upgrade instruction according to the first security verification information and the second security verification information. The firmware upgrade data is written to the switch only when the verification passes. Compared with the prior art, the firmware upgrade data is directly written in response to the firmware upgrade instruction, which improves the security of the switch firmware upgrade, thereby avoiding damage to the switch caused by erroneous triggering of the firmware upgrade, and further avoiding the impact of the switch damage on the normal operation and data communication of the vehicle. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0052] Figure 1 A diagram of an application environment of a switch firmware upgrade method in an embodiment;

[0053] Figure 2 A schematic diagram of a process of upgrading a switch firmware in one embodiment;

[0054] Figure 3 A schematic diagram of a flow chart of steps of generating first security verification information and acquiring second security verification information in one embodiment;

[0055] Figure 4 A flowchart of a firmware upgrade instruction verification step in one embodiment;

[0056] Figure 5A A schematic diagram of a flash memory in an MCU in one embodiment;

[0057] Figure 5B A flowchart of a firmware upgrade data replacement step in one embodiment;

[0058] Figure 6 A flowchart of a firmware upgrade data writing step in one embodiment;

[0059] Figure 7 A schematic diagram of a flow chart of a switch firmware upgrade method in another embodiment;

[0060] Figure 8It is a flowchart of a second security verification information sending step in one embodiment;

[0061] Fig. 9 A schematic flow chart of a second security verification information sending step in another embodiment;

[0062] Fig.10 A schematic diagram of a flow chart of a switch firmware upgrade method in another embodiment;

[0063] Fig.11 A structural block diagram of a switch firmware upgrade device in an embodiment;

[0064] Fig.12 It is a structural block diagram of a switch firmware upgrade device in another embodiment;

[0065] Fig.13 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0066] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0067] Before introducing the switch firmware upgrade method provided in the embodiment of the present application, it should be noted that with the increasing requirements for electrification and intelligence of new energy vehicles, the number of sensors on the vehicle has increased, and the amount of data has increased sharply, which has put increasing demands on the bandwidth of the vehicle network. The original vehicle-mounted serial communication protocol bus (Controller Area Network, CAN) and local interconnect network bus (Local Interconnect Network, LIN) and other traditional buses cannot meet the transmission requirements, and many intelligent-related ECUs are connected by Ethernet cables. With the large-scale application of vehicle-mounted Ethernet, the gateway controller not only forwards CAN and LIN data, but also needs to forward Ethernet data. Therefore, it is necessary to arrange a switch (for example, a switch switching chip) to complete this function, and use the switch to realize the forwarding of the Ethernet data of the entire vehicle. The gateway controller plays a very important role in data exchange. Once the switch program is abnormally damaged, the Ethernet network of the entire vehicle is at risk of paralysis.

[0068] However, in practice, if the program inside the processor may trigger the write data interface by mistake due to some reasons (such as hardware failure, power fluctuation, program error, etc.) at the moment of vehicle power-on, part of the content in the switch firmware may be erased, or invalid or erroneous data may be written into the switch, causing the switch firmware to be damaged and unable to complete data forwarding. Based on this, the present application provides a switch firmware upgrade method, which can avoid switch damage caused by false triggering.

[0069] The switch firmware upgrade method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the ECU 10 is provided with an MCU 102 and a switch 104, and a connection relationship exists between the MCU 102 and the switch 104. The tester 20 is connected to the MCU 102 in the ECU 10. Specifically, the MCU 102 obtains a firmware upgrade instruction for the switch 104; the MCU 102 generates a first security verification information corresponding to the firmware upgrade instruction in response to the firmware upgrade instruction, and obtains a second security verification information corresponding to the firmware upgrade instruction from the tester 20; the MCU 102 verifies the firmware upgrade instruction according to the first security verification information and the second security verification information; if the verification passes, the MCU 102 writes the firmware upgrade data corresponding to the firmware upgrade instruction to the switch 104 to perform a firmware upgrade on the switch 104.

[0070] In an exemplary embodiment, Figure 2 As shown, a switch firmware upgrade method is provided, which is applied to Figure 1 Taking the MCU 102 in the example as an example, the following steps are included:

[0071] S210: Obtain a firmware upgrade instruction for the switch.

[0072] The MCU and the switch are arranged in the electronic control unit ECU of the vehicle, and there is a connection relationship between the MCU and the switch. The switch is a device for forwarding data packets between multiple communication ports or devices, for example, the switch can be a switch chip.

[0073] It should be noted that the number of switches in the ECU may not be unique, and different switches correspond to different switch identifiers, and different switches can be identified based on the switch identifiers. Accordingly, when the number of switches in the ECU is not unique, the identification information of the switch to be upgraded is recorded in the firmware upgrade instruction, so that the MCU determines the switch to be upgraded based on the identification information of the switch to be upgraded. The following switch is the switch to be upgraded.

[0074] The firmware upgrade instruction may be an instruction for instructing the switch to upgrade the firmware data. Under normal circumstances, the firmware upgrade instruction should be sent by the tester after the user actively triggers the upgrade behavior; under abnormal circumstances, the firmware upgrade instruction may be generated by mistake when the vehicle is powered on. In this case, the firmware upgrade instruction is unreliable and unsafe. The tester may be a car diagnostic instrument or an Over-the-Air Technology Master (OTA Master), and this application does not make any restrictions on this.

[0075] In an optional implementation, the MCU may receive a firmware upgrade instruction for the switch sent by the tester after the user actively triggers the upgrade behavior.

[0076] In an optional implementation, the MCU may receive a firmware upgrade instruction for the switch triggered by a processor outside the tester when the vehicle is powered on.

[0077] S220, in response to the firmware upgrade instruction, generating first security verification information corresponding to the firmware upgrade instruction, and acquiring second security verification information corresponding to the firmware upgrade instruction from the tester.

[0078] The first security verification information and the second security verification information are both information used to perform security verification on the firmware upgrade instruction. The first security verification information and the second security verification information can be in a string format or a digital format, and this application does not impose any restrictions on this. The first security verification information is generated by the MCU, and the second security verification information is generated by the tester.

[0079] In an optional embodiment, the MCU, in response to the firmware upgrade instruction, can generate the first security verification information according to the identification information of the switch to be upgraded carried in the firmware upgrade instruction. Exemplarily, the identification information of the switch to be upgraded can be encrypted according to its own public key to obtain the first security verification information. Further, the public key of the MCU is sent to the tester, so that the tester can encrypt the firmware upgrade instruction issued by itself according to the public key of the MCU to obtain the second security verification information, thereby obtaining the second security verification information sent by the tester.

[0080] In an optional embodiment, a session key, such as a symmetric key or an asymmetric key, is predetermined between the MCU and the tester. The MCU responds to the firmware upgrade instruction and encrypts the firmware upgrade instruction according to the preset session key to obtain first security verification information. The MCU also obtains from the tester second security verification information obtained after the tester encrypts the firmware upgrade instruction issued by itself according to the preset session key.

[0081] S230: Verify the firmware upgrade instruction according to the first security verification information and the second security verification information.

[0082] In an optional implementation, if the first security verification information is obtained by encrypting the identification information of the switch to be upgraded by the MCU according to its own public key, and the second security verification information is obtained by encrypting the firmware upgrade instruction issued by the tester according to the public key of the MCU, then the first security verification information and the second security verification information can be checked for consistency, and the consistency check result can be used as the firmware upgrade instruction verification result.

[0083] In an optional implementation, if the first security verification information is obtained by the MCU encrypting the firmware upgrade instruction according to the preset session key, and the second security verification information is obtained by the tester encrypting the firmware upgrade instruction issued by itself according to the preset session key, then when the preset session key is a symmetric key, the first security verification information and the second security verification information are checked for consistency, and the consistency check result is used as the verification result of the firmware upgrade instruction; when the preset session key is an asymmetric key, the first security verification information and the second security verification information are checked for matching, and the matching check result is used as the verification result of the firmware upgrade instruction.

[0084] S240: If the verification passes, the firmware upgrade data corresponding to the firmware upgrade instruction is written into the switch to perform a firmware upgrade on the switch.

[0085] Among them, the firmware upgrade data can be data in the switch firmware upgrade file. Under normal circumstances, the switch firmware upgrade file is pre-stored by the software engineer in a preset storage location in the MCU. Under abnormal circumstances, the switch firmware upgrade file may be mistakenly generated at the moment the vehicle is powered on. It should be noted that this application adds a verification process before writing the firmware upgrade data corresponding to the firmware upgrade instruction to the switch, in order to avoid damage to the switch caused by writing the mistakenly generated firmware upgrade file into the switch.

[0086] Exemplarily, in this embodiment, when the verification is passed, the MCU writes the firmware upgrade data in the firmware upgrade file stored in the preset storage location into the preset storage location of the switch to perform firmware upgrade on the switch.

[0087] It should be noted that in order to ensure the accuracy and integrity of the firmware upgrade data written into the switch, each time the MCU reads and writes the firmware upgrade data, it will detect whether the number of remaining bytes of the firmware upgrade data in the preset storage location is 0. If it is not 0, it will continue to read and write data until the number of remaining bytes of the firmware upgrade data in the preset storage location is 0, and it is determined that the firmware upgrade of the switch is completed.

[0088] In the above switch firmware upgrade method, after receiving the firmware upgrade instruction, the MCU generates the first security verification information corresponding to the firmware upgrade instruction before writing the firmware upgrade data corresponding to the firmware upgrade instruction to the switch, and obtains the second security verification information corresponding to the firmware upgrade instruction generated by the tester, and then verifies the firmware upgrade instruction according to the first security verification information and the second security verification information. The firmware upgrade data is written to the switch only when the verification passes. Compared with the prior art, the firmware upgrade data is directly written in response to the firmware upgrade instruction, which improves the security of the switch firmware upgrade, thereby avoiding damage to the switch caused by erroneous triggering of the firmware upgrade, and thus avoiding the impact of the switch damage on the normal operation and data communication of the vehicle.

[0089] Based on the technical solutions of the above embodiments, the present application also provides an optional embodiment. In this embodiment, the process of the MCU generating the first security verification information corresponding to the firmware upgrade instruction and the MCU obtaining the second security verification information corresponding to the firmware upgrade instruction from the tester is described in detail.

[0090] See also Figure 3 The steps of generating the first security verification information and obtaining the second security verification information shown include:

[0091] S310, obtaining a first verification string corresponding to the firmware upgrade instruction sent by the tester.

[0092] Among them, the first verification string can be a string used to generate the first security verification information and the second security verification information. The first verification string can be generated by the tester according to the firmware upgrade instruction, or it can be randomly generated. This application does not impose any limitation on this.

[0093] In an optional implementation, in order to further improve the security of the switch firmware upgrade, the MCU responds to the firmware upgrade instruction, performs an integrity check on the firmware upgrade data corresponding to the firmware upgrade instruction, and if the integrity check passes, performs a feasibility check on the current state of the vehicle to determine whether the switch firmware can be upgraded in the current operating state of the vehicle. If both the integrity check and the feasibility check pass, the MCU sends a security check start instruction to the tester to instruct the tester to send the first check string corresponding to the randomly generated firmware upgrade instruction to the MCU, for example, RAND_C.

[0094] The integrity check of the firmware upgrade data may be performed based on a common data integrity check algorithm, such as a digest algorithm, a cyclic redundancy check algorithm, and a longitudinal redundancy check algorithm, which will not be described in detail here.

[0095] The feasibility check of the current state of the vehicle can be performed by obtaining the current speed, driving state and the existence of firmware upgrade data of the vehicle. For example, when the current speed of the vehicle is 0, the driving state is the parking state, and there is firmware upgrade data, it is determined that the feasibility check of the current state of the vehicle has passed; when at least one of the current speed of the vehicle, the driving state and the existence of firmware upgrade data does not meet the preset conditions, it is determined that the feasibility check of the current state of the vehicle has failed.

[0096] It should be noted that if at least one of the integrity check and feasibility check fails, the MCU will not feedback the security check startup instruction to the tester. In this case, the MCU cannot obtain the first verification string corresponding to the firmware upgrade instruction sent by the tester.

[0097] It should be noted that the integrity check and feasibility check can also be performed before receiving the firmware upgrade instruction, and this application does not impose any limitation on this. For example, the MCU can perform integrity check and feasibility check when detecting that the user inputs firmware upgrade data.

[0098] S320, generating a second verification string corresponding to the firmware upgrade instruction, and sending the second verification string to the tester.

[0099] Among them, the second verification string can be a string used to generate the first security verification information and the second security verification information. The second verification string can be generated by the MCU based on the first verification string, or it can be randomly generated. This application does not impose any restrictions on this.

[0100] In an optional implementation manner, after receiving the first verification string sent by the tester, the MCU randomly generates a second verification string RAND_S, and sends the second verification string to the tester.

[0101] In an optional implementation, after receiving the first verification string sent by the tester, the MCU processes the first verification string according to a preset algorithm, generates a second verification string, and sends the second verification string to the tester. The preset algorithm can be determined based on manual experience, and this application does not impose any limitation on this.

[0102] S330: Generate first security verification information corresponding to the firmware upgrade instruction according to the first verification string and the second verification string.

[0103] Optionally, in this embodiment, the MCU may encrypt the first verification string and the second verification string according to a preset encryption algorithm to obtain first security verification information. The preset encryption algorithm may be determined based on manual experience, and this application does not impose any limitation on this. For example, the preset encryption algorithm may be a Cipher Block Chaining-Message Authentication Code (CMAC) based on a cipher block chain.

[0104] S340, obtaining second security verification information generated by the tester based on the first verification string and the second verification string.

[0105] In an optional implementation, the first security verification information and the second security verification information are both generated using a preset encryption algorithm. Accordingly, the MCU obtains the second security verification information generated by the tester encrypting the first verification string and the second verification string according to the preset encryption algorithm.

[0106] In an optional implementation, there is a corresponding relationship between the preset encryption algorithms used by the first security verification information and the second security verification information. Exemplarily, the preset encryption algorithm used by the first security verification information is the first encryption algorithm, the preset encryption algorithm used by the second security verification information is the second encryption algorithm, and there is a preset corresponding relationship between the first encryption algorithm and the second encryption algorithm. Accordingly, the MCU obtains the second security verification information generated by the tester encrypting the first verification string and the second verification string according to the second encryption algorithm.

[0107] In the above embodiment, the process of the MCU generating the first security verification information corresponding to the firmware upgrade instruction and the MCU obtaining the second security verification information corresponding to the firmware upgrade instruction from the tester is described in detail. Specifically, the MCU generates the second security verification information according to the first verification string and the second verification string corresponding to the firmware upgrade instruction. Similarly, the tester generates the first security verification information according to the first verification string and the second verification string corresponding to the firmware upgrade instruction, so as to facilitate the subsequent verification of the firmware upgrade instruction according to the first security verification information and the second security verification information.

[0108] Based on the technical solutions of the above embodiments, the present application also provides an optional embodiment. In this embodiment, a specific process of verifying the firmware upgrade instruction according to the first security verification information and the second security verification information is given when both the first security verification information and the second security verification information are generated using a preset encryption algorithm.

[0109] See also Figure 4 The firmware upgrade instruction verification steps shown include:

[0110] start.

[0111] S410, determining whether the first security verification information is the same as the second security verification information.

[0112] S420: If the first security verification information is the same as the second security verification information, it is determined that the firmware upgrade instruction verification has passed.

[0113] S430: If the first security verification information is different from the second security verification information, it is determined that the firmware upgrade instruction verification fails.

[0114] It should be noted that the verification step of the above-mentioned firmware upgrade instruction is a corresponding verification step under the premise that both the first security verification information and the second security verification information are generated using a preset encryption algorithm. Optionally, there may also be a corresponding relationship between the preset encryption algorithm adopted by the first security verification information and the second security verification information. In this case, this embodiment also provides another verification step of the firmware upgrade instruction, namely: if there is a preset corresponding relationship between the first security verification information and the second security verification information, it is determined that the firmware upgrade instruction verification has passed; if there is no preset corresponding relationship between the first security verification information and the second security verification information, it is determined that the firmware upgrade instruction verification has failed. Among them, the preset corresponding relationship is the corresponding relationship between the preset encryption algorithm adopted by the first security verification information and the second security verification information.

[0115] In the above embodiment, a specific process of verifying the firmware upgrade instruction according to the first security verification information and the second security verification information is given when both the first security verification information and the second security verification information are generated by a preset encryption algorithm. By determining whether the first security verification information and the second security verification information are the same, the firmware upgrade instruction is verified, making the verification process of the firmware upgrade instruction simpler.

[0116] Based on the technical solutions of the above embodiments, the present application also provides an optional embodiment. In this embodiment, the preset storage area in the MCU and the switch is a flash memory flash, and the flash of the MCU is a non-volatile memory with the characteristics of fast erasing and reading, and the stored files can be frequently and quickly read and updated.

[0117] In this embodiment, see Figure 5A, the flash of MCU 102 can be divided into multiple areas, and different areas are used to store different types of data. For example, the startup file area 1021 is used to store the data required for the car to start; the parameter area 1022 is used to store the storage address of each program file; the application area 1023 is used to store the correct program written when the vehicle is upgraded, including the application (APPlication, APP) program data and the firmware upgrade data corresponding to the current switch firmware upgrade, so the application area 1023 is also called the firmware data storage area; the application backup area 1024 is used to store the firmware upgrade data backed up after each successful firmware upgrade, so the application backup area 1024 is also called the firmware data backup area; the log area is used to store the log data generated by the operation of the car.

[0118] The switch 104 is also provided with a flash for storing its own current firmware data.

[0119] It should be noted that different storage areas correspond to different address locations, and different address locations correspond to different storage data types. For example, a startup file is generally stored in a low address area of ​​the flash.

[0120] When a firmware data storage area and a firmware data backup area are provided in the MCU, and the instruction initiator of the firmware upgrade instruction is different from the tester, this embodiment further provides a firmware upgrade data replacement solution.

[0121] See also Figure 5B The steps for replacing the firmware upgrade data shown include:

[0122] S510: If the initiator of the firmware upgrade instruction is different from the tester, the latest backup data stored in the firmware data backup area is used to replace the firmware upgrade data in the firmware data storage area.

[0123] The latest backup area stored in the firmware data backup area is the current firmware data of the switch. It is understandable that after the firmware upgrade data in the firmware data storage area is successfully written to the switch, the firmware upgrade data is automatically stored in the firmware data backup area.

[0124] Specifically, in this embodiment, if the initiator of the firmware upgrade instruction is different from the tester, the firmware upgrade instruction is determined to be untrustworthy and unsafe, and the firmware upgrade data in the firmware data storage area is also untrustworthy and unsafe. In order to avoid storing unsafe data in the firmware data storage area, in this embodiment, the latest backup data stored in the firmware data backup area is used to replace the firmware upgrade data in the firmware data storage area.

[0125] In the above embodiment, when the initiator of the firmware upgrade instruction is different from the tester, the latest backup data stored in the firmware data backup area is used to replace the firmware upgrade data in the firmware data storage area. This ensures that no unsafe data is stored in the firmware data storage area and facilitates subsequent data reading.

[0126] Based on the technical solutions of the above embodiments, the present application further provides an optional embodiment. In this embodiment, when the verification is passed, the process of writing the firmware upgrade data corresponding to the firmware upgrade instruction into the switch is further refined.

[0127] See also Figure 6 The steps for writing firmware upgrade data shown include:

[0128] S610: If the verification is passed, the access mode of the switch is adjusted from the read-only mode to the writable mode.

[0129] It should be noted that when the ECU leaves the factory, the flash area of ​​the switch (switch chip) is initialized to read-only mode, that is, locked state. Only when the verification passes, the MCU will unlock the flash area of ​​the switch, that is, adjust it from read-only mode to writable mode.

[0130] In an optional implementation, when the verification is passed, the MCU sends an access mode adjustment instruction to the switch to instruct the switch to adjust its own access mode from a read-only mode to a writable mode.

[0131] In an optional implementation, if the verification is passed, the MCU calls the mode adjustment interface provided by the switch to modify the access mode of the flash storage area of ​​the switch from read-only mode to writable mode. It is understandable that in writable mode, the flash storage area of ​​the switch is both readable and writable.

[0132] S620: In the writable mode, write the firmware upgrade data corresponding to the firmware upgrade instruction into the switch.

[0133] In an optional implementation, the MCU may directly write the firmware upgrade data in the firmware data storage area of ​​its own flash into the flash storage area of ​​the switch.

[0134] In an optional implementation, the MCU reads the firmware upgrade data from the firmware data storage area to the buffer, and calls a write data interface provided by the switch to write the firmware upgrade data to the flash storage area of ​​the switch.

[0135] It should be noted that since the storage address of each program file is stored in the parameter area of ​​the MCU, when the access mode of the flash storage area is writable mode, the MCU reads the storage address of the firmware upgrade data from the parameter area, and then reads the firmware upgrade data corresponding to the firmware upgrade instruction from the read storage address, and writes the firmware upgrade data to the flash storage area of ​​the switch.

[0136] S630: After writing is completed, the access mode is adjusted from the writable mode to the read-only mode.

[0137] Specifically, after determining that the firmware upgrade data is written completely, the MCU again calls the mode adjustment interface provided by the switch to modify the access mode of the flash storage area of ​​the switch from the writable mode to the read-only mode.

[0138] In the above embodiment, the process of writing the firmware upgrade data corresponding to the firmware upgrade instruction to the switch when the verification is passed is further refined. Before the firmware upgrade data is written, the flash storage area of ​​the switch is set to a locked mode, and is unlocked only when the verification is passed, thereby further improving the security of writing the firmware upgrade data.

[0139] In an exemplary embodiment, Figure 7 As shown, a switch firmware upgrade method is provided, which is applied to Figure 1 The tester 20 in the example is used as an example to illustrate, and the following steps are included:

[0140] S710: Send a firmware upgrade instruction for the switch to the MCU, so that the MCU generates first security verification information corresponding to the firmware upgrade instruction.

[0141] In an optional implementation, the tester may determine that there is a demand for switch firmware when it detects that there is user-input firmware upgrade data in the MCU, and send a firmware upgrade instruction for the switch to the MCU, so that the MCU generates first security verification information corresponding to the firmware upgrade instruction.

[0142] In an optional implementation, the tester may send a firmware upgrade instruction for the switch to the MCU when receiving the integrity check result and the feasibility check result sent by the MCU and both are verified to pass, so that the MCU generates first security verification information corresponding to the firmware upgrade instruction.

[0143] S720, sending second security verification information for the firmware upgrade instruction to the MCU, so that when the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information, the MCU writes the firmware upgrade data corresponding to the firmware upgrade instruction into the switch to perform the firmware upgrade.

[0144] In an optional implementation, after receiving the public key of the MCU, the tester can encrypt the firmware upgrade instruction issued by itself according to the public key of the MCU to obtain second security verification information, and send the second security verification information to the MCU, so that when the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information, the MCU writes the firmware upgrade data corresponding to the firmware upgrade instruction to the switch to perform the firmware upgrade.

[0145] In an optional implementation, a session key, such as a symmetric key or an asymmetric key, is predetermined between the MCU and the tester. The tester can encrypt the firmware upgrade instruction issued by itself according to the preset session key to obtain the second security verification information, and send the second security verification information to the MCU, so that when the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information, the MCU writes the firmware upgrade data corresponding to the firmware upgrade instruction to the switch to perform the firmware upgrade.

[0146] In the above-mentioned switch firmware upgrade method, the tester MCU sends a firmware upgrade instruction for the switch, so that after receiving the firmware upgrade instruction, the MCU generates the first security verification information corresponding to the firmware upgrade instruction before writing the firmware upgrade data corresponding to the firmware upgrade instruction to the switch. The tester sends the second security verification information corresponding to the firmware upgrade instruction to the MCU, so that the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information. Only when the verification passes, the MCU writes the firmware upgrade data to the switch. Compared with the prior art, the firmware upgrade data is directly written in response to the firmware upgrade instruction, which improves the security of the switch firmware upgrade, thereby avoiding damage to the switch caused by erroneous triggering of the firmware upgrade, and further avoiding the impact of the switch damage on the normal operation and data communication of the vehicle.

[0147] Based on the technical solutions of the above embodiments, the present application also provides an optional embodiment. In this embodiment, the process of the tester sending the second security verification information for the firmware upgrade instruction to the MCU is described in detail.

[0148] See also Figure 8 The second security verification information sending step shown includes:

[0149] S810: Send a first verification string corresponding to the firmware upgrade instruction to the MCU, so that the MCU generates first security verification information according to the first verification string and a second verification string generated by the MCU itself for the firmware upgrade instruction.

[0150] In an optional implementation, the tester can process the firmware upgrade instruction based on a preset data processing algorithm to obtain a first verification string, and send the first verification string to the MCU, so that the MCU obtains the first verification string corresponding to the firmware upgrade instruction sent by the tester.

[0151] In an optional implementation, the tester may send a randomly generated first verification string to the MCU after receiving a security verification start instruction sent by the MCU.

[0152] S820: Receive a second verification character string sent by the MCU.

[0153] S830: Generate second security verification information corresponding to the firmware upgrade instruction according to the first verification string and the second verification string.

[0154] Optionally, in this embodiment, the tester can encrypt the first verification string and the second verification string according to a preset encryption algorithm to obtain second security verification information. The preset encryption algorithm can be determined based on manual experience, and this application does not impose any restrictions on this. For example, the preset encryption algorithm can be a message authentication code based on a cipher block chain (Cipher Block Chaining-Message Authentication Code, CMAC).

[0155] It should be noted that the preset encryption algorithm used by the tester to generate the second security verification information can be the same as the preset encryption algorithm used by the MCU to generate the first security verification information. Accordingly, the verification of the firmware upgrade instruction is a consistency check of the first security verification information and the second security verification information.

[0156] S840: Send second security verification information to the MCU.

[0157] In the above embodiment, the process of the tester sending the second security verification information for the firmware upgrade instruction to the MCU is described in detail from the tester side, so that the switch firmware upgrade method of the present application is more complete.

[0158] Based on the technical solutions of the above embodiments, the present application further provides an optional embodiment. In this embodiment, the process of the tester sending the second security verification information for the firmware upgrade instruction to the MCU is refined.

[0159] See also Fig. 9The second security verification information sending step shown includes:

[0160] start.

[0161] S910, determining whether a firmware upgrade instruction is sent to the MCU within a preset time period.

[0162] The duration of the preset time period may be determined based on manual experience or through a large number of experiments, and there is no limitation on this.

[0163] For example, in this embodiment, after sending the firmware upgrade instruction to the MCU, the tester will record the sent firmware upgrade instruction, or store the sent firmware upgrade instruction to a preset address. The tester can check from the historical records or the preset address and determine whether the firmware upgrade instruction has been sent to the MCU within the preset time period.

[0164] S920: If yes, send second security verification information for the firmware upgrade instruction to the MCU.

[0165] S930: If not, prohibit sending the second security verification information for the firmware upgrade instruction to the MCU.

[0166] It should be noted that if the tester has not sent a firmware upgrade command to the MCU within the preset time period, it will not cooperate with the MCU to complete the verification process of the firmware upgrade command, causing the firmware upgrade command verification to fail, thereby terminating the firmware upgrade process to ensure the security of the switch firmware upgrade.

[0167] In order to facilitate those skilled in the art to understand the present solution, the present application also provides an optional embodiment. In this embodiment, the switch firmware upgrade method of the present application is described in detail.

[0168] See also Fig.10 The switch firmware upgrade method shown includes:

[0169] S1001, the MCU downloads the upgrade package containing the firmware upgrade data to the designated flash storage area through the tester.

[0170] It should be noted that when software engineers make an upgrade file package, they use special software tools to merge the switch firmware program (i.e., firmware upgrade data) with the APP application, and attach file verification information to form an upgrade file package; when the switch firmware needs to be upgraded, first use a tester, such as a car diagnostic instrument, OTA, etc. to download the upgrade file package to the designated flash application storage area, i.e., the firmware data storage area.

[0171] S1002, the MCU performs a file integrity check on the upgrade package and determines whether the file integrity check passes; if so, a positive response is fed back to the tester and S1003 is executed; if not, S1014 is executed.

[0172] S1003, the tester sends a firmware upgrade instruction to the MCU.

[0173] S1004, the MCU responds to the firmware upgrade instruction, performs a precondition test, and determines whether the test passes; if so, a positive response is fed back to the tester and S1005 is executed; if not, S1014 is executed.

[0174] Specifically, the precondition detection includes: whether the flash storage area of ​​the MCU contains the switch firmware program, whether the vehicle speed is stationary, and whether the vehicle is in a parking state.

[0175] S1005 , in response to the positive response fed back by the MCU, the tester sends a security seed (ie, a first verification string, a random string RAND_C) to the MCU.

[0176] S1006, the MCU generates KEY_S by calculation based on the random string RAND_C and the random string RAND_S generated by itself.

[0177] Specifically, the MCU processes the random character string RAND_C and the random character string RAND_S according to the CMAC algorithm to generate KEY_S, that is, the first security verification information.

[0178] S1007, the MCU sends a random character string RAND_S, ie, a second verification character string, to the tester.

[0179] S1008, the tester calculates and generates KEY_C, ie, the second security verification information, based on the random character string RAND_C and the random character string RAND_S generated by itself.

[0180] Specifically, the tester processes the random character string RAND_C and the random character string RAND_S according to the CMAC algorithm to generate KEY_C.

[0181] S1009: The tester sends KEY_C to the MCU.

[0182] S1010, the MCU determines whether KEY_C is consistent with the KEY_S generated by itself. If so, S1011 is executed; if not, S1014 is executed.

[0183] S1011, the MCU calls the interface provided by the switch to modify the read-write mode of the flash storage area of ​​the switch, changing it from read-only mode to writable mode.

[0184] S1012, the MCU reads the switch firmware upgrade data from the flash storage area designated by the MCU for storing the switch firmware data to the buffer, and calls the write data interface provided by the switch chip to write the firmware upgrade data to the flash storage area for storing the firmware of the switch chip.

[0185] It should be noted that each time the MCU reads or writes, the MCU software will detect whether the number of remaining bytes is 0. If it is not 0, it will continue to read in a loop until all the firmware programs stored in the flash area of ​​the MCU are read and written.

[0186] S1013, after the MCU determines that the firmware upgrade data is written, it calls the switch interface again to change the flash storage area of ​​the switch to read-only mode.

[0187] S1014, the MCU feeds back a negative response to the tester and exits the upgrade process.

[0188] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0189] Based on the same inventive concept, the embodiment of the present application also provides a switch firmware upgrade device 1 for implementing the switch firmware upgrade method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more switch firmware upgrade device embodiments provided below can refer to the limitations on the switch firmware upgrade method above, and will not be repeated here.

[0190] In an exemplary embodiment, Fig.11 As shown, a switch firmware upgrade device is provided, including: an instruction acquisition module 1110, an information acquisition module 1120, an information verification module 1130 and a firmware upgrade module 1140, wherein:

[0191] The instruction acquisition module 1110 is used to acquire a firmware upgrade instruction for the switch.

[0192] The MCU and the switch are arranged in the electronic control unit ECU of the vehicle.

[0193] The information acquisition module 1120 is used to generate first security verification information corresponding to the firmware upgrade instruction in response to the firmware upgrade instruction, and to acquire second security verification information corresponding to the firmware upgrade instruction from the tester.

[0194] The information verification module 1130 is used to verify the firmware upgrade instruction according to the first security verification information and the second security verification information.

[0195] The firmware upgrade module 1140 is used to write the firmware upgrade data corresponding to the firmware upgrade instruction into the switch if the verification passes, so as to perform firmware upgrade on the switch.

[0196] In one embodiment, the information acquisition module 1120 includes a first acquisition unit, used to acquire a first verification string corresponding to a firmware upgrade instruction sent by the tester; a first sending unit, used to generate a second verification string corresponding to the firmware upgrade instruction, and send the second verification string to the tester; a first generation unit, used to generate first security verification information corresponding to the firmware upgrade instruction based on the first verification string and the second verification string; and a second acquisition unit, used to acquire second security verification information generated by the tester based on the first verification string and the second verification string.

[0197] In one embodiment, the first generation unit is specifically used to generate the first security verification information corresponding to the firmware upgrade instruction using a preset encryption algorithm based on the first verification string and the second verification string; the second acquisition unit is used to acquire the second security verification information generated by the tester using the preset encryption algorithm based on the first verification string and the second verification string. Correspondingly, the information verification module 1130 includes a first verification unit, which is used to determine that the firmware upgrade instruction verification has passed if the first security verification information is the same as the second security verification information; and a second verification unit, which is used to determine that the firmware upgrade instruction verification has not passed if the first security verification information is different from the second security verification information.

[0198] In one embodiment, a firmware data storage area and a firmware data backup area are provided in the MCU; the firmware data storage area stores the firmware upgrade data corresponding to the current firmware upgrade, and the firmware data backup area stores the firmware upgrade data backed up after each successful firmware upgrade; the switch firmware upgrade device also includes a data replacement module, which is used to replace the firmware upgrade data in the firmware data storage area with the latest backup data stored in the firmware data backup area if the instruction initiator of the firmware upgrade instruction is different from the tester.

[0199] In one embodiment, the firmware upgrade module 1140 includes a first mode adjustment unit, which is used to adjust the access mode of the switch from a read-only mode to a writable mode if the verification passes; a data writing unit, which is used to write the firmware upgrade data corresponding to the firmware upgrade instruction to the switch in the writable mode; and a second mode adjustment unit, which is used to adjust the access mode from the writable mode to the read-only mode after the writing is completed.

[0200] In an exemplary embodiment, Fig.12 As shown, a switch firmware upgrade device 2 is provided, including: an instruction sending module 1210 and an instruction sending module 1210 wherein:

[0201] The instruction sending module 1210 is used to send a firmware upgrade instruction for the switch to the MCU, so that the MCU generates first security verification information corresponding to the firmware upgrade instruction.

[0202] The information sending module 1220 is used to send the second security verification information for the firmware upgrade instruction to the MCU, so that when the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information, the firmware upgrade data corresponding to the firmware upgrade instruction is written into the switch to perform the firmware upgrade.

[0203] In one embodiment, the information sending module 1220 includes a second sending unit, which is used to send a first verification string corresponding to a firmware upgrade instruction to the MCU, so that the MCU generates first security verification information based on the first verification string and a second verification string generated by itself for the firmware upgrade instruction; a first receiving unit, which is used to receive the second verification string sent by the MCU; an information verification unit, which is used to generate second security verification information corresponding to the firmware upgrade instruction based on the first verification string and the second verification string; and a third sending unit, which is used to send the second security verification information to the MCU.

[0204] In one embodiment, both the first security verification information and the second security verification information are generated using a preset encryption algorithm; accordingly, the information sending module 1220 is used to send the second security verification information for the firmware upgrade instruction to the MCU, so that the MCU verifies the firmware upgrade instruction as a consistency check between the first security verification information and the second security verification information. If the verification passes, the firmware upgrade data corresponding to the firmware upgrade instruction is written to the switch to perform the firmware upgrade.

[0205] In one embodiment, the information sending module 1220 includes an instruction judgment unit, which is used to determine whether a firmware upgrade instruction is sent to the MCU within a preset time period; a fourth sending unit, which is used to send second security verification information for the firmware upgrade instruction to the MCU if so; and a fifth sending unit, which is used to prohibit sending the second security verification information for the firmware upgrade instruction to the MCU if not.

[0206] Each module in the switch firmware upgrade device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0207] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.13 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a switch firmware upgrade method is implemented.

[0208] Those skilled in the art will understand that Fig.13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0209] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0210] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0211] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0212] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0213] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0214] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A switch firmware upgrade method, characterized in that: The method comprises: Obtaining a firmware upgrade instruction for the switch; wherein the microcontroller unit MCU and the switch are arranged in an electronic control unit ECU of the vehicle; In response to the firmware upgrade instruction, generating first security verification information corresponding to the firmware upgrade instruction, and acquiring second security verification information corresponding to the firmware upgrade instruction from a tester; Verifying the firmware upgrade instruction according to the first security verification information and the second security verification information; If the verification passes, the firmware upgrade data corresponding to the firmware upgrade instruction is written into the switch to perform a firmware upgrade on the switch.

2. The method according to claim 1, characterized in that The generating the first security verification information corresponding to the firmware upgrade instruction, and acquiring the second security verification information corresponding to the firmware upgrade instruction from the tester, comprises: Obtaining a first verification string corresponding to the firmware upgrade instruction sent by the tester; Generate a second verification string corresponding to the firmware upgrade instruction, and send the second verification string to the tester; Generate first security verification information corresponding to the firmware upgrade instruction according to the first verification string and the second verification string; Acquire second security verification information generated by the tester based on the first verification string and the second verification string.

3. The method according to claim 2, characterized in that The first security verification information and the second security verification information are both generated using a preset encryption algorithm; Correspondingly, verifying the firmware upgrade instruction according to the first security verification information and the second security verification information includes: If the first security verification information is the same as the second security verification information, determining that the firmware upgrade instruction verification has passed; If the first security verification information is different from the second security verification information, it is determined that the firmware upgrade instruction verification fails.

4. The method according to any one of claims 1 to 3, characterized in that The MCU is provided with a firmware data storage area and a firmware data backup area; The firmware data storage area stores the firmware upgrade data corresponding to the current firmware upgrade, and the firmware data backup area stores the firmware upgrade data backed up after each successful firmware upgrade; If the instruction initiator of the firmware upgrade instruction is different from the tester, the latest backup data stored in the firmware data backup area is used to replace the firmware upgrade data in the firmware data storage area.

5. The method according to any one of claims 1 to 3, characterized in that: If the verification is passed, writing the firmware upgrade data corresponding to the firmware upgrade instruction into the switch includes: If the verification is passed, the access mode of the switch is adjusted from the read-only mode to the writable mode; In the writable mode, writing the firmware upgrade data corresponding to the firmware upgrade instruction into the switch; After writing is completed, the access mode is adjusted from the writable mode to the read-only mode.

6. A switch firmware upgrade method, characterized in that: The method comprises: Sending a firmware upgrade instruction for the switch to the MCU, so that the MCU generates first security verification information corresponding to the firmware upgrade instruction; Sending second security verification information for the firmware upgrade instruction to the MCU, so that when the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information, the MCU writes the firmware upgrade data corresponding to the firmware upgrade instruction into the switch to perform firmware upgrade.

7. The method according to claim 6, characterized in that The sending second security verification information for the firmware upgrade instruction to the MCU includes: Sending a first verification string corresponding to the firmware upgrade instruction to the MCU, so that the MCU generates the first security verification information according to the first verification string and a second verification string generated by the MCU itself for the firmware upgrade instruction; Receiving the second verification string sent by the MCU; Generate second security verification information corresponding to the firmware upgrade instruction according to the first verification string and the second verification string; The second security verification information is sent to the MCU.

8. The method according to claim 6, characterized in that The sending second security verification information for the firmware upgrade instruction to the MCU includes: Determine whether the firmware upgrade instruction is sent to the MCU within a preset time period; If yes, sending second security verification information for the firmware upgrade instruction to the MCU; If not, sending the second security verification information for the firmware upgrade instruction to the MCU is prohibited.

9. A switch firmware upgrade device, characterized in that: The device comprises: An instruction acquisition module, used to acquire a firmware upgrade instruction for a switch; wherein the MCU and the switch are arranged in an electronic control unit ECU of a vehicle; an information acquisition module, configured to generate first security verification information corresponding to the firmware upgrade instruction in response to the firmware upgrade instruction, and to acquire second security verification information corresponding to the firmware upgrade instruction from a tester; An information verification module, configured to verify the firmware upgrade instruction according to the first security verification information and the second security verification information; The firmware upgrade module is used to write the firmware upgrade data corresponding to the firmware upgrade instruction into the switch if the verification is passed, so as to perform firmware upgrade on the switch.

10. A switch firmware upgrade device, characterized in that: The device comprises: An instruction sending module, used for sending a firmware upgrade instruction for the switch to the MCU, so that the MCU generates first security verification information corresponding to the firmware upgrade instruction; The information sending module is used to send second security verification information for the firmware upgrade instruction to the MCU, so that when the MCU verifies the firmware upgrade instruction according to the first security verification information and the second security verification information, the MCU writes the firmware upgrade data corresponding to the firmware upgrade instruction into the switch to perform firmware upgrade.