Vehicle diagnosis function control method and device, equipment and storage medium

By dividing the curable and withdrawable functions in the vehicle diagnostic system and encapsulating them into a function interface for call, the risk of damage and storage space during Bootloader updates is solved, and the update flexibility and stability of the diagnostic function is improved.

CN119179532APending Publication Date: 2024-12-24CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411327226.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-23
Publication Date
2024-12-24

AI Technical Summary

Technical Problem

In the vehicle diagnostic system, there are problems such as risk of damage and large storage space when updating the Bootloader, resulting in increased maintenance costs and time, and poor update flexibility.

Method used

By dividing the subfunctions of the vehicle diagnostic service into solidification function and extractable function, encapsulate it into a function interface, and constructing a function index table, writing the solidification function to the startup loader, using the startup loader to execute the solidification function, and calling the function interface to execute it It can extract functions to achieve function updates and management.

Benefits of technology

Simplifies the storage space occupied by the startup loader, improves the flexibility and stability of updates, and reduces the risk of the system being unable to start due to Bootloader corruption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119179532A_ABST
    Figure CN119179532A_ABST
Patent Text Reader

Abstract

The invention provides a vehicle diagnosis function control method and device, equipment and a storage medium, and the method comprises the steps: dividing different sub-functions corresponding to each diagnosis service in a vehicle, and determining a first function and a second function, the first function comprises a fixed diagnosis function, and the second function comprises a dissociable diagnosis function; packaging each second function into a function interface, and constructing a function index table based on each function interface; respectively writing each first function and the function index table into a startup loading program, wherein the startup loading program is configured in the vehicle; and if the vehicle is diagnosed, executing the first function by using the boot loader, and calling the function interface to execute the second function. Therefore, the boot loader is simplified, the storage space occupied by the boot loader integrated with the diagnosis function is reduced, and the flexibility of updating the diagnosis function in the boot loader is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of vehicle diagnostic technology, and in particular to a vehicle diagnostic function control method, device, equipment and storage medium. Background Art

[0002] The application of Bootloader (i.e., boot loader) in vehicle diagnostic system is crucial, and it is usually embedded in the ECU (electronic control unit) or similar embedded system board in the vehicle. Taking embedding in ECU as an example, Bootloader is used to flash ECU, that is, to update the program or data inside ECU using the UDS (Unified Diagnostic Services) diagnostic service integrated in Bootloader, which greatly simplifies the update process of ECU software and improves the efficiency and security of software update. However, during the update process of Bootloader, if the Bootloader is damaged due to an update failure, the ECU may not be able to start normally, and needs to be returned to the factory and re-burned with a specific burner, which will increase the maintenance cost and time.

[0003] In the related art, a dual bootloader mechanism can be used. By designing two bootloaders in the ECU, namely a main bootloader and a backup bootloader, additional fault tolerance can be provided. When a problem occurs in the main bootloader, the backup bootloader can take over the boot process and try to repair or restore the main bootloader. This can reduce the risk of the system failing to boot due to bootloader damage and reduce maintenance costs and time. However, with the dual bootloader mechanism, on the one hand, there is still a risk of damage when any bootloader is updated, and the update flexibility is poor; on the other hand, the storage space occupied by the two bootloaders is large. Summary of the invention

[0004] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.

[0005] In view of the above-mentioned shortcomings of the prior art, the present application discloses a vehicle diagnostic function control method, device, equipment and storage medium to solve at least one of the above-mentioned technical problems.

[0006] In a first aspect, the present application provides a vehicle diagnostic function control method, the method comprising: dividing different sub-functions corresponding to each diagnostic service in the vehicle, determining a first function and a second function, the first function comprising a fixed diagnostic function, and the second function comprising a detachable diagnostic function; encapsulating each of the second functions into a function interface, and constructing a function index table based on each of the function interfaces; writing each of the first functions and the function index table into a boot loader, respectively, and the boot loader is configured in the vehicle; if the vehicle is diagnosed, the boot loader is used to execute the first function, and the function interface is called to execute the second function.

