Debugging method and device of vehicle Vehile code, electronic equipment and storage medium
By separating the Vehicle protocol code into in-vehicle and PC programs, the problems of long compilation time and low debugging efficiency in Android in-vehicle entertainment systems are solved, achieving a highly efficient compilation and debugging process and improving system development efficiency.
Patent Information
- Application Number
- CN202410965971.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-11-15
AI Technical Summary
In existing technologies, the Vehicle module of Android in-vehicle entertainment systems has long compilation time, low debugging efficiency, and difficulty in efficiently handling code changes caused by complex communication protocols and hardware variations.
The Vehicle protocol code is separated into in-vehicle program and PC program, which run on the in-vehicle and PC platforms respectively. Data interaction is carried out through network transmission, and debugging and compilation are performed using IDE tools on the PC platform.
It significantly improves compilation speed and debugging efficiency, reducing compilation time by more than 90%, improving debugging efficiency by more than 50%, and enhancing program scalability and portability.
Smart Images

Figure CN118964181A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device, and storage medium for debugging vehicle code. Background Art
[0002] In recent years, the emerging development trend of automobiles is intelligence. This development model increases the demand for the types and quantity of sensors in automobiles, and also increases the complexity and development difficulty of automobile communication protocols. At present, most in-vehicle entertainment systems use the Android system. Vehicle is the module in the Android car system responsible for the communication between the upper-layer application and the underlying modules MCU (microcontroller unit), ECU (electronic control unit) and other devices. It needs to process various functional modules, sensors and other related protocol data, and provide a standard communication interface for the upper-layer application.
[0003] During the development of the Vehicle module, as a native Android module, the framework code of the Vehicle module will basically not change, and the most changes are changes in the protocol processing code due to changes in hardware sensors or functional requirements. Since the Android system is an extremely large system, the source code is usually hundreds of GB bytes, and the compilation system is also extremely complex. When compiling a single module, it is also necessary to traverse all the source code, so the compilation time cost is also extremely expensive. On an ordinary desktop computer, the time spent on compiling the Vehicle module ranges from a few minutes to more than ten minutes, which greatly reduces the development efficiency. At the same time, as the Native software (native application) in the Android system, the debugging method of the Vehicle module is usually to print relevant log information during testing, or to use gdb+gdbserver (program debugger and program debugger program under Linux) for remote debugging. The former needs to analyze the context of the log data after the test is completed to troubleshoot the cause of the problem, and this method has the problem of low debugging efficiency. Summary of the invention
[0004] In view of this, in order to solve some or all of the above technical problems, the present application provides a vehicle code debugging method, device and electronic equipment.
[0005] In one aspect, a method for debugging a vehicle code includes:
[0006] The first code of the vehicle protocol is divided into a first vehicle-side program and a first PC-side program; the first vehicle-side program includes: a vehicle communication processing code; the first PC-side program includes: a vehicle communication protocol processing code;
[0007] Processing the first vehicle-side program to generate a second vehicle-side program, wherein the second vehicle-side program is used to communicate with the upper and lower layers of the vehicle-side and the second PC-side program respectively;
[0008] Processing the first PC-side program to generate a second PC-side program, where the second PC-side program is used to communicate with the second vehicle-side program;
[0009] Debug the second vehicle-side program and the second PC-side program;
[0010] After successful debugging, the second vehicle-side program and the second PC-side program are merged to generate a second code of the Vehicle protocol.
[0011] Optionally, the step of processing the first vehicle-side program to generate the second vehicle-side program is specifically: retaining the following modules in the first code: a module for receiving upper-layer application downlink data, used to receive upper-layer application downlink attribute data sent by the upper-layer application; a module for reporting upper-layer application uplink data, used to send upper-layer application uplink attribute data to the upper-layer application; a module for sending bottom-layer module downlink data, used to send bottom-layer module downlink protocol data; and a module for collecting bottom-layer module uplink data, used to receive bottom-layer module uplink protocol data reported by the bottom-layer module;
[0012] Add the following modules: an upper-layer application downlink data queue module, used to store the received upper-layer application downlink attribute data; a sending upper-layer application downlink data module, used to forward the received upper-layer application downlink attribute data to the second PC-end program; a receiving upper-layer application uplink data module, used to receive the upper-layer application uplink attribute data generated by the second PC-end program decoding the underlying module protocol data; an upper-layer application uplink data queue module, used to store the received upper-layer application uplink attribute data to be reported; a underlying module downlink data queue module, used to store the received underlying module downlink attribute data; a sending underlying module downlink data module, used to send the received underlying module downlink attribute data to the underlying module; a collecting upper-layer application uplink data module, used to receive the underlying module uplink protocol original data sent by the underlying module; and a underlying module uplink data queue module, used to store the collected underlying module uplink protocol original data.
[0013] Optionally, the processing of the first PC-side program to generate the second PC-side program specifically includes:
[0014] The following modules in the first code are retained: a downlink data processing module, which is used to process the downlink attribute data of the upper layer application sent by the upper layer application, and convert it into the downlink protocol data of the lower layer module corresponding to the lower layer module; an uplink data processing module, which is used to process the uplink protocol data of the lower layer module reported by the lower layer module, and convert it into the uplink attribute data of the upper layer application corresponding to the upper layer application;
[0015] Add the following modules:
[0016] A module for receiving downlink data of upper-layer applications, for receiving and deserializing downlink attribute data of upper-layer applications; a module for storing downlink attribute data of upper-layer applications received; a module for storing downlink protocol data of underlying modules for processing; a module for sending downlink protocol data of underlying modules, for forwarding downlink protocol data of underlying modules to a second vehicle-end program; a module for receiving uplink data of underlying modules, for receiving uplink protocol data of underlying modules sent by a second vehicle-end program; a module for storing uplink protocol data of underlying modules generated after deserialization of uplink data of underlying modules; a module for storing uplink protocol data of underlying modules generated after deserialization of uplink data of underlying modules; an upper-layer application uplink data queue module, for storing uplink attribute data of upper-layer applications generated by processing uplink data module; a module for sending uplink data of upper-layer applications, for forwarding uplink attribute data of upper-layer applications to a first vehicle-end program.
[0017] Optionally, the step of debugging the second vehicle-side program and the second PC-side program is specifically as follows:
[0018] The second vehicle terminal program receives the upper layer application downlink attribute data; and sends the upper layer application downlink attribute data;
[0019] The second PC end program receives the upper layer application downlink attribute data, converts the upper layer application downlink attribute data into the corresponding lower layer module downlink protocol data; and sends the lower layer module downlink protocol data;
[0020] The second vehicle-side program receives the downlink protocol data of the bottom-layer module and sends the downlink protocol data of the bottom-layer module to the bottom-layer module.
[0021] Optionally, the step of debugging the second vehicle-side program and the second PC-side program is specifically as follows:
[0022] Step 1, the upper-layer application downlink data receiving module of the second vehicle-side program receives the upper-layer application downlink attribute data from the upper-layer application module, and puts the upper-layer application downlink attribute data into the receiving data queue of the upper-layer application downlink data queue module of the second vehicle-side program;
[0023] Step 2, the upper layer application downlink data sending module of the second vehicle terminal program uses a predetermined network data format to serialize the upper layer application downlink attribute data, and sends the upper layer application downlink attribute data to the second PC terminal program;
[0024] Step 3, the downlink data processing module of the second PC terminal program receives the upper layer application downlink attribute data, deserializes the upper layer application downlink attribute data according to a predetermined network data format, and puts the deserialized upper layer application downlink attribute data into the upper layer application downlink data queue module of the second PC terminal program;
[0025] Step 4, the downlink data processing module of the second PC end program converts the downlink attribute data of the upper layer application into the corresponding bottom layer module protocol data according to the attribute ID of the downlink attribute data of the upper layer application through the predefined protocol conversion rule, encodes the bottom layer module protocol data into the downlink data of the bottom layer module through the communication protocol format of the bottom layer module; and writes the downlink data of the bottom layer module into the downlink data queue of the bottom layer module;
[0026] Step 5: The sending bottom-module downlink data module of the second PC-side program uses a predefined network data format to serialize the bottom-module downlink data, and sends the bottom-module downlink data to the vehicle-side program;
[0027] Step 6: The bottom-module downlink data receiving module of the second vehicle-side program receives the bottom-module downlink data sent by the second PC-side program, deserializes it into bottom-module downlink protocol data using a predefined network data format, and writes it into the bottom-module downlink data queue module;
[0028] Step 7: The bottom-module downlink data module of the second vehicle-side program reads the bottom-module downlink protocol data from the bottom-module downlink data queue and sends it to the bottom-module through the local communication interface.
[0029] Optionally, the step of debugging the second vehicle-side program and the second PC-side program is specifically as follows:
[0030] The second vehicle terminal program collects the uplink data of the bottom module; and sends the uplink data of the bottom module;
[0031] The second PC end program receives the bottom layer module uplink data, converts the bottom layer module uplink data into upper layer application uplink data, and sends the upper layer application uplink data;
[0032] The second vehicle-side program receives the upper-layer application uplink data and reports the upper-layer application uplink data.
[0033] Optionally, the step of debugging the second vehicle-side program and the second PC-side program is specifically as follows:
[0034] The uplink data collection module of the second vehicle terminal program receives the uplink data of the bottom module through the local communication interface and puts it into the uplink data queue of the bottom module;
[0035] The sending module of the bottom-layer module uplink data of the second vehicle-side program adopts a predetermined network data format, serializes the bottom-layer module uplink data, and sends the bottom-layer module uplink data to the second PC-side program;
[0036] The bottom module uplink data receiving module of the second PC end program receives the bottom module uplink data sent by the second vehicle end program, deserializes the bottom module uplink data into the bottom module protocol original data, and writes it into the bottom module uplink data queue;
[0037] The uplink data processing module of the second PC end program parses the original data of the underlying module protocol according to the underlying module protocol format, and then converts the original data of the underlying module protocol into the corresponding upper layer application uplink data according to a predetermined conversion method, and writes the upper layer application uplink data into the upper layer application uplink data queue;
[0038] The upper layer application uplink data sending module of the second PC end program uses a predetermined network data format to serialize the upper layer application uplink data and sends it to the second vehicle end program;
[0039] The upper-layer application uplink data receiving module of the second vehicle-side program receives the upper-layer application uplink data sent by the second PC-side program, deserializes the network data into upper-layer application uplink attribute data using a predetermined network data format, and puts the data into an upper-layer application uplink data queue;
[0040] The upper-layer application uplink data reporting module of the second vehicle-side program reads the upper-layer application uplink attribute data, and notifies the upper-layer application module according to the attribute ID of the upper-layer application uplink attribute data, so that the upper-layer application module obtains the upper-layer application uplink attribute data after receiving the notification.
[0041] Optionally, the step of merging the second vehicle-side program and the second PC-side program to generate the second code of the program is specifically:
[0042] The following modules' codes are retained in the second vehicle-side program: upper-layer application downlink data receiving module, upper-layer application uplink data reporting module, bottom-layer module downlink data sending module, bottom-layer module uplink data collection module, bottom-layer module uplink data queue module, bottom-layer module downlink data queue module, upper-layer application uplink data queue module, and upper-layer application downlink data queue module;
[0043] The following modules are retained in the second PC terminal program: processing downlink data; processing uplink data;
[0044] The code of the reserved module in the second vehicle-side program and the code of the reserved module in the second PC-side program are merged to generate a second code of the program.
[0045] In another aspect, the present invention provides a vehicle code debugging device, comprising:
[0046] The segmentation module is used to divide the first code of the vehicle protocol into a first vehicle-side program and a first PC-side program; the first vehicle-side program includes: a communication processing code of the vehicle; the first PC-side program includes: a vehicle communication protocol processing code;
[0047] A first processing module is used to process the first vehicle-side program to generate a second vehicle-side program, where the second vehicle-side program is used to communicate with the upper and lower layers of the vehicle-side and the second PC-side program respectively;
[0048] A second processing module, used for processing the first PC-side program to generate a second PC-side program, and the second PC-side program is used for communicating with the second vehicle-side program;
[0049] A debugging module, used for debugging the second vehicle-side program and the second PC-side program;
[0050] The generation module is used to merge the second vehicle-side program and the second PC-side program after successful debugging to generate a second code of the Vehicle protocol.
[0051] Optionally, the second vehicle-side program includes:
[0052] A module for receiving downlink data of an upper layer application, used for receiving downlink attribute data of an upper layer application sent by an upper layer application;
[0053] The module for reporting uplink data of upper layer applications is used to send uplink attribute data of upper layer applications to upper layer applications;
[0054] Sending the bottom module downlink data module, used to send the bottom module downlink protocol data;
[0055] and a bottom-layer module uplink data collection module, used for receiving bottom-layer module uplink protocol data reported by the bottom-layer module;
[0056] An upper layer application downlink data queue module, used to store received upper layer application downlink attribute data;
[0057] An upper layer application downlink data sending module, used for forwarding the received upper layer application downlink attribute data to the second PC end program;
[0058] An upper layer application uplink data receiving module, used for receiving upper layer application uplink attribute data generated by decoding the lower layer module protocol data by the second PC end program;
[0059] An upper layer application uplink data queue module, used to store received upper layer application uplink attribute data to be reported;
[0060] The bottom module downlink data queue module is used to store the received bottom module downlink attribute data;
[0061] The module for sending the downstream data of the bottom module is used to send the received downstream attribute data of the bottom module to the bottom module;
[0062] The upper layer application uplink data collection module is used to receive the original uplink protocol data of the lower layer module sent by the lower layer module;
[0063] The bottom module uplink data queue module is used to store the collected bottom module uplink protocol raw data.
[0064] The second PC terminal program includes:
[0065] The downlink data processing module is used to process the downlink attribute data of the upper layer application sent by the upper layer application and convert it into the downlink protocol data of the underlying module corresponding to the underlying module;
[0066] An uplink data processing module is used to process the uplink protocol data of the lower layer module reported by the lower layer module and convert it into the uplink attribute data of the upper layer application corresponding to the upper layer application;
[0067] The upper layer application downstream data receiving module is used to receive and deserialize the upper layer application downstream attribute data;
[0068] An upper layer application downlink data queue module, used to store received upper layer application downlink attribute data;
[0069] The bottom-layer module downlink data module is used to store and process the bottom-layer module downlink protocol data generated by the downlink data module;
[0070] The bottom module downlink data sending module is used to forward the bottom module downlink protocol data to the second vehicle terminal program;
[0071] A bottom module uplink data receiving module is used to receive the bottom module uplink protocol data sent by the second vehicle terminal program;
[0072] The bottom module uplink data queue module is used to store the bottom module uplink protocol data generated after the bottom module uplink data module deserializes;
[0073] The upper layer application uplink data queue module is used to store the upper layer application uplink attribute data generated by the uplink data processing module;
[0074] The upper layer application uplink data sending module is used to forward the upper layer application uplink attribute data to the first vehicle terminal program.
[0075] In another aspect, the present invention provides an electronic device, characterized in that it includes:
[0076] Memory for storing computer programs;
[0077] The processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method described is implemented.
[0078] On the other hand, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method described above is implemented.
[0079] In the present invention, the code that is not related to the platform and changes frequently in the Vehicle protocol program is separated and runs on the PC platform as a separate program, and the remaining code runs on the vehicle computer, and data can be transmitted between the two. By compiling a small amount of separated code on the PC platform, the compilation speed is improved. In other words, the code of the Vehicle program protocol processing part is separated to form an independent program running on the PC, which improves the compilation speed and debugging efficiency of the Android program. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0081] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0082] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0083] Figure 1 A flowchart of a vehicle code debugging method provided in an embodiment of the present application;
[0084] Figure 2 The Vehicle data flow chart of the original program in the prior art;
[0085] Figure 3 This is a data flow diagram of the split Vehicle program in the embodiment of the present application;
[0086] Figure 4This is a downlink data flow chart of the split Vehicle program in the embodiment of the present application;
[0087] Figure 5 This is a flow chart of uplink data of the split Vehicle program in the embodiment of the present application;
[0088] Figure 6 It is a data flow chart of the second code of the merged Vehicle program in the embodiment of the present application;
[0089] Figure 7 A schematic diagram of the structure of a vehicle code debugging device provided in an embodiment of the present application;
[0090] Figure 8 A schematic diagram of functional modules included in the second vehicle-side program provided in an embodiment of the present application;
[0091] Fig. 9 A schematic diagram of the functional modules included in the second PC terminal program provided in the embodiment of the present application;
[0092] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0093] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. It should be noted that unless otherwise specifically stated, the relative arrangement of the components and steps, the numerical expressions and the numerical values described in these embodiments do not limit the scope of the present application. It can be understood by those skilled in the art that the terms "first", "second" and the like in the embodiments of the present application are only used to distinguish objects such as different steps, devices or modules, and neither represent any specific technical meaning nor the logical order between them. It should also be understood that in the present embodiment, "multiple" can refer to two or more, and "at least one" can refer to one, two or more. It should also be understood that for any component, data or structure mentioned in the embodiments of the present application, in the absence of explicit limitation or contrary revelation given in the context, it can generally be understood as one or more. In addition, the term "and / or" in the present application is only a kind of association relationship describing the associated objects, indicating that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present application generally indicates that the associated objects before and after are an "or" relationship. It should also be understood that the description of each embodiment in this application emphasizes the differences between each embodiment, and the same or similar parts can be referred to each other. For the sake of brevity, no further description will be given. The following description of at least one exemplary embodiment is actually only illustrative and is by no means a limitation on the present application and its application or use. The techniques, methods and devices known to ordinary technicians in the relevant field may not be discussed in detail, but in appropriate cases, the above techniques, methods and devices should be regarded as part of the specification. It should be noted that similar reference numerals and letters represent similar items in the following figures, so once an item is defined in one figure, it does not need to be further discussed in the subsequent figures. It should be noted that the embodiments in this application and the features in the embodiments can be combined with each other without conflict. To facilitate the understanding of the embodiments of the present application, the present application will be described in detail with reference to the drawings and in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of this application.
[0094] like Figure 1 As shown, a vehicle code debugging method according to the present invention includes:
[0095] Step 11, dividing the first code of the vehicle protocol into a first vehicle-side program and a first PC-side program; the first vehicle-side program includes: a vehicle communication processing code; the first PC-side program includes: a vehicle communication protocol processing code;
[0096] Step 12, processing the first vehicle-side program to generate a second vehicle-side program, wherein the second vehicle-side program is used to communicate with the vehicle-side upper and lower layers and the second PC-side program respectively, specifically: the second vehicle-side program is used to communicate with the vehicle-side upper and lower layers, and forward data communicated with the upper and lower layers to the second PC-side program;
[0097] Step 13, processing the first PC-side program to generate a second PC-side program, the second PC-side program is used to communicate with the second vehicle-side program, specifically: the second PC-side program is used to receive the protocol original data sent by the second vehicle-side program, parse the protocol original data, and send the parsed protocol original data back to the second vehicle-side program;
[0098] Step 14, debugging the second vehicle terminal program and the second PC terminal program;
[0099] Step 15, after successful debugging, merge the second vehicle-side program and the second PC-side program to generate a second code of the Vehicle protocol.
[0100] In the above embodiment, a method for improving the compilation speed and debugging efficiency of Android programs is provided, by separating the platform-independent and frequently changing codes in the Android program, running them as separate programs on the PC platform, and running the remaining codes on the vehicle computer, with data being transmitted between the two via the network. In other words, a method for splitting the Vehicle program is provided, separating the Vehicle program protocol processing code to form an independent program running on the PC. By compiling a small amount of separated code on the PC platform, the compilation speed is improved. With the help of the IDE tool of the PC platform, convenient program debugging methods such as single-step debugging of the program, viewing stack information, conditional breakpoints, etc. can be implemented, thereby improving debugging efficiency.
[0101] Among them, step 12 is specifically as follows:
[0102] Step 121, retain the following modules in the first code: a module for receiving downlink data of an upper layer application, used for receiving downlink attribute data of an upper layer application sent by an upper layer application; a module for reporting uplink data of an upper layer application, used for sending uplink attribute data of an upper layer application to an upper layer application; a module for sending downlink data of a bottom layer module, used for sending downlink protocol data of a bottom layer module; and a module for collecting uplink data of a bottom layer module, used for receiving uplink protocol data of a bottom layer module reported by a bottom layer module;
[0103] Step 122, add the following modules: an upper-layer application downlink data queue module, used to store the received upper-layer application downlink attribute data; a sending upper-layer application downlink data module, used to forward the received upper-layer application downlink attribute data to the second PC-end program; a receiving upper-layer application uplink data module, used to receive the upper-layer application uplink attribute data generated by the second PC-end program decoding the underlying module protocol data; an upper-layer application uplink data queue module, used to store the received upper-layer application uplink attribute data to be reported; a underlying module downlink data queue module, used to store the received underlying module downlink attribute data; a sending underlying module downlink data module, used to send the received underlying module downlink attribute data to the underlying module; a collecting upper-layer application uplink data module, used to receive the underlying module uplink protocol original data sent by the underlying module; and a underlying module uplink data queue module, used to store the collected underlying module uplink protocol original data.
[0104] In the present invention, the upper layer application can be an Android application APP, a native APP, etc., and the underlying module includes underlying hardware such as MCU (microcontroller unit), ECU electronic control unit, etc.
[0105] Wherein, the step 13 is specifically as follows:
[0106] Step 131, retain the following modules in the first code: a downlink data processing module, used to process the upper layer application downlink attribute data sent by the upper layer application, and convert it into the lower layer module downlink protocol data corresponding to the lower layer module; an uplink data processing module, used to process the lower layer module uplink protocol data reported by the lower layer module, and convert it into the upper layer application uplink attribute data corresponding to the upper layer application;
[0107] Step 132, add the following modules: a module for receiving downlink data of an upper-layer application, for receiving and deserializing downlink attribute data of an upper-layer application; a downlink data queue module for an upper-layer application, for storing received downlink attribute data of an upper-layer application; a downlink data module for a bottom-layer module, for storing and processing downlink protocol data of a bottom-layer module; a downlink data module for sending a bottom-layer module, for forwarding the downlink protocol data of a bottom-layer module to a second vehicle-end program; a module for receiving uplink data of a bottom-layer module, for receiving uplink protocol data of a bottom-layer module sent by a second vehicle-end program; an uplink data queue module for storing the uplink protocol data of a bottom-layer module generated after deserialization of the uplink data module of the bottom-layer module; an uplink data queue module for an upper-layer application, for storing and processing uplink attribute data of an upper-layer application generated by the uplink data module; a module for sending uplink data of an upper-layer application, for forwarding the uplink attribute data of an upper-layer application to a first vehicle-end program.
[0108] Optionally, in one embodiment, the downlink debugging steps of step 14 are specifically as follows:
[0109] Step 141A, the second vehicle terminal program receives the upper layer application downlink attribute data; and sends the upper layer application downlink attribute data;
[0110] Step 142A, the second PC end program receives the upper layer application downlink attribute data, converts the upper layer application downlink attribute data into corresponding lower layer module downlink protocol data; and sends the lower layer module downlink protocol data;
[0111] Step 143A: The second vehicle-side program receives the downlink protocol data of the underlying module and sends the downlink protocol data of the underlying module to the underlying module.
[0112] Optionally, in one embodiment, the downlink debugging steps of step 14 are specifically as follows:
[0113] Step 141B, the upper-layer application downlink data receiving module of the second vehicle-side program receives the upper-layer application downlink attribute data from the upper-layer application module, and puts the upper-layer application downlink attribute data into the receiving data queue of the upper-layer application downlink data queue module of the second vehicle-side program;
[0114] Step 142B, the upper layer application downlink data sending module of the second vehicle terminal program uses a predetermined network data format to serialize the upper layer application downlink attribute data, and sends the upper layer application downlink attribute data to the second PC terminal program;
[0115] Step 143B, the downlink data processing module of the second PC terminal program receives the upper layer application downlink attribute data, deserializes the upper layer application downlink attribute data according to a predetermined network data format, and puts the deserialized upper layer application downlink attribute data into the upper layer application downlink data queue module of the second PC terminal program;
[0116] Step 144B, the downlink data processing module of the second PC end program converts the downlink attribute data of the upper layer application into corresponding bottom layer module protocol data according to the attribute ID of the downlink attribute data of the upper layer application through a predefined protocol conversion rule, encodes the bottom layer module protocol data into bottom layer module downlink data through a bottom layer module communication protocol format; and writes the bottom layer module downlink data into a bottom layer module downlink data queue;
[0117] Step 145B, the sending bottom-module downlink data module of the second PC-side program uses a predefined network data format to serialize the bottom-module downlink data, and sends the bottom-module downlink data to the vehicle-side program;
[0118] Step 146B, the bottom-module downlink data receiving module of the second vehicle-side program receives the bottom-module downlink data sent by the second PC-side program, deserializes it into bottom-module downlink protocol data using a predefined network data format, and writes it into the bottom-module downlink data queue module;
[0119] Step 147B, the bottom-module downlink data module of the second vehicle-side program reads the bottom-module downlink protocol data from the bottom-module downlink data queue, and sends it to the bottom-module through the local communication interface.
[0120] Optionally, in one embodiment, the uplink debugging steps of step 14 are specifically as follows:
[0121] Step 141C, the second vehicle terminal program collects the uplink data of the bottom module; and sends the uplink data of the bottom module;
[0122] Step 142C, the second PC end program receives the bottom layer module uplink data, converts the bottom layer module uplink data into upper layer application uplink data, and sends the upper layer application uplink data;
[0123] Step 143C: The second vehicle-side program receives the upper-layer application uplink data and reports the upper-layer application uplink data.
[0124] Optionally, in one embodiment, the uplink debugging steps of step 14 are specifically as follows:
[0125] Step 141D, the bottom module uplink data collection module of the second vehicle terminal program receives the bottom module uplink data through the local communication interface and puts it into the bottom module uplink data queue;
[0126] Step 142D, the bottom module uplink data sending module of the second vehicle terminal program uses a predetermined network data format to serialize the bottom module uplink data, and sends the bottom module uplink data to the second PC terminal program;
[0127] Step 143D, the bottom module uplink data receiving module of the second PC end program receives the bottom module uplink data sent by the second vehicle end program, deserializes the bottom module uplink data into the bottom module protocol original data, and writes it into the bottom module uplink data queue;
[0128] Step 144D, the uplink data processing module of the second PC end program parses the original data of the underlying module protocol according to the underlying module protocol format, and then converts the original data of the underlying module protocol into corresponding upper layer application uplink data according to a predetermined conversion method, and writes the upper layer application uplink data into the upper layer application uplink data queue;
[0129] Step 145D, the upper-layer application uplink data sending module of the second PC-side program uses a predetermined network data format to serialize the upper-layer application uplink data and sends it to the second vehicle-side program;
[0130] Step 146D, the upper-layer application uplink data receiving module of the second vehicle-side program receives the upper-layer application uplink data sent by the second PC-side program, deserializes the network data into upper-layer application uplink attribute data using a predetermined network data format, and puts the data into an upper-layer application uplink data queue;
[0131] Step 147D, the upper-layer application uplink data reporting module of the second vehicle-side program reads the upper-layer application uplink attribute data, and notifies the upper-layer application module according to the attribute ID of the upper-layer application uplink attribute data, so that the upper-layer application module obtains the upper-layer application uplink attribute data after receiving the notification.
[0132] Optionally, step 15 is specifically as follows:
[0133] Step 151, retaining the codes of the following modules in the second vehicle-side program: upper layer application downlink data receiving module, upper layer application uplink data reporting module, bottom layer module downlink data sending module, bottom layer module uplink data collection module, bottom layer module uplink data queue module, bottom layer module downlink data queue module, upper layer application uplink data queue module, upper layer application downlink data queue module;
[0134] Step 152, retaining the following module codes in the second PC terminal program: processing downlink data; processing uplink data;
[0135] Step 153: merge the code of the reserved module in the second vehicle-side program and the code of the reserved module in the second PC-side program to generate a second code of the program.
[0136] The predetermined network data format includes: a channel field and a data field; the type of the channel field includes an upper channel layer type and a lower data layer channel type; the data field indicates the original protocol message data to be transmitted;
[0137] When the type of the Channel field is an upper layer channel type, the Data field is attribute data, and the format of the attribute data includes: an attribute ID field, a data type field, a data quantity field, and a data content field;
[0138] Among them, the attribute ID field indicates: the attribute function ID of the Vehicle; the data type field indicates: the data type corresponding to the attribute function of the Vehicle; the data quantity field indicates: the data value corresponding to the data type; the data content field is the data content determined according to the data type; when the type of the Channel field is the underlying channel type, the data field is protocol data, and the format of the protocol data includes: communication mode field, data length field, and data content field; the communication mode field indicates: the communication mode between the Vehicle and the underlying module; the data length indicates the length of the data content; the data content field is: the content of the original message data of the underlying module protocol.
[0139] In the above embodiment, a decoupling method is provided to facilitate program splitting and merging. The split part of the code and the upper and lower layer data interaction are decoupled by data queue. The data queue method can ensure that when merging programs, only redundant code needs to be deleted without modifying or adding code, thereby reducing the difficulty and error probability of merging codes. In other words, the present invention uses a data queue method to decouple the protocol processing module and the data transmission module, which facilitates the splitting and merging of programs.
[0140] The following describes a specific application scenario of the present invention. In this application scenario, the bottom layer module is taken as an example, and the upper layer application is taken as an example.
[0141] The present invention relates to vehicle module protocol debugging in a vehicle entertainment system, specifically to a vehicle protocol debugging method based on data stream forwarding, which can develop and debug vehicle module protocol data in a simple and efficient way. The general idea of the present invention is described below.
[0142] 1. The main function of the Vehicle module is to convert the attribute data used by the upper-layer application into the protocol data used by the lower-layer module, or to convert the protocol data of the lower-layer module into the attribute data of the upper-layer application. The code for communicating with the upper-layer application and the lower-layer module will basically not change, while the protocol data will change at any time with the changes in hardware and requirements. The protocol data is complex and numerous and belongs to the core part of the Vehicle module. Therefore, the core code of the original Vehicle program is extracted and divided into two independent programs: the vehicle-side program and the PC-side program. The two programs use network communication to transmit data.
[0143] 2. The vehicle-side program runs on the vehicle-side platform and is mainly composed of the original Vehicle communication code. Its main functions are as follows:
[0144] 1) Receive attribute data sent by the upper-layer application and send it to the PC program through network transmission; 2) Receive the uplink original message data of the underlying module and send it to the PC program through network transmission; 3) Receive the uplink data message sent by the PC program through the network and report it to the upper-layer application; 4) Receive the downlink data message sent by the PC program through the network and send it to the underlying module.
[0145] 3. The PC-side program runs on the PC and contains some codes for vehicle communication protocol processing. Its main functions are as follows: 1) It is responsible for decoding and encoding the communication protocol of the underlying module, processing the upper-layer application attribute data into the underlying module protocol data or converting the underlying module protocol data into the upper-layer application attribute data, serializing and deserializing the upper-layer application attribute data and serializing and deserializing the underlying module protocol data, etc. Vehicle application functions. This part of the code is related to the communication protocol and is strongly associated with the communication protocol.
[0146] 4. After debugging is completed, merge the vehicle program and the PC program into the original Vehicle program.
[0147] Since the car-side program is relatively simple and fixed, it will not change once it is completed. The PC-side program runs on the PC platform and only contains application codes such as protocol processing and data conversion. The compilation time is generally around a few seconds. Therefore, compared with the original solution, this method greatly reduces the software compilation time during the protocol development process.
[0148] In addition, when developing software on the PC platform, you can directly use various system software development IDE tools. Conventional IDE tools on the PC platform have debugging functions such as single-step debugging, viewing stack information and memory data. Therefore, debugging with the help of conventional IDE tools on the PC platform is extremely convenient and reduces the difficulty of protocol debugging.
[0149] The following describes the processing steps of this method in detail:
[0150] 1. Program splitting
[0151] like Figure 2 As shown in the figure, the native Vehicle software mainly includes two data paths: uplink and downlink:
[0152] The downlink channel is where the attribute data sent by the upper layer application is converted into the downlink protocol data of the bottom layer module by Vehicle and then sent to the bottom layer module;
[0153] The uplink path is the protocol data reported by the bottom module, which is converted into uplink attribute data of the upper layer application by Vehicle and finally reported to the upper layer application.
[0154] Among them, receiving upper-layer application uplink data, reporting upper-layer application uplink data, sending bottom-level module downlink data and collecting bottom-level module uplink data are related to the vehicle platform hardware, while the code for processing protocol data is pure software implementation and has nothing to do with the vehicle platform. Therefore, according to the strength of the correlation with the platform hardware, the Vehicle program is split into two independent programs, namely the vehicle-side program and the PC-side program. Figure 3 , the specific splitting is implemented as follows:
[0155] 1) Car-side program: The main function is to communicate with the upper and lower layers of the car-side program, and to forward the data communicated with the upper and lower layers to the PC-side program using network transmission. The "upper-layer application downlink data receiving module", "upper-layer application uplink data reporting module", "lower-layer module downlink data sending module" and "lower-layer module uplink data collection module" are retained, and the following modules are added:
[0156] ·Added "upper-layer application downlink data queue module" to store the received upper-layer application downlink attribute data; added "send upper-layer application downlink data module" to forward the received upper-layer application downlink attribute data to the PC program; added "receive upper-layer application uplink data module" to receive the upper-layer application uplink data generated by the PC program decoding the underlying module protocol data; added "upper-layer application uplink data queue module" to store the received upper-layer application uplink attribute data to be reported; added "bottom-layer module downlink data queue module" to store the received bottom-layer module downlink attribute data; added "send bottom-layer module downlink data module" to send the received bottom-layer module downlink attribute data to the bottom-layer module; added "collect upper-layer application uplink data module" to receive various protocol raw data sent by the bottom-layer module; added "bottom-layer module uplink data queue module" to store the received collected bottom-layer module uplink protocol data;
[0157] 2) PC-side program: The main function is to receive the original protocol data sent by the vehicle-side program, parse the protocol data, and send it back to the vehicle-side program.
[0158] Retain the module for processing downlink data and the module for processing uplink data;
[0159] ·Added a "receiving upper-layer application downlink data module" to receive and deserialize the upper-layer application downlink attribute data; added a "upper-layer application downlink data queue module" to store the received upper-layer application downlink attribute data; added a "bottom-layer module downlink data queue module" to store the bottom-layer module downlink protocol data generated by the "processing downlink data module"; added a "sending bottom-layer module downlink data module" to forward the bottom-layer module downlink protocol data to the vehicle-side program; added a "receiving bottom-layer module uplink data module" to receive the bottom-layer module uplink protocol data sent by the vehicle-side program; added a "bottom-layer module uplink data queue module" to store the bottom-layer module uplink protocol data generated by the "receiving bottom-layer module uplink data module" after deserialization; added a "upper-layer application uplink data queue module" to store the upper-layer application uplink attribute data generated by the "processing uplink data module"; added a "sending upper-layer application uplink data module" to forward the upper-layer application uplink attribute data to the vehicle-side program;
[0160] 2. Downlink data link:
[0161] like Figure 4 As shown in the figure, the downlink data link after the split is the attribute data sent by the upper layer application, which is converted into the protocol data of the underlying module by the "downlink data processing module" of the PC end program, and then sent to the underlying module through the local communication interface. The downlink data link of the vehicle after the split is as follows:
[0162] (1) Module for receiving downlink data from upper-layer applications on the vehicle-side program:
[0163] The upper-layer application sends attribute data to the Vehicle through the HIDL interface. The main function of the module receiving the downstream data of the upper-layer application is to receive these attribute data and put them into a receiving queue, waiting for other modules to process the attribute data.
[0164] (2) The module for sending upper-layer application downlink data of the vehicle-side program:
[0165] Monitor the status of the "upper-layer application downlink data queue" in real time. When new attribute data arrives, the "sending upper-layer application downlink data module" will immediately serialize the upper-layer application downlink data in a predefined network data format and send the upper-layer application downlink data to the PC program via network transmission.
[0166] (3) Module for the PC program to receive downlink data from upper-layer applications:
[0167] The upper-layer application downlink data sent by the vehicle-side program is received through network transmission, and then the data is deserialized according to the predetermined network data format, and finally placed in the "upper-layer application downlink data queue".
[0168] (4) Downstream data processing module of the PC program. The "downstream data processing module" monitors the "upper-layer application downstream data queue" in real time. When there is new data, the "downstream data processing module" will immediately read the data and convert the attribute data into the corresponding underlying module protocol data according to the attribute ID through the predefined protocol conversion rules. Then, the underlying module protocol data is encoded into the underlying module downstream data through the underlying module communication protocol format, and finally the data is written into the "underlying module downstream data queue".
[0169] (5) The sending module of the underlying module downlink data of the PC program: The sending module of the underlying module downlink data monitors the underlying module downlink data queue in real time. When there is new data, the sending module of the underlying module downlink data reads the data immediately, uses the predefined network data format, serializes the underlying module downlink data, and sends the underlying module downlink data to the vehicle program through network transmission.
[0170] (6) The module for receiving the downstream data of the underlying module of the vehicle-side program: receives the downstream data of the underlying module sent by the PC-side program through network transmission, deserializes it into the downstream protocol data of the underlying module using the predefined network data format, and writes it into the "downstream data queue of the underlying module".
[0171] (7) The vehicle-side program sends the underlying module downlink data module: real-time monitoring of the "underlying module downlink data queue" status. When there is new underlying module downlink data, the underlying module downlink data is read from the queue and sent directly to the underlying module through the local communication interface (such as SPI, serial port, network, etc.).
[0172] 3. Uplink data link:
[0173] like Figure 5 As shown in the figure, the uplink data link after the split is that the vehicle side collects the uplink protocol data of the bottom module and forwards it to the PC side. After being converted into upper-layer application attribute data by the "uplink data processing" module of the PC side, it is forwarded to the vehicle side and finally reported to the upper-layer application through the "sending upper-layer application uplink data module". The detailed data link is as follows:
[0174] (1) The uplink data module of the underlying module of the vehicle-side program receives the original data reported by the underlying module through the local communication interface (such as SPI, serial port, network, etc.) and puts it into the "uplink data queue of the underlying module".
[0175] (2) The module for sending uplink data of the underlying module of the vehicle-side program: monitors the status of the "uplink data queue of the underlying module" in real time. When there is new uplink data of the underlying module, the "module for sending uplink data of the underlying module" reads the data from the queue, serializes the uplink data of the underlying module using a predefined network data format, and sends the uplink data of the underlying module to the PC-side program via network transmission.
[0176] (3) The PC-side program receives the underlying module uplink data module: receives the underlying module uplink data sent by the vehicle-side program through network transmission, then deserializes the underlying module uplink data into the underlying module protocol original message data, and writes it into the "underlying module uplink data queue".
[0177] (4) The uplink data processing module of the PC program; specifically: real-time monitoring of the status of the "bottom-layer module uplink data queue". When there is new data, the "uplink data processing module" will immediately read the data, parse the bottom-layer module protocol uplink raw message data according to the bottom-layer module protocol format, and then convert the bottom-layer module protocol raw message data into the corresponding upper-layer application uplink data according to the predefined conversion method based on the command ID, and finally write it into the "uplink data queue of the upper-layer application".
[0178] (5) The module for sending uplink data of upper-layer applications of the PC program; specifically, the module for sending uplink data of upper-layer applications will monitor the status of the queue of uplink data of upper-layer applications in real time. When there is new data, the module for sending uplink data of upper-layer applications will read the data immediately and use the predefined network data format to serialize the uplink data of upper-layer applications and send it to the vehicle program via network transmission.
[0179] (6) The vehicle-side program receives the upper-layer application uplink data; specifically, the "upper-layer application uplink data receiving module" receives the upper-layer application uplink network data sent by the PC-side program through network transmission, uses the predefined network data format to deserialize the network data into the upper-layer application uplink data, and puts it into the "upper-layer application uplink data queue".
[0180] (7) The vehicle-side program reports uplink data to the upper-layer application; specifically, the "uplink data reporting module for the upper-layer application" monitors the status of the "uplink data queue for the upper-layer application" in real time. When the queue is not empty, the "uplink data reporting module for the upper-layer application" reads the attribute data and notifies the upper-layer application according to the attribute ID. After receiving the notification, the upper-layer application obtains the attribute data through the HIDL interface.
[0181] 4. Network data format
[0182] The data to be transmitted is encapsulated into the standard format of "Channel+Data". Channel, 1 byte, is divided into upper-layer application and lower-layer module, and Data is the original protocol message data to be transmitted. The details are as follows: When Channel is represented as the upper-layer application channel type, the attribute data format of Data is: Data consists of "attribute ID" + "data type" + "data quantity" + "data content"
[0183] composition.
[0184] Attribute ID: 4 bytes, 32-bit unsigned integer. Data type: 1 byte, 8-bit unsigned integer. The meaning is as follows:
[0185] 0: Boolean type, quantity is 1, single data is 1 byte, content: 1 byte, 0 means false, and the others are true;
[0186] 1: 32-bit signed integer, data content: 4-byte signed integer, quantity is 1, single data is 4 bytes;
[0187] 2: 32-bit signed integer array, data content: 4-byte signed integer, indefinite number, single data 4 bytes;
[0188] 3: 64 signed integer, quantity is 1, single data is 8 bytes;
[0189] 4: 64 signed integer array, indefinite number, 8 bytes for each data;
[0190] 5: single-precision floating point number, the number is 1, and each data is 4 bytes;
[0191] 6: Single-precision floating-point array, the number is indefinite, and each data is 4 bytes;
[0192] 7: string type, indefinite number, single data 1 byte;
[0193] 8: Byte array type, indefinite number, single data 1 byte;
[0194] Data quantity: 4 bytes, 32-bit unsigned integer, the value is determined according to the data type;
[0195] Data content: Determine the value based on the data type.
[0196] When Channel is represented as an upper-layer application channel type, the protocol data format of Data is:
[0197] Data consists of "communication method" + "data length" + "data content".
[0198] Communication mode: 1 byte, 8-bit unsigned integer, 0 represents serial port, 1 represents SPI, 2 represents Ethernet, etc.; Data length: 2 bytes, big-endian mode; Data content: the specific content of the original message data of the underlying module protocol.
[0199] 5. Program Merger:
[0200] After the Vehicle protocol development and debugging is completed, the two independent programs need to be merged into the Vehicle program. Figure 3 As shown in the figure, since the split Vehicle program uses data queues to decouple the upper and lower layer data communication and data encoding functions, it is only necessary to remove the communication functions between the vehicle-side program and the PC-side program to complete the program merger. Figure 6 As shown, the specific operations are as follows:
[0201] Remove the "sending upper application downlink data module" and let the "processing downlink data module" directly obtain data from the "upper application downlink data queue module"; remove the "receiving bottom module downlink data module" and let
[0202] The "downlink data processing module" directly writes data to the "bottom-level module downlink data queue module"; remove
[0203] "Sending underlying module uplink data module" allows the "processing uplink data module" to directly obtain data from the "underlying module uplink data queue module"; remove the "receiving upper-layer application uplink data module" to allow the "processing uplink data module" to directly write data to the "upper-layer application uplink data queue module"; finally, the merger of the Vehicle program was completed with basically no need to modify additional code.
[0204] Measured data: Test plan:
[0205] Compilation time: The original solution is compiled on the compilation server, and this patented solution is compiled on the PC.
[0206] There are two situations during the development process: minimum compilation and full compilation:
[0207] Minimum compilation: After all compilations are completed, modify the code of one source file and then start incremental compilation.
[0208] ·Compile all: delete all compiled products, and recompile the Vehicle module source code of the original solution and the PC-side program code in this patent;
[0209] Debugging time: When a problem occurs, the original debugging method uses log printing to debug.
[0210] This patent uses the debugging function of the codeblocks tool (a lightweight C / C++ IDE that is open source, cross-platform, and cross-compiler) for debugging.
[0211] Test environment: Compilation server configuration: CPU: i9-13900 (24 cores and 32 threads); Memory:
[0212] 64GB; Hard disk: 4TB, operating system: Ubuntu 18.04; PC configuration: CPU: i7-1260P
[0213] (12 cores and 16 threads); Memory: 16GB; Hard disk: 1TB; Operating system: Linux Mint
[0214] 20.3; Android platform: Android-12; Source code module: Vehicle module; Debug software: codeblocks20.03
[0215] Test Results
[0216]
[0217] Therefore, the present invention improves the software compiling speed, reduces the compiling time by more than 90%, improves the software debugging efficiency by more than 50%, and improves the communication mode scalability and program portability.
[0218] like Figure 7 As shown, a debugging device for a vehicle code according to the present invention includes: a segmentation module 71, which is used to divide the first code of the vehicle protocol into a first vehicle-side program and a first PC-side program; the first vehicle-side program includes: a communication processing code of the Vehicle; the first PC-side program includes: a Vehicle communication protocol processing code; a first processing module 72, which is used to process the first vehicle-side program, and the second vehicle-side program is used to communicate with the upper and lower layers of the vehicle and the second PC-side program respectively; a second processing module 73, which is used to process the first PC-side program to generate a second PC-side program, and the second PC-side program is used to communicate with the second vehicle-side program; a debugging module 74, which is used to debug the second vehicle-side program and the second PC-side program; a generation module 75, which is used to merge the second vehicle-side program and the second PC-side program after successful debugging to generate a second code of the Vehicle protocol.
[0219] like Figure 8As shown, the second vehicle-side program includes: an upper-layer application downlink data receiving module 81, which is used to receive the upper-layer application downlink attribute data sent by the upper-layer application; an upper-layer application uplink data reporting module 82, which is used to send the upper-layer application uplink attribute data to the upper-layer application; a bottom-layer module downlink data sending module 83, which is used to send the bottom-layer module downlink protocol data; a bottom-layer module uplink data collection module 84, which is used to receive the bottom-layer module uplink protocol data reported by the bottom-layer module; an upper-layer application downlink data queue module 85, which is used to store the received upper-layer application downlink attribute data; an upper-layer application downlink data sending module 86, which is used to forward the received upper-layer application downlink attribute data to the second PC-side program; The upper-layer application uplink data receiving module 87 is used to receive the upper-layer application uplink attribute data generated by the second PC-end program decoding the underlying module protocol data; the upper-layer application uplink data queue module 88 is used to store the received upper-layer application uplink attribute data to be reported; the underlying module downlink data queue module 89 is used to store the received underlying module downlink attribute data; the underlying module downlink data sending module 810 is used to send the received underlying module downlink attribute data to the underlying module; the upper-layer application uplink data collecting module 811 is used to receive the underlying module uplink protocol original data sent by the underlying module; the underlying module uplink data queue module 812 is used to store the collected underlying module uplink protocol original data.
[0220] like Fig. 9 As shown, the second PC-side program includes: a downlink data processing module 91, which is used to process the upper-layer application downlink attribute data sent by the upper-layer application and convert it into the lower-layer module downlink protocol data corresponding to the lower-layer module; a downlink data processing module 92, which is used to process the lower-layer module uplink protocol data reported by the lower-layer module and convert it into the upper-layer application uplink attribute data corresponding to the upper-layer application; a downlink data receiving module 93, which is used to receive and deserialize the upper-layer application downlink attribute data; a downlink data queue module 94 for upper-layer application, which is used to store the received downlink attribute data of the upper-layer application; a downlink data module 95 for the lower-layer module, which is used to store the downlink attribute data generated by the downlink data processing module Bottom-layer module downlink protocol data; a bottom-layer module downlink data sending module 96, used to forward the bottom-layer module downlink protocol data to the second vehicle-end program; a bottom-layer module uplink data receiving module 97, used to receive the bottom-layer module uplink protocol data sent by the second vehicle-end program; a bottom-layer module uplink data queue module 98, used to store the bottom-layer module uplink protocol data generated after deserialization by the bottom-layer module uplink data receiving module; an upper-layer application uplink data queue module 99, used to store the upper-layer application uplink attribute data generated by the uplink data processing module; a upper-layer application uplink data sending module 910, used to forward the upper-layer application uplink attribute data to the first vehicle-end program.
[0221] Figure 8A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 8 The electronic device 1600 shown includes: at least one processor 1601, a memory 1602, at least one network interface 1604 and other user interfaces 1603. The various components in the electronic device 1600 are coupled together via a bus system 1605. It is understood that the bus system 1605 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 1605 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 1605 is not described in detail. Figure 8 In the figure, various buses are labeled as bus system 1605. The user interface 1603 may include a display, a keyboard, or a pointing device (such as a mouse, a trackball, a touch pad, or a touch screen).
[0222] It can be understood that the memory 1602 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus random access memory (DRRAM). The memory 1602 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0223] In some embodiments, the memory 1602 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 16021 and an application program 16022 .
[0224] Among them, the operating system 16021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 16022 includes various applications, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present application may be included in the application 16022. In this embodiment, by calling the program or instruction stored in the memory 1602, specifically, it can be the program or instruction stored in the application 16022, the processor 1601 is used to execute the method steps provided by each method embodiment.
[0225] The method disclosed in the above embodiment of the present application can be applied to the processor 1601, or implemented by the processor 1601. The processor 1601 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 1601. The above processor 1601 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1602, and the processor 1601 reads the information in the memory 1602, and completes the steps of the above method in combination with its hardware. It is understandable that the embodiments described herein can be implemented with hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processors (Digital Signal Processing, DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (Programmable Logic Device, PLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA), general processors, controllers, microcontrollers, microprocessors, other electronic units or combinations thereof for performing the above functions of the present application. For software implementation, the above-mentioned technology of this article can be implemented by a unit that performs the above-mentioned functions of this article. The software code can be stored in a memory and executed by a processor. The memory can be implemented in a processor or outside a processor.
[0226] The electronic device provided in this embodiment may be Figure 8The electronic device shown in can execute the above method to achieve the above technical effect. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.
[0227] The embodiment of the present application also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. Among them, the storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory. When one or more programs in the storage medium can be executed by one or more processors to implement the above-mentioned method executed on the electronic device side. The above-mentioned processor is used to execute the program stored in the memory to implement the method executed on the electronic device side.
[0228] Professionals should also be further aware that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. The steps of the method or algorithm described in conjunction with the embodiments disclosed herein can be implemented with a software module executed by hardware or a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field. It should be understood that the terms used in the text are only for the purpose of describing specific example implementations, and are not intended to be limited. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive and therefore indicate the presence of the stated features, steps, operations, elements and / or parts, but do not exclude the presence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used. The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features applied herein.
Claims
1. A vehicle code debugging method, characterized in that: include: The first code of the vehicle protocol is divided into a first vehicle-side program and a first PC-side program; the first vehicle-side program includes: a vehicle communication processing code; the first PC-side program includes: a vehicle communication protocol processing code; Processing the first vehicle-side program to generate a second vehicle-side program, wherein the second vehicle-side program is used to communicate with the upper and lower layers of the vehicle-side and the second PC-side program respectively; Processing the first PC-side program to generate a second PC-side program, where the second PC-side program is used to communicate with the second vehicle-side program; Debug the second vehicle-side program and the second PC-side program; After successful debugging, the second vehicle-side program and the second PC-side program are merged to generate a second code of the Vehicle protocol.
2. The method according to claim 1, characterized in that The step of processing the first vehicle-side program to generate the second vehicle-side program specifically comprises: retaining the following modules in the first code: A module for receiving downlink data of an upper layer application, used for receiving downlink attribute data of an upper layer application sent by an upper layer application; The module for reporting uplink data of upper layer applications is used to send uplink attribute data of upper layer applications to upper layer applications; Sending the bottom module downlink data module, used to send the bottom module downlink protocol data; and a bottom-layer module uplink data collection module, used for receiving bottom-layer module uplink protocol data reported by the bottom-layer module; Add the following modules: An upper layer application downlink data queue module, used to store received upper layer application downlink attribute data; An upper layer application downlink data sending module, used for forwarding the received upper layer application downlink attribute data to the second PC end program; An upper layer application uplink data receiving module, used for receiving upper layer application uplink attribute data generated by decoding the lower layer module protocol data by the second PC end program; An upper layer application uplink data queue module, used to store received upper layer application uplink attribute data to be reported; The bottom module downlink data queue module is used to store the received bottom module downlink attribute data; The module for sending the downstream data of the bottom module is used to send the received downstream attribute data of the bottom module to the bottom module; The upper layer application uplink data collection module is used to receive the original uplink protocol data of the lower layer module sent by the lower layer module; The bottom module uplink data queue module is used to store the collected bottom module uplink protocol raw data.
3. The method according to claim 2, characterized in that The first PC-side program is processed to generate the second PC-side program as follows: Keep the following modules in the first code: The downlink data processing module is used to process the downlink attribute data of the upper layer application sent by the upper layer application and convert it into the downlink protocol data of the underlying module corresponding to the underlying module; An uplink data processing module is used to process the uplink protocol data of the lower layer module reported by the lower layer module and convert it into the uplink attribute data of the upper layer application corresponding to the upper layer application; Add the following modules: The upper layer application downstream data receiving module is used to receive and deserialize the upper layer application downstream attribute data; An upper layer application downlink data queue module, used to store received upper layer application downlink attribute data; The bottom module downlink data module is used to store and process the bottom module downlink protocol data; The bottom module downlink data sending module is used to forward the bottom module downlink protocol data to the second vehicle terminal program; A bottom module uplink data receiving module is used to receive the bottom module uplink protocol data sent by the second vehicle terminal program; The bottom module uplink data queue module is used to store the bottom module uplink protocol data generated after the bottom module uplink data module deserializes; The upper layer application uplink data queue module is used to store the upper layer application uplink attribute data generated by the uplink data processing module; The upper layer application uplink data sending module is used to forward the upper layer application uplink attribute data to the first vehicle terminal program.
4. The method according to claim 3, characterized in that The steps of debugging the second vehicle-side program and the second PC-side program are specifically as follows: The second vehicle terminal program receives the upper layer application downlink attribute data; and sends the upper layer application downlink attribute data; The second PC end program receives the upper layer application downlink attribute data and converts the upper layer application downlink attribute data into corresponding bottom layer module downlink protocol data; And send the underlying module downlink protocol data; The second vehicle-side program receives the downlink protocol data of the bottom-layer module and sends the downlink protocol data of the bottom-layer module to the bottom-layer module.
5. The method according to claim 3, characterized in that: The steps of debugging the second vehicle-side program and the second PC-side program are specifically as follows: Step 1, the upper-layer application downlink data receiving module of the second vehicle-side program receives the upper-layer application downlink attribute data from the upper-layer application module, and puts the upper-layer application downlink attribute data into the receiving data queue of the upper-layer application downlink data queue module of the second vehicle-side program; Step 2, the upper-layer application downlink data sending module of the second vehicle-side program uses a predetermined network data format to serialize the upper-layer application downlink attribute data, and sends the upper-layer application downlink attribute data to the second PC-side program; Step 3, the downlink data processing module of the second PC terminal program receives the upper layer application downlink attribute data, deserializes the upper layer application downlink attribute data according to a predetermined network data format, and puts the deserialized upper layer application downlink attribute data into the upper layer application downlink data queue module of the second PC terminal program; Step 4, the downlink data processing module of the second PC end program converts the downlink attribute data of the upper layer application into the corresponding bottom layer module protocol data according to the attribute ID of the downlink attribute data of the upper layer application through the predefined protocol conversion rule, encodes the bottom layer module protocol data into the downlink data of the bottom layer module through the communication protocol format of the bottom layer module; and writes the downlink data of the bottom layer module into the downlink data queue of the bottom layer module; Step 5, the sending bottom-module downlink data module of the second PC-side program uses a predefined network data format to serialize the bottom-module downlink data, and sends the bottom-module downlink data to the vehicle-side program; Step 6: The bottom-module downlink data receiving module of the second vehicle-side program receives the bottom-module downlink data sent by the second PC-side program, deserializes it into bottom-module downlink protocol data using a predefined network data format, and writes it into the bottom-module downlink data queue module; Step 7: The bottom-module downlink data module of the second vehicle-side program reads the bottom-module downlink protocol data from the bottom-module downlink data queue and sends it to the bottom-module through the local communication interface.
6. The method according to claim 3, characterized in that: The steps of debugging the second vehicle-side program and the second PC-side program are specifically as follows: The second vehicle terminal program collects the uplink data of the bottom module; and sends the uplink data of the bottom module; The second PC end program receives the bottom layer module uplink data, converts the bottom layer module uplink data into upper layer application uplink data, and sends the upper layer application uplink data; The second vehicle-side program receives the upper-layer application uplink data and reports the upper-layer application uplink data.
7. The method according to claim 3, characterized in that The steps of debugging the second vehicle-side program and the second PC-side program are specifically as follows: The uplink data collection module of the second vehicle terminal program receives the uplink data of the bottom module through the local communication interface and puts it into the uplink data queue of the bottom module; The sending module of the bottom-layer module uplink data of the second vehicle-side program adopts a predetermined network data format, serializes the bottom-layer module uplink data, and sends the bottom-layer module uplink data to the second PC-side program; The bottom module uplink data receiving module of the second PC end program receives the bottom module uplink data sent by the second vehicle end program, deserializes the bottom module uplink data into the bottom module protocol original data, and writes it into the bottom module uplink data queue; The uplink data processing module of the second PC end program parses the original data of the underlying module protocol according to the underlying module protocol format, and then converts the original data of the underlying module protocol into the corresponding upper layer application uplink data according to a predetermined conversion method, and writes the upper layer application uplink data into the upper layer application uplink data queue; The upper layer application uplink data sending module of the second PC end program uses a predetermined network data format to serialize the upper layer application uplink data and sends it to the second vehicle end program; The upper-layer application uplink data receiving module of the second vehicle-side program receives the upper-layer application uplink data sent by the second PC-side program, deserializes the network data into upper-layer application uplink attribute data using a predetermined network data format, and puts the data into an upper-layer application uplink data queue; The upper-layer application uplink data reporting module of the second vehicle-side program reads the upper-layer application uplink attribute data, and notifies the upper-layer application module according to the attribute ID of the upper-layer application uplink attribute data, so that the upper-layer application module obtains the upper-layer application uplink attribute data after receiving the notification.
8. The method according to claim 3, characterized in that The step of merging the second vehicle-side program and the second PC-side program to generate the second code of the program is specifically: The following modules' codes are retained in the second vehicle-side program: upper-layer application downlink data receiving module, upper-layer application uplink data reporting module, bottom-layer module downlink data sending module, bottom-layer module uplink data collection module, bottom-layer module uplink data queue module, bottom-layer module downlink data queue module, upper-layer application uplink data queue module, and upper-layer application downlink data queue module; The following modules are retained in the second PC terminal program: processing downlink data; processing uplink data; The code of the reserved module in the second vehicle-side program and the code of the reserved module in the second PC-side program are merged to generate a second code of the program.
9. The method according to claim 5, characterized in that The predetermined network data format includes: a channel field and a data field; the type of the channel field includes an upper channel type and a lower channel type; the data field represents the original protocol message data to be transmitted; When the type of the Channel field is an upper layer channel type, the Data field is attribute data, and the format of the attribute data includes: an attribute ID field, a data type field, a data quantity field, and a data content field; Among them, the attribute ID field indicates: the attribute function ID of the vehicle; the data type field indicates: the data type corresponding to the attribute function of the vehicle; the data quantity field indicates: the data value corresponding to the data type; the data content field is the data content determined according to the data type; When the type of the Channel field is the bottom channel type, the Data field is protocol data, and the format of the protocol data includes: a communication mode field, a data length field, and a data content field; The communication mode field indicates: the communication mode between the Vehicle and the underlying module; the data length indicates the length of the data content; the data content field is: the content of the original message data of the underlying module protocol.
10. A vehicle code debugging device, characterized in that: include: The segmentation module is used to divide the first code of the vehicle protocol into a first vehicle-side program and a first PC-side program; the first vehicle-side program includes: a communication processing code of the vehicle; the first PC-side program includes: a vehicle communication protocol processing code; A first processing module is used to process the first vehicle-side program to generate a second vehicle-side program, where the second vehicle-side program is used to communicate with the upper and lower layers of the vehicle-side and the second PC-side program respectively; A second processing module, used for processing the first PC-side program to generate a second PC-side program, and the second PC-side program is used for communicating with the second vehicle-side program; A debugging module, used for debugging the second vehicle-side program and the second PC-side program; The generation module is used to merge the second vehicle-side program and the second PC-side program after successful debugging to generate a second code of the Vehicle protocol.
11. The device according to claim 10, characterized in that The second vehicle-side program includes: A module for receiving downlink data of an upper layer application, used for receiving downlink attribute data of an upper layer application sent by an upper layer application; The module for reporting uplink data of upper layer applications is used to send uplink attribute data of upper layer applications to upper layer applications; Sending the bottom module downlink data module, used to send the bottom module downlink protocol data; and a bottom-layer module uplink data collection module, used for receiving bottom-layer module uplink protocol data reported by the bottom-layer module; An upper layer application downlink data queue module, used to store received upper layer application downlink attribute data; An upper layer application downlink data sending module, used for forwarding the received upper layer application downlink attribute data to the second PC end program; An upper layer application uplink data receiving module, used for receiving upper layer application uplink attribute data generated by decoding the lower layer module protocol data by the second PC end program; An upper layer application uplink data queue module, used to store received upper layer application uplink attribute data to be reported; The bottom module downlink data queue module is used to store the received bottom module downlink attribute data; The module for sending the downstream data of the bottom module is used to send the received downstream attribute data of the bottom module to the bottom module; The upper layer application uplink data collection module is used to receive the original uplink protocol data of the lower layer module sent by the lower layer module; The bottom module uplink data queue module is used to store the collected bottom module uplink protocol raw data.
12. The device according to claim 10, characterized in that The second PC terminal program includes: The downlink data processing module is used to process the downlink attribute data of the upper layer application sent by the upper layer application and convert it into the downlink protocol data of the underlying module corresponding to the underlying module; An uplink data processing module is used to process the uplink protocol data of the lower layer module reported by the lower layer module and convert it into the uplink attribute data of the upper layer application corresponding to the upper layer application; The upper layer application downstream data receiving module is used to receive and deserialize the upper layer application downstream attribute data; An upper layer application downlink data queue module, used to store received upper layer application downlink attribute data; The bottom-layer module downlink data module is used to store and process the bottom-layer module downlink protocol data generated by the downlink data module; The bottom module downlink data sending module is used to forward the bottom module downlink protocol data to the second vehicle terminal program; A bottom module uplink data receiving module is used to receive the bottom module uplink protocol data sent by the second vehicle terminal program; The bottom module uplink data queue module is used to store the bottom module uplink protocol data generated after the bottom module uplink data module deserializes; The upper layer application uplink data queue module is used to store the upper layer application uplink attribute data generated by the uplink data processing module; The upper layer application uplink data sending module is used to forward the upper layer application uplink attribute data to the first vehicle terminal program.
13. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute a computer program stored in the memory, and when the computer program is executed, implement the method described in any one of claims 1 to 9.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method described in any one of claims 1 to 9 is implemented.
