Driving code optimization method and device and electronic equipment
By traversing the driver code functions in the embedded system, obtaining register information and generating template code, the driver code is solved, and storage space optimization and security improvement are achieved.
Patent Information
- Application Number
- CN202411491721.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-03-25
AI Technical Summary
The driver code in existing embedded systems takes up a lot of storage space and is easily reverse-cracked, resulting in low security.
By traversing all functions in the driver code, obtaining their respective register addresses and register values, and generating template codes based on the function name, register address and register value, simplifying the driver code.
Simplifying the lengthy driver code into template code containing register addresses and register values reduces the storage space occupied by the code, and increases the difficulty of the driver code being reversed and improves the security of the driver code.
Smart Images

Figure CN119690412A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically, to a driver code optimization method, device and electronic device. Background Art
[0002] Embedded systems have become an indispensable core technology in the fields of Internet of Things, industrial automation, smart home, automotive electronics, etc. This technology is usually composed of various hardware peripherals (such as sensors, actuators, EMMC, DDR, Norflash, etc.), software platforms such as operating systems, and driver codes. In related methods, the driver code is usually developed based on the SDK (software development tool) provided by the hardware peripheral manufacturer, which makes the driver code in the related method still have the problem of large storage space required and easy to be reverse cracked. Summary of the invention
[0003] In view of the above problems, the present application proposes a driving code optimization method, device and electronic device to improve the above problems.
[0004] In a first aspect, the present application provides a driver code optimization method, the method comprising: traversing and calling all functions in the driver code, and obtaining the register addresses and register values corresponding to all functions; generating template code based on the function names, register addresses and register values corresponding to all functions.
[0005] In the second aspect, the present application provides a driver code optimization device, which includes: an information acquisition unit, used to traverse and call all functions in the driver code, and obtain the register addresses and register values corresponding to all functions; a code optimization unit, used to generate template code based on the function names, register addresses and register values corresponding to all functions.
[0006] In a third aspect, the present application provides an electronic device comprising one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above-mentioned method.
[0007] In a fourth aspect, the present application provides a computer-readable storage medium, in which program code is stored, wherein the above method is executed when the program code is run.
[0008] The present application provides a driver code optimization method, device, electronic device and storage medium. After traversing and calling all functions in the driver code and obtaining the register addresses and register values corresponding to all functions, a template code is generated based on the function names, register addresses and register values corresponding to all functions. Through the above method, all functions in the driver code can be traversed and called, and the register addresses and register values corresponding to all functions can be obtained. Then, based on the function names, register addresses and register values corresponding to all functions, a template code is generated, thereby simplifying the lengthy driver code into a template code containing register addresses and register values, that is, in the subsequent development and use process, the driver code can be replaced with the template code, so that while reducing the storage space occupied by the code, the difficulty of the driver code being reverse cracked can be increased, thereby improving the security of the driver code. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0010] Figure 1 A flowchart of a driver code optimization method proposed in an embodiment of the present application is shown;
[0011] Figure 2 A schematic diagram of a peripheral simulation software proposed in the present application is shown;
[0012] Figure 3 A flowchart of a driver code optimization method proposed in another embodiment of the present application is shown;
[0013] Figure 4 A structural block diagram of a drive code optimization device proposed in an embodiment of the present application is shown;
[0014] Figure 5 A structural block diagram of a vehicle proposed in this application is shown. DETAILED DESCRIPTION
[0015] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0016] In an embodiment of the present application, the inventor proposes a driver code optimization method, device, and electronic device, which generates a template code based on the function names, register addresses, and register values corresponding to all functions after traversing and calling all functions in the driver code and obtaining the register addresses and register values corresponding to all functions. Through the above method, it is possible to traverse and call all functions in the driver code, obtain the register addresses and register values corresponding to all functions, and then generate a template code based on the function names, register addresses, and register values corresponding to all functions, thereby simplifying the lengthy driver code into a template code containing register addresses and register values, that is, in the subsequent development and use process, the driver code can be replaced by the template code, so that while reducing the storage space occupied by the code, the difficulty of the driver code being reverse cracked can be increased, thereby improving the security of the driver code.
[0017] See also Figure 1 , an embodiment of the present application provides a driver code optimization method, the method comprising:
[0018] S110: Traverse and call all functions in the driver code, and obtain the register addresses and register values corresponding to all functions.
[0019] Among them, the electronic device may be provided with Figure 2 The peripheral simulation software 11 shown. The peripheral simulation software 11 may include a virtual communication node 111, a virtual register module 113, a control configuration module 115, a timing recording module 117, and a hardware connection module 119. The hardware peripherals may be sensors, actuators, EMMC, DDR, Norflash, etc. The electronic device may be a terminal device, such as a computer, a tablet, a server, etc., and the electronic device may also be a device used for code transplantation or development in a vehicle.
[0020] The virtual communication node 111 can be used to transmit driver code and configuration information. The driver code can refer to the code developed by the SDK (Software Development Kit) provided by the hardware peripheral chip manufacturer. The driver code and the hardware peripheral can be a one-to-one correspondence, that is, a driver code developed by the manufacturer is only applicable to one hardware peripheral. The configuration information can refer to the working mode, data transmission efficiency, data read and write interface, etc. of the peripheral simulation software 11 in the electronic device. The working mode can include a transparent transmission mode, a conversion mode, a data mode, a simulation mode, etc. The virtual communication node 111 can include a first virtual communication node and a second virtual communication node, wherein the first virtual communication node can be used to transmit configuration information, and the second virtual communication node can be used to transmit the driver code.
[0021] The virtual register module 113 may include one or more virtual registers corresponding to hardware peripherals. The control configuration module 115 may be used to transmit data and control the peripheral simulation software 11 to work. The timing recording module 117 may be used to record the timing relationship of all functions in the driver code, i.e., the execution order. The hardware connection module may be used to complete the data transmission between the control peripheral simulation software 11 and the hardware peripherals.
[0022] As a method, the control configuration module 115 can traverse and call all functions in the driver code; obtain the register addresses and register values corresponding to all functions through the virtual registers corresponding to the first hardware peripheral, and the driver code is developed based on the first hardware peripheral.
[0023] Among them, when the control configuration module 115 traverses and calls all functions in the driver code, it will involve access to the virtual registers corresponding to the first hardware peripheral, modifying the data content, etc. Therefore, when traversing and calling all functions in the driver code, the virtual registers corresponding to the first hardware peripheral can be used to obtain the register addresses and register values corresponding to all functions, and the execution order of all functions can be recorded through the timing recording module 117.
[0024] S120: Generate template code based on the function names, register addresses and register values corresponding to all functions.
[0025] As a method, when the working mode of the electronic device is the transparent transmission mode, the control configuration module 115 can write the register values corresponding to all functions into the register corresponding to the first hardware peripheral based on the register addresses corresponding to all functions; receive the communication process data corresponding to all functions returned by the first hardware peripheral; and generate template code based on the function names, register addresses, register values and communication process data corresponding to all functions.
[0026] The transparent transmission mode may refer to a mode in which the acquired data (register address and register value) is directly transmitted to the hardware peripheral without any modification. The communication process data may refer to the data generated by the first hardware peripheral in the process of writing the register values corresponding to all functions into the register corresponding to the first hardware peripheral.
[0027] In an embodiment of the present application, after the work content of the transparent transmission mode is executed, there are two ways to generate template code based on the function names, register addresses, register values and communication process data corresponding to all functions.
[0028] As an implementation method, when the working mode of the electronic device is switched from the transparent transmission mode to the code generation mode, the control configuration module 115 can obtain the function names and read-write interfaces corresponding to all functions; based on the function names, read-write interfaces, register addresses, register values, and communication process data corresponding to all functions, generate template code.
[0029] Among them, the code generation mode can be used to convert the driver code into a template code. After entering the code generation mode, the control configuration module 115 can read the function function list (ie, function name) and read-write interface corresponding to the driver code, and generate the template code in combination with the recorded communication data.
[0030] As another implementation method, when the working mode of the electronic device is switched from the transparent transmission mode to the data mode, the control configuration module 115 can send the register addresses, register values and communication process data corresponding to all functions to the target device, so that the target device generates a template code based on the function names, register addresses, register values and communication process data corresponding to all functions.
[0031] The target device may refer to the electronic device itself or another electronic device connected to the electronic device. The data mode may be used to transfer data in the peripheral simulation software 10 to the target device, or to import the acquired register values and register addresses from the target device to the peripheral simulation software 10.
[0032] Optionally, after the target device receives the function names, register addresses, register values and communication process data corresponding to all functions, the acquired function names, register addresses, register values and communication process data corresponding to all functions can be displayed to the R&D personnel through the screen, so that the R&D personnel can make manual modifications according to the needs of the R&D tasks (such as adjusting the function execution order, deleting or adding certain functions, etc.), and then use the modified results as template codes.
[0033] In the embodiment of the present application, by combining the transparent transmission mode with the code generation mode to generate the template code, the automatic generation of the template code can be realized, which is faster and more convenient; by combining the transparent transmission mode with the data mode to generate the template code, the template code can be generated in a personalized manner, which improves the flexibility of the generated template code. The above two methods of generating template code can replace the driver code with the template code, thereby reducing the redundancy of the code and improving the uninterpretability of the code. That is to say, in the application scenario of driver code optimization, any of the above two methods can be selected according to one's own needs.
[0034] Optionally, before generating the template code based on the function names, register addresses and register values corresponding to all functions, the control configuration module may obtain configuration information such as the working mode of the electronic device as shown in Table 1 from the first virtual communication node.
[0035] Table 1
[0036]
[0037]
[0038] The present embodiment provides a driver code optimization method, which generates template code based on the function names, register addresses and register values corresponding to all functions after traversing and calling all functions in the driver code and obtaining the register addresses and register values corresponding to all functions. Through the above method, it is possible to traverse and call all functions in the driver code, obtain the register addresses and register values corresponding to all functions, and then generate template code based on the function names, register addresses and register values corresponding to all functions, thereby simplifying the lengthy driver code into a template code containing register addresses and register values, that is, in the subsequent development and use process, the driver code can be replaced by the template code, so that while reducing the storage space occupied by the code, the difficulty of the driver code being reverse cracked can be increased, thereby improving the security of the driver code.
[0039] See also Figure 3 , an embodiment of the present application provides a driver code optimization method, the method comprising:
[0040] S210: In response to receiving a virtual register address that the driver code needs to access from the second virtual communication node, sending a write request to the virtual register address.
[0041] The virtual register address may be a virtual register address of the first hardware peripheral corresponding to the driver code in the virtual register module 113 .
[0042] As a method, the control configuration module 115 in the electronic device may send a write request to the virtual register address in response to receiving the virtual register address that the driving code needs to access from the second virtual communication node.
[0043] Optionally, when the peripheral simulation software 10 is started, a virtual communication node, such as a first virtual communication node and a second virtual communication node, can be virtualized first, so that when the driver code accesses the peripheral simulation software 10, the virtual register address that the driver code needs to access can be sent through the second virtual communication node first, so that the control configuration module 115 responds to receiving the virtual register address that the driver code needs to access from the second virtual communication node, and sends a write request to the virtual register address.
[0044] S220: If the feedback information received about the virtual register address indicates that writing is allowed, all functions in the driver code are written into the virtual register address.
[0045] As a method, if the control configuration module 115 receives feedback information of the virtual register address indicating that writing is allowed, all functions in the driver code are written to the virtual register address.
[0046] Optionally, when it is necessary to read data in the peripheral simulation software 10, the register address to be accessed may be sent through the second virtual communication node first, and wait for receiving data returned by the corresponding register address.
[0047] S230: Traverse and call all functions in the driver code, and obtain the register addresses and register values corresponding to all functions.
[0048] S240: Generate template code based on the function names, register addresses and register values corresponding to all functions.
[0049] S250: Based on the mapping relationship between the register address of the first hardware peripheral and the register address of the second hardware peripheral, convert the register addresses and register values corresponding to all the functions into the register addresses and register values in the second hardware peripheral.
[0050] As a method, when the working mode of the electronic device is the conversion mode, the control configuration module 115 can convert the register addresses and register values corresponding to all functions into the register addresses and register values in the second hardware peripheral based on the mapping relationship between the register addresses of the first hardware peripheral and the register addresses of the second hardware peripheral.
[0051] Among them, the first hardware peripheral and the second hardware peripheral can be peripheral chips of the same series, such as Realtek 9071, Realtek 9072, etc.; the first hardware peripheral and the second hardware peripheral can also be chips that comply with the same industry specifications, such as PHY chips. The industry stipulates that the values of the first 32 registers are the same, so that the mapping relationship between the register address of the first hardware peripheral and the register address of the second hardware peripheral is known.
[0052] Among them, the first hardware peripheral and the second hardware peripheral can also be chips of different series and different industry specifications. In this case, you can first confirm whether the first driver code and the second driver code exist, wherein the first driver code is a code developed for the first hardware peripheral, and the second driver code is a code developed for the second hardware peripheral, and the first driver code and the second driver code play the same role; if they exist, you can simulate the first driver code and the second driver code and track the running data to obtain the mapping relationship between the register address of the first hardware peripheral and the register address of the second hardware peripheral.
[0053] Optionally, at this time, the electronic device may not be configured with the first hardware peripheral, but only with the second hardware peripheral.
[0054] S260: Generate a migration template code based on function names corresponding to all functions, register addresses and register values in the second hardware peripheral, where the migration template code is used to run in the second hardware peripheral.
[0055] As a way, when the working mode of the electronic device is the conversion mode, the control configuration module 115 can generate a migration template code based on the function names corresponding to all functions, the register addresses and register values in the second hardware peripheral.
[0056] Optionally, when the driver code is debugged for the first time or the first hardware peripheral is lacking, the R&D personnel can set the working mode of the electronic device to simulation mode, so that when the control configuration module 115 receives the configuration information of the simulation mode, it can simulate the first hardware peripheral and provide an interactive interface and virtual interactive data during simulation.
[0057] In the embodiment of the present application, the driver code debugging is completed through the simulation mode, which can solve the problem that the embedded software is heavily dependent on the hardware board, that is, hardware simulation is realized at a low cost, so that the debugging of the driver code does not need to rely on the hardware.
[0058] A driver code optimization method provided in this embodiment can traverse and call all functions in the driver code through the above method, and obtain the register addresses and register values corresponding to all functions, and then generate template codes based on the function names, register addresses and register values corresponding to all functions, so as to simplify the lengthy driver code into template codes containing register addresses and register values, that is, in the subsequent development and use process, the driver code can be replaced by the template code, so that while reducing the storage space occupied by the code, the difficulty of the driver code being reverse cracked can be increased, and the security of the driver code is improved. In addition, in this embodiment, based on the conversion mode, the driver code that is only applicable to the first hardware peripheral can be changed into a migration template code that can be applicable to the second hardware peripheral, so that the same driver code can be adapted to multiple hardware peripherals, so that the driver code can be used across platforms, and the transplantation difficulty of embedded software (such as driver code) can be reduced. In addition, in this embodiment, by setting multiple working modes of electronic devices, and based on one or more working mode combinations, the application of driver code optimization, code platformization, and code simulation in three scenarios can be completed, so that the driver code is optimized through the above three application scenarios, the driver code is reduced, the driver code transplantation degree is reduced, and the limitation of relying on hardware is overcome.
[0059] See also Figure 4 The present application provides a driver code optimization device 400, the device 400 comprising:
[0060] The information acquisition unit 410 is used to traverse all functions in the calling driver code and obtain the register addresses and register values corresponding to all functions;
[0061] The code optimization unit 420 is used to generate template codes based on the function names, register addresses and register values corresponding to all functions.
[0062] As a method, the information acquisition unit 410 is specifically used to traverse and call all functions in the driver code; through the virtual register corresponding to the first hardware peripheral, the register address and register value corresponding to all functions are obtained, and the driver code is developed based on the first hardware peripheral.
[0063] As a method, the code optimization unit 420 is specifically used to, when the working mode of the electronic device is the transparent transmission mode, write the register values corresponding to all functions into the register corresponding to the first hardware peripheral based on the register addresses corresponding to all functions; receive the communication process data corresponding to all functions returned by the first hardware peripheral; and generate template code based on the function names, register addresses, register values and communication process data corresponding to all functions.
[0064] Optionally, the code optimization unit 420 is specifically used to obtain the function names and read-write interfaces corresponding to all the functions when the working mode of the electronic device is switched from the transparent transmission mode to the code generation mode; and generate template code based on the function names, read-write interfaces, register addresses, register values, and communication process data corresponding to all the functions.
[0065] Optionally, the code optimization unit 420 is specifically used to send the register addresses, register values and communication process data corresponding to all functions to the target device when the working mode of the electronic device is switched from the transparent transmission mode to the data mode, so that the target device generates the template code based on the function names, register addresses, register values and communication process data corresponding to all functions.
[0066] Optionally, the information acquisition unit 410 is specifically used to obtain the working mode of the electronic device from the first virtual communication node.
[0067] As a method, the code optimization unit 420 is specifically used to convert the register addresses and register values corresponding to all the functions into the register addresses and register values in the second hardware peripheral based on the mapping relationship between the register addresses of the first hardware peripheral and the register addresses of the second hardware peripheral; based on the function names corresponding to all the functions, the register addresses and register values in the second hardware peripheral, generate a migration template code, and the migration template code is used to run in the second hardware peripheral.
[0068] As a method, the information acquisition unit 410 is specifically used to send a write request to the virtual register address that the driver code needs to access in response to receiving the virtual register address from the second virtual communication node; if the feedback information received from the virtual register address indicates that the write is agreed, all functions in the driver code are written to the virtual register address.
[0069] The following will be combined Figure 5 An electronic device provided by the present application is described.
[0070] See also Figure 5 Based on the above-mentioned driver code optimization method and device, the embodiment of the present application also provides another electronic device 100 that can execute the above-mentioned driver code optimization method. The electronic device 100 includes a processor 102 and a memory 104. The memory 104 stores a program that can execute the content of the above-mentioned embodiment, and the backup processor 102 can execute the program stored in the memory 104.
[0071] Among them, the processor 102 may include one or more processing cores. The processor 102 uses various interfaces and lines to connect various parts within the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 104, and calling data stored in the memory 104. Optionally, the processor 102 can be implemented in at least one hardware form of a network processor (Neural network Processing Unit, NPU), a digital signal processing (Digital Signal Processing, DSP), a field programmable gate array (Field-Programmable Gate Array, FPGA), and a programmable logic array (Programmable Logic Array, PLA). The processor 102 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU), a network processor (Neural network Processing Unit, NPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; the NPU is responsible for processing multimedia data such as video and images; and the modem is used to process wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 102, but may be implemented separately through a communication chip.
[0072] The memory 104 may include a random access memory (RAM), and may also include a read-only memory (RAM) and a double data rate synchronous dynamic random access memory (DDR). The memory 104 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the electronic device 100 during use.
[0073] An embodiment of the present application provides a computer-readable storage medium in which a program code is stored, and the program code can be called by a processor to execute the method described in the above method embodiment.
[0074] The computer readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium includes a non-transitory computer-readable storage medium. The computer readable storage medium has storage space for program codes that execute any of the method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code can be compressed, for example, in an appropriate form.
[0075] In summary, the present application provides a driver code optimization method, device, and electronic device, which generates template code based on the function names, register addresses, and register values corresponding to all functions after traversing and calling all functions in the driver code and obtaining the register addresses and register values corresponding to all functions. Through the above method, it is possible to traverse and call all functions in the driver code, obtain the register addresses and register values corresponding to all functions, and then generate template code based on the function names, register addresses, and register values corresponding to all functions, thereby simplifying the lengthy driver code into a template code containing register addresses and register values, that is, in the subsequent development and use process, the driver code can be replaced by the template code, so that while reducing the storage space occupied by the code, the difficulty of the driver code being reverse cracked can be increased, thereby improving the security of the driver code.
[0076] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A driver code optimization method, characterized in that: The method comprises: Traverse and call all functions in the driver code, and obtain the register addresses and register values corresponding to all functions; Generate template code based on the function names, register addresses, and register values corresponding to all functions.
2. The method according to claim 1, characterized in that The traversal calls all functions in the driver code and obtains the register addresses and register values corresponding to all functions, including: Traverse and call all functions in the driver code; The register addresses and register values corresponding to all functions are obtained through the virtual register corresponding to the first hardware peripheral, and the driver code is developed based on the first hardware peripheral.
3. The method according to claim 1, characterized in that The template code is generated based on the function names, register addresses and register values corresponding to all functions, including: When the working mode of the electronic device is the transparent transmission mode, based on the register addresses corresponding to all the functions, the register values corresponding to all the functions are written into the register corresponding to the first hardware peripheral; Receiving communication process data corresponding to each of the functions returned by the first hardware peripheral; Generate template code based on the function name, register address, register value and communication process data corresponding to all functions.
4. The method according to claim 3, characterized in that: The template code is generated based on the function names, register addresses, register values and communication process data corresponding to all functions, including: When the working mode of the electronic device is switched from the transparent transmission mode to the code generation mode, the function names and read / write interfaces corresponding to all the functions are obtained; Generate template code based on the function names, read / write interfaces, register addresses, register values, and communication process data corresponding to all functions.
5. The method according to claim 3, characterized in that: The template code is generated based on the function names, register addresses, register values and communication process data corresponding to all functions, including: When the working mode of the electronic device is switched from the transparent transmission mode to the data mode, the register addresses, register values and communication process data corresponding to all functions are sent to the target device, so that the target device generates the template code based on the function names, register addresses, register values and communication process data corresponding to all functions.
6. The method according to claim 3, characterized in that: The template code is generated based on the function names, register addresses and register values corresponding to all functions, and the above also includes: The working mode of the electronic device is obtained from the first virtual communication node.
7. The method according to claim 1, characterized in that The driver code is developed based on the first hardware peripheral, and the traversal calls all functions in the driver code and obtains the register addresses and register values corresponding to all functions, and then further includes: Based on the mapping relationship between the register address of the first hardware peripheral and the register address of the second hardware peripheral, converting the register addresses and register values corresponding to all the functions into the register addresses and register values in the second hardware peripheral; Based on the function names corresponding to all functions, the register addresses and register values in the second hardware peripheral, a migration template code is generated, and the migration template code is used to run in the second hardware peripheral.
8. The method according to claim 1, characterized in that: The traversal calls all functions in the driver code to obtain the register addresses and register values corresponding to all functions, and before that, also includes: In response to receiving from the second virtual communication node a virtual register address that the driver code needs to access, sending a write request to the virtual register address; If the feedback information received about the virtual register address indicates that writing is allowed, all functions in the driver code are written to the virtual register address.
9. A drive code optimization device, characterized in that: The device comprises: An information acquisition unit, used to traverse all functions in the calling driver code and obtain the register addresses and register values corresponding to all functions; The code optimization unit is used to generate template codes based on function names, register addresses and register values corresponding to all functions.
10. An electronic device, characterized in that: including one or more processors and memory; One or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, wherein when the program code is run, the method according to any one of claims 1 to 8 is executed.