[0007] In one embodiment of the present application, after encapsulating each of the second functions into a function interface, it also includes: if a first update file regarding a vehicle diagnostic service is received, each of the function interfaces is matched based on the first update file to determine a target function interface, the first update file including an update package for the second function to be updated; according to the target function interface, the current compiled code of the second function is retrieved; based on the update package, the compiled code corresponding to the same second function is updated; if a second update file regarding a vehicle diagnostic service is received, a new function interface is constructed based on the second update file, the second update file including the compiled code for the second function to be added; and the new function interface is written into the function index table.

[0008] In one embodiment of the present application, the calling of the function interface to execute the second function includes: when executing any of the second functions, detecting a preset flash file, wherein the preset flash file is formed by the compiled code of each second function; if the preset flash file is detected to be correct, executing the second function; if the preset flash file is detected to be erroneous, skipping the execution of all the second functions and executing the first function.

[0009] In one embodiment of the present application, the calling of the function interface to execute the second function includes: when executing any of the second functions, detecting whether a preset flash instruction is received, the preset flash instruction is used to indicate not to execute the second function; if the preset flash instruction is received, skipping the execution of all the second functions and executing the first function; if the preset flash instruction is not received, executing the second function.

[0010] In one embodiment of the present application, before constructing a function index table based on each of the function interfaces, it also includes: abstracting each of the second functions separately, and the abstraction includes converting each of the second functions into a corresponding function function; dividing a preset memory according to each of the function functions, and determining a memory area for storing each of the function functions, and the preset memory is located in a server or the vehicle; constructing the function interface of each of the function functions, and defining a function pointer of each of the function functions, and the function pointer is used to point to the starting address of the function function in the memory area; associating the function interface and the function pointer of each of the function functions.

[0011] In one embodiment of the present application, the function index table is constructed based on each of the function interfaces, including: storing the function pointers associated with each of the function interfaces in the function index table in sequence, so that the offset addresses stored between two adjacent function pointers are the same; if a new function interface is added, the function pointer associated with the newly added function interface is stored based on the offset address to create a new function index table.

[0012] In one embodiment of the present application, after writing each of the first functions and the function index table into the boot loader respectively, it also includes: if a first global variable of the first function and a second global variable of the second function are defined in the boot loader, then determining the memory addresses corresponding to the first global variable and the second global variable respectively; if there is a conflict between the memory addresses corresponding to the first global variable and the second global variable respectively, then reconfiguring the memory address of the second global variable.

[0013] In the second aspect, the present application provides a vehicle diagnostic function control device, the device comprising: a division module, used to divide different sub-functions corresponding to each diagnostic service in the vehicle, and determine a first function and a second function, the first function including a fixed diagnostic function, and the second function including a detachable diagnostic function; a construction module, used to encapsulate each of the second functions into a function interface, and construct a function index table based on each of the function interfaces; a writing module, used to write each of the first functions and the function index table into a boot loader, and the boot loader is configured in the vehicle; a diagnostic module, used to use the boot loader to execute the first function when the vehicle is diagnosed, and call the function interface to execute the second function.

[0014] In a third aspect, the present application also provides an electronic device comprising: a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement the vehicle diagnostic function control method as described in the above embodiment.

[0015] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor of a computer, the computer executes the vehicle diagnostic function control method as described in the above embodiments.

[0016] Beneficial effects of the present application: The present application proposes a vehicle diagnostic function control method, device, equipment and storage medium. By dividing the different sub-functions corresponding to each diagnostic service in the vehicle, the first function and the second function are determined, the first function includes a fixed diagnostic function, and the second function includes a removable diagnostic function; then each second function is encapsulated into a function interface, and a function index table is constructed based on each function interface; and each first function and the function index table are written into the boot loader, and the boot loader is configured in the vehicle; if the vehicle is diagnosed, the boot loader is used to execute the first function, and the function interface is called to execute the second function. In this way, the indispensable sub-functions in the vehicle diagnostic process are divided into the first function, which is solidified in the boot loader, and the remaining sub-functions are divided into the second function, which is extracted from the boot loader and encapsulated into a function interface for calling, which simplifies the boot loader, significantly reduces the storage space occupied by the boot loader, and improves the flexibility of updating the boot loader integrated with the diagnostic function, that is, the first function is updated through the vehicle's CAN (controller area network) bus, and the function interface is increased or decreased or the second function corresponding to the existing function interface is updated to complete the update of the second function in the boot loader.

[0017] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0019] Figure 1 is a flowchart pre-programmed in a diagnostic process shown by an exemplary embodiment of the present application;

[0020] Figure 2 is a flowchart of a main programming in a diagnostic process shown in an exemplary embodiment of the present application;

[0021] Figure 3 is a flowchart of post-programming during a diagnostic process shown in an exemplary embodiment of the present application;

[0022] Figure 4 is a schematic diagram of an implementation environment of a vehicle diagnostic function control method shown in an exemplary embodiment of the present application;

[0023] Figure 5 is a flow chart of a vehicle diagnostic function control method shown in an exemplary embodiment of the present application;

[0024] Figure 6 is a block diagram of a vehicle diagnostic function control device shown in an exemplary embodiment of the present application;

[0025] Figure 7 It is a structural diagram of a computer system suitable for implementing the electronic device of the present application, shown as an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0026] The following will describe the implementation methods of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, not for limiting the scope of protection of the present application.

[0027] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.

[0028] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.

[0029] See also Figures 1 to 3 , respectively, are flowcharts of pre-programming, main programming and post-programming in a diagnostic process according to an exemplary embodiment of the present application. Figures 1 to 3As shown in the figure, the process of flashing ECU with Bootloader is usually divided into three steps: pre-programming, main programming and post-programming. P stands for physical addressing, and F stands for functional addressing. Functional addressing usually notifies all ECUs on the CAN bus, and physical addressing is a one-to-one notification. Figure 1 As shown in the figure, first, based on the 01 sub-function (default session) in the 10 service (diagnostic session control) of the UDS (Unified Diagnostic Services) protocol, a normal ECU is established or requested to enter the default session mode, and then the ECU is requested to read the DID (Data Identifier) ​​data through the service identifier (Service Identifier, SID) 0x22. "22XX XX" is a simplified representation used to illustrate the request format of the service and the possible DID value; then the vehicle ECU is requested to enter the extended session mode through the 03 sub-function (extended session) of the 10 service in the UDS protocol for subsequent operations; after entering the session mode, based on 31 01 02 03 This specific service request checks whether the ECU meets the flashing conditions, such as the vehicle is stationary, the power supply voltage is stable (the power supply voltage is within the allowable range, such as 9V to 16V), the ECU is in a programmable session, and the data integrity and security are guaranteed; based on the 02 sub-function of the 85 service in the UDS protocol, the ECU's fault code (DTC) recording function is turned off to avoid unnecessary fault codes during the flashing process, and then based on shutting down communication: stop non-diagnostic communication between the ECU and other devices to reduce interference during the flashing process; finally, based on the 03 sub-function of the 28 service (communication control service) in the UDS protocol, the message reception and transmission are turned off, and the third byte 01 is used to specify the message type.

[0030] The main programming steps are as follows Figure 2 As shown, first, the ECU enters the programming session mode by sending a programming session request; then, the ECU is securely accessed to unlock the ECU-specific security level for flashing operations; next, the Flash driver (also known as Flashdriver, which is a program responsible for writing operations to the internal Flash memory of the ECU) is flashed to the specified area of ​​the ECU to ensure that subsequent applications can be correctly and efficiently written to the Flash memory of the ECU; then, the new application is flashed to the non-volatile memory (NVM) area of ​​the ECU; after the flashing is completed, the application compatibility test is performed, including verifying whether the newly flashed application is compatible with the hardware and other software components of the ECU, and checking whether the parameter configuration of the application meets the setting requirements of the current vehicle model through the security signature detection process.

[0031] The main programming steps are as follows Figure 3 As shown in the figure, after the flashing is completed, the ECU is restarted to load the newly flashed application in the ECU; then, the communication and DTC recording functions are restored, and the fault codes that may be generated during the flashing process are cleared; finally, the ECU is restored to the default session. It should be noted that the implementation of the main programming and each step in the main programming can refer to Figure 2 and Figure 3 The sub-functions of the different services based on the UDS protocol shown are not the focus of this application and will not be further described here.

[0032] To sum up, during the diagnostic process, multiple sub-functions of different services based on the UDS protocol are required. If all the functions involved in the diagnosis are integrated in the Bootloader, there will be high risks when the Bootloader is updated and the update flexibility will be poor. Based on this, the present application proposes a vehicle diagnostic function control method.

[0033] See also Figure 4 , is a schematic diagram of an implementation environment of a vehicle diagnostic function control method shown in an exemplary embodiment of the present application. Figure 4 As shown, the implementation environment includes a vehicle 410 and a controller 420, wherein the controller 420 is embedded in the vehicle 410, and is used to implement the vehicle diagnostic function control method, write each first function and function index table into a boot loader respectively, and the boot loader is configured in the controller 420.

[0034] See also Figure 5 , is a flow chart of a vehicle diagnostic function control method shown in an exemplary embodiment of the present application. The method can be applied to Figure 4 The implementation environment shown in FIG. 1 is shown in FIG. 1 . It should be understood that the method may also be applicable to other exemplary implementation environments, and this embodiment does not limit the implementation environment to which the method is applicable. Figure 5 As shown, in an exemplary embodiment, the vehicle diagnostic function control method includes at least steps S510 to S540, which are described in detail as follows:

[0035] Step S510, different sub-functions corresponding to each diagnostic service in the vehicle are divided to determine a first function and a second function, wherein the first function includes a fixed diagnostic function, and the second function includes a detachable diagnostic function.

[0036] In one embodiment of the present invention, the diagnostic service is a service based on the UDS protocol. The sub-functions corresponding to the diagnostic services necessary in the flashing process are divided into a first function and retained in the boot loader, that is, the diagnostic services necessary for ECU flashing are retained in the program; the sub-functions corresponding to the remaining diagnostic services are divided into a second function, extracted from the boot loader, and subsequently written into the boot loader in the form of a function interface, thereby simplifying the code logic of the boot loader. Among them, the first function includes at least session control service (Session Control, 0x10), request download service (Request Download, 0x34), transfer data service (Transfer Data, 0x36), request transfer termination service (Request TransferExit, 0x37), data verification service (such as the verification part in the erase / program / verification cycle, usually related to the routine control service), and ECU reset service (ECU Reset, 0x11); the second function may include session switching of service 10 (diagnostic session control service), security authentication of service 27 (security access service), reading DID data of service 22 (read data by identifier service), consistency verification of service 2e (write data by identifier service), and service 31 (routine control service), as well as pre-programming verification, etc.

[0037] In one embodiment of the present application, a session control service is used to control entry and exit of a diagnostic session, including switching from a default session to an extended session or a programming session, and finally returning to the default session. The extended session is usually used to access control parameters or perform non-critical diagnostic operations, and the programming session is used for software updates; a request download service is used to notify the ECU to prepare to receive new software or data and prepare for data transmission; a transmission data service is used to transmit new software or data to the ECU, for example, by dividing the software or data into multiple blocks through a client (such as a diagnostic tool), and sending them one by one to the ECU through this service; a request transmission termination service is used to notify the ECU to stop receiving data after completing the data transmission, and may start performing data verification or prepare to jump to the new software; a data verification service is used to verify the integrity and correctness of the new software or data transmitted to the ECU to ensure that the new software or data is not damaged or erroneous; an ECU reset service notifies the ECU to reset after the software update is completed in order to load and execute the new software.

[0038] Step S520: encapsulate each second function into a function interface, and construct a function index table based on each function interface.

[0039] Specifically, each second function is abstracted separately, and the abstraction includes converting each second function into a corresponding function function; dividing the preset memory according to each function function, determining the memory area where each function function is stored, and the preset memory is set in a server or a vehicle; constructing a function interface for each function function, and defining a function pointer for each function function, and the function pointer is used to point to the starting address of the function function in the memory area; associating the function interface and function pointer of each function function.

[0040] In one embodiment of the present application, the second function is abstracted into a specific function implementation, i.e., a function function, which encapsulates the code for implementing the second function, thereby improving the maintainability, reusability and portability of the second function. According to the requirements of each function function, the preset memory space is divided to ensure that each function function has enough memory area to store its data and execute code, while avoiding memory conflicts between different second functions. The function interface defines how the function function is called externally, including the name of the function, the parameter list and the return value type, so that even if the implementation details of the function function are not understood, the function function can be executed by interacting through the function interface. The function pointer is used to point to the entry address of the function function, i.e., the starting address of the function function in the memory area, so that the corresponding function function can be indirectly called through the function pointer. The function interface and function pointer of the same function function are associated, so that when the function function is called through the function interface, it is essentially jumped to the entry address of the function function through the function pointer and points to the function function to realize the execution of the corresponding second function.

[0041] In one embodiment of the present application, the function interface may also be associated with a pointer to an error flag, which the function uses to report any errors or exceptions that occur during execution. The function interface may also be associated with a pointer to an output data buffer, into which the function writes the processed result or response data.

[0042] In one embodiment of the present application, the function interface and the function index table are preferably generated based on the IAR tool (IAR Embedded Workbench). Using the IAR tool, only the code of the function function can be generated without generating additional irrelevant data, thereby ensuring the indirectness of the code and high reusability, which can ensure the transplantation of the second function.

[0043] Specifically, the function pointers associated with each function interface are stored in the function index table in sequence so that the offset addresses stored between two adjacent function pointers are the same; if a new function interface is added, the function pointers associated with the new function interface are stored based on the offset address to create a new function index table.

[0044] In one embodiment of the present application, the function index table is an interrupt vector index table, which stores the starting address of each function function, i.e., a function pointer. Taking the configuration of four function interfaces in the function index table as an example, at this time, only four function pointers are stored in the function index table, and the size of each function pointer is the same, so the function pointer usually occupies 4 bytes, so the size of the function index table is 16 bytes, and therefore, the offset addresses of two adjacent function pointers stored in the vector table are both 4 bytes. In this way, the function index table is easy to manage, and when a new function interface needs to be added, the function index table needs to expand the size of an offset address, i.e., increase 4 bytes, for storing the new function pointer. In addition, the size of the function index table can be fixed.

[0045] Through the above method, the address size of each function pointer in the function index table is the same, which simplifies the logic of accessing the function index table. Any function can be accessed directly by calculating the offset between the starting address of the function index table and the address of each function pointer, thereby improving the access speed.

[0046] Specifically, if a first update file regarding a vehicle diagnostic service is received, each function interface is matched based on the first update file to determine a target function interface, the first update file including an update package for a second function to be updated; the current compiled code of the second function is retrieved according to the target function interface; the compiled code corresponding to the same second function is updated based on the update package; if a second update file regarding a vehicle diagnostic service is received, a new function interface is constructed based on the second update file, the second update file including the compiled code for the second function to be added; and the new function interface is written into a function index table.

[0047] In one embodiment of the present application, when the first update file is received, all function interfaces are traversed, and the function interface matching the second function to be updated included in the first update file is determined as the target function interface, and then based on the target function interface, the compiled code currently stored in the memory area corresponding to the second function to be updated is determined, and the original compiled code is replaced or modified based on the update package, thereby completing the update of the second function. In this way, the second function called in the boot loader can be quickly updated, which improves the flexibility of the diagnostic function update.

[0048] In one embodiment of the present application, if a third update file about a vehicle diagnostic service is received, the function interface in the function index table is deleted based on the third update file, and the third update file includes the second function to be deleted. In this way, the second update file and the third update file are combined, so that the boot loader can quickly and accurately add or delete the second function, while enhancing the scalability of the boot loader, further reducing potential errors or conflicts caused by the update, and improving the stability and reliability of the boot loader when updating the diagnostic function.

[0049] In one embodiment of the present application, the first function can be updated directly through the CAN bus of the vehicle.

[0050] In one embodiment of the present application, the compiled file of the second function includes a function of the same second function. The execution of the function is a part of the execution of the compiled code, and the compiled code is the running carrier of the function.

[0051] Step S530, writing each first function and the function index table into a boot loader respectively, and the boot loader is configured in the vehicle.

[0052] Specifically, if a first global variable with a first function and a second global variable with a second function are defined in the boot loader, the memory addresses corresponding to the first global variable and the second global variable are determined; if there is a conflict in the memory addresses corresponding to the first global variable and the second global variable, the memory address of the second global variable is reconfigured.

[0053] In one embodiment of the present application, the second function preferably transmits data in the form of function input parameters, that is, directly passing parameters to the function function through the function interface, which is used for data processing or logical judgment inside the function function, and completely avoiding dependence on global variables as much as possible to reduce the coupling between the first function and the second function, and improve the portability and maintainability of the code of the second function. If the second function does need to use global variables, it is necessary to ensure that the global variables of the first function, that is, the first global variable will not conflict with the global variables of the second function, that is, the second global variable, and therefore, it is necessary to use different memory areas to store the two global variables. Among them, the memory addresses of the two global variables are mapped by register pointers. If there is a conflict in the memory address, it is necessary to reconfigure the register pointer corresponding to the second global variable.

[0054] Step S540: If the vehicle is to be diagnosed, the boot loader is used to execute the first function, and the function interface is called to execute the second function.

[0055] Specifically, when executing any second function, the preset flash file is detected, which is formed by the compiled code of each second function; if the preset flash file is detected to be correct, that is, not damaged and the version matches, the second function is executed; if the preset flash file is detected to be wrong, the execution of all second functions is skipped and the first function is executed. When executing any second function, it is detected whether a preset flash instruction is received, and the preset flash instruction is used to indicate not to execute the second function; if the preset flash instruction is received, the execution of all second functions is skipped and the first function is executed; if the preset flash instruction is not received, the second function is executed.

[0056] In one embodiment of the present application, by detecting the preset flash file of the second function, it is possible to ensure that the necessary data and code are complete and correct before executing the second function, and incorrect execution of the second function will lead to more serious failures. In addition, when there is a problem with the flashing of the ECU, the ECU can be forced to flash through the preset flashing instructions.

[0057] In one embodiment of the present application, a flag bit for executing the instructing boot loader may be generated to control the boot loader to execute or skip the second function. The flag bit may be stored in a memory or a specific register of the ECU.

[0058] The vehicle diagnostic function control method proposed in the present application has the following advantages: by dividing the indispensable sub-functions in the vehicle diagnostic process into the first function, solidifying it in the boot loader, dividing the remaining sub-functions into the second function, extracting the boot loader, and encapsulating it into a function interface for calling. First, it simplifies the boot loader and significantly reduces the storage space occupied by the boot loader; second, it improves the flexibility of updating the boot loader, that is, updating the first function through the vehicle's CAN bus, and adding or reducing the function interface or updating the second function corresponding to the existing function interface, so as to complete the update of the second function in the boot loader.

[0059] See also Figure 6 , is a block diagram of a vehicle diagnostic function control device shown as an exemplary embodiment of the present application. The device can be applied to Figure 4 It should be understood that the present application does not limit the implementation environment of the device. Figure 6 As shown, in an exemplary embodiment, the vehicle diagnostic function control device at least includes a division module 610, a construction module 620, a writing module 630 and a diagnosis module 640, which are described in detail as follows:

[0060] A division module 610, for dividing different sub-functions corresponding to each diagnostic service in the vehicle, and determining a first function and a second function, wherein the first function includes a fixed diagnostic function, and the second function includes a removable diagnostic function;

[0061] A construction module 620, used to encapsulate each second function into a function interface, and construct a function index table based on each function interface;

[0062] A writing module 630, for writing each first function and the function index table into a boot loader respectively, the boot loader being configured in the vehicle;

[0063] The diagnosis module 640 is used to use the boot loader to execute the first function and call the function interface to execute the second function when diagnosing the vehicle.

[0064] It should be noted that the vehicle diagnostic function control device provided in the above embodiment and the vehicle diagnostic function control method provided in the above embodiment belong to the same concept, wherein the contents of the operations performed by each module have been described in detail in the method embodiment and will not be repeated here.

[0065] The present application also provides an electronic device, comprising: a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement a vehicle diagnostic function control method as in the above embodiment.

[0066] See also Figure 7 , shows a schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application. It should be noted that, Figure 7 The computer system 700 of the electronic device shown is only an example and should not bring any limitation to the functions and application scope of the embodiments of the present application.

[0067] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage part 708 to the random access memory (RAM) 703, such as executing the method in the above embodiment. In the RAM 703, various programs and data required for system operation are also stored. The CPU 701, the ROM 702 and the RAM 703 are connected to each other through the bus 704. The input / output (I / O) interface 705 is also connected to the bus 704.

[0068] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 704 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 709 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read therefrom is installed into the storage section 708 as needed.

[0069] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 709, and / or installed from a removable medium 711. When the computer program is executed by a central processing unit (CPU) 701, various functions defined in the system of the present application are executed.

[0070] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer executes the vehicle diagnostic function control method as described above. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0071] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, system or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, system or device. A computer program contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0072] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0073] The above embodiments are merely illustrative of the principles and effects of the present application, and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.

Claims

1. A vehicle diagnostic function control method, characterized in that: The method comprises: Different sub-functions corresponding to each diagnostic service in the vehicle are divided to determine a first function and a second function, wherein the first function includes a fixed diagnostic function and the second function includes a removable diagnostic function; Encapsulating each of the second functions into a function interface, and constructing a function index table based on each of the function interfaces; writing each of the first functions and the function index table into a boot loader respectively, wherein the boot loader is configured in the vehicle; If the vehicle is diagnosed, the first function is executed by using the boot loader, and the second function is executed by calling the function interface.

2. The vehicle diagnostic function control method according to claim 1, characterized in that: After encapsulating each of the second functions into a function interface, the method further includes: If a first update file for the vehicle diagnostic service is received, matching each of the function interfaces based on the first update file to determine a target function interface, wherein the first update file includes an update package of the second function to be updated; Calling the current compiled code of the second function according to the target function interface; Updating the compiled code corresponding to the same second function based on the update package; If a second update file for the vehicle diagnostic service is received, constructing a new function interface based on the second update file, wherein the second update file includes the compiled code for the second function to be added; The new function interface is written into the function index table.

3. The vehicle diagnostic function control method according to claim 2, characterized in that: The calling of the function interface to execute the second function includes: When executing any of the second functions, detecting a preset flash file, the preset flash file being formed by the compiled code of each of the second functions; If it is detected that the preset flash file is correct, the second function is executed; If an error is detected in the preset flash file, the execution of all the second functions is skipped and the first function is executed.

4. The vehicle diagnostic function control method according to claim 3, characterized in that: The calling of the function interface to execute the second function includes: When executing any of the second functions, detecting whether a preset flashing instruction is received, the preset flashing instruction is used to instruct not to execute the second function; If the preset flashing instruction is received, skipping the execution of all the second functions and executing the first function; If the preset flashing instruction is not received, the second function is executed.

5. The vehicle diagnostic function control method according to claim 1, characterized in that: Before constructing the function index table based on each of the function interfaces, the method further includes: Abstracting each of the second functions respectively, wherein the abstraction includes converting each of the second functions into a corresponding function function; Dividing a preset memory according to each of the functional functions to determine a memory area for storing each of the functional functions, wherein the preset memory is located in a server or the vehicle; Constructing the function interface of each of the function functions, and defining a function pointer of each of the function functions, wherein the function pointer is used to point to the starting address of the function in the memory area; The function interface and the function pointer of each functional function are associated.

6. The vehicle diagnostic function control method according to claim 5, characterized in that: The constructing a function index table based on each of the function interfaces includes: The function pointers associated with each of the function interfaces are sequentially stored in the function index table, so that the offset addresses stored between two adjacent function pointers are the same; If a new function interface is added, the function pointer associated with the newly added function interface is stored based on the offset address to create a new function index table.

7. The vehicle diagnostic function control method according to any one of claims 1 to 6, characterized in that: After writing each of the first functions and the function index table into a boot loader respectively, the method further includes: If a first global variable of the first function and a second global variable of the second function are defined in the boot loader, determining the memory addresses corresponding to the first global variable and the second global variable respectively; If the memory addresses corresponding to the first global variable and the second global variable conflict with each other, the memory address of the second global variable is reconfigured.

8. A vehicle diagnostic function control device, characterized in that: The device comprises: A division module, used to divide different sub-functions corresponding to each diagnostic service in the vehicle, and determine a first function and a second function, wherein the first function includes a fixed diagnostic function and the second function includes a removable diagnostic function; A construction module, used for encapsulating each of the second functions into a function interface, and constructing a function index table based on each of the function interfaces; a writing module, used for writing each of the first functions and the function index table into a boot loader respectively, wherein the boot loader is configured in the vehicle; The diagnostic module is used to use the boot loader to execute the first function and call the function interface to execute the second function when diagnosing the vehicle.

9. An electronic device, characterized in that: include: processor, memory, and communication bus; The communication bus is used to connect the processor and the memory; The processor is configured to execute the computer program stored in the memory to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is used to make a computer execute the method according to any one of claims 1 to 7.