Equipment control method and device and electronic equipment
By defining the target macro in the project file of the device tree source file, the problem of high maintenance cost of the device tree source file is solved, and the adaptation of the device tree source file and hardware is realized, simplifying the maintenance process and reducing costs.
Patent Information
- Application Number
- CN202311133048.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2025-03-04
AI Technical Summary
In the application of equipment tree source files, it is difficult for the existing technology to effectively reduce the maintenance cost of equipment tree source files, especially in the development of multi-hardware products, multiple sets of equipment tree source files need to be frequently modified and maintained.
By defining the target macros in the project file of the device tree source file, the device tree source file corresponding to the target hardware can be called based on these macros, thereby realizing the adaptation of the device tree source file and the hardware, without making complex changes to the device tree source file or maintaining multiple sets of codes.
It reduces the maintenance cost of device tree source files, simplifies the application process of device tree source files, and makes a set of device tree source files suitable for multiple hardware products, reducing the complexity and labor costs of code maintenance.
Smart Images

Figure CN119556889A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a device control method, apparatus, and electronic device. Background Art
[0002] Device tree (DT) is a set of rules used to describe hardware attributes, and device tree source file (DTS) is the source file of device tree. When using device tree source file, convert it into binary file and then write it to the corresponding device so that it can be used by the device. Summary of the invention
[0003] This disclosure section is provided to introduce concepts in a brief form, which will be described in detail in the detailed description section below. This disclosure section is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] The embodiments of the present disclosure provide a device control method, apparatus, and electronic device, which can define macros in a project file of a device tree source file, thereby reducing the maintenance cost of the device tree source file.
[0005] In a first aspect, an embodiment of the present disclosure provides a device control method, including: obtaining a project file corresponding to an original device tree source file; the project file is used to describe the program language compilation rules of a target system; in response to receiving a macro definition request, defining a target macro in the project file; the target macro is used to call a device tree source file corresponding to target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
[0006] In a second aspect, an embodiment of the present disclosure provides another device control method, including: obtaining a project file corresponding to an original device tree source file; the project file is used to describe the program language compilation rules of the target system; identifying the target macro in the project file to call the device tree source file corresponding to the target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
[0007] In a third aspect, an embodiment of the present disclosure provides a device control apparatus, comprising: an acquisition unit, for acquiring a project file corresponding to an original device tree source file; the project file is used to describe program language compilation rules of a target system; a configuration unit, for defining a target macro in the project file in response to receiving a macro definition request; the target macro is used to call a device tree source file corresponding to target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
[0008] In a fourth aspect, an embodiment of the present disclosure provides another device control device, comprising: an acquisition unit, used to acquire a project file corresponding to an original device tree source file; the project file is used to describe the program language compilation rules of the target system; a processing unit, used to identify the target macro in the project file to call the device tree source file corresponding to the target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
[0009] In a fifth aspect, an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the device control method as described in the first aspect or the second aspect.
[0010] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the device control method as described in the first aspect or the second aspect.
[0011] The device control method, apparatus, and electronic device provided by the embodiments of the present disclosure define a target macro in a project file corresponding to the original device tree source file, so that the device tree source file corresponding to the target hardware can be called based on the target macro. Then, when the device tree source file is applied to the hardware, the device tree source file can be adapted to the hardware by defining a macro, without making complex changes to the device tree source file or using multiple sets of code maintenance. Thus, by defining macros in the project file of the device tree source file, the maintenance cost of the device tree source file is reduced.
[0012] Also, when applying the device tree source file, the target macro in the project file is identified, and the device tree source file corresponding to the target hardware can be called. The application method is also relatively simple, reducing the maintenance cost of the device tree source file. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0014] Figure 1 is a flow chart of an embodiment of a device control method according to the present disclosure;
[0015] Figure 2 is a flow chart of another embodiment of a device control method according to the present disclosure;
[0016] Figure 3is a flow chart of an embodiment of a device control apparatus according to the present disclosure;
[0017] Figure 4 is a structural schematic diagram of another embodiment of the device control apparatus according to the present disclosure;
[0018] Figure 5 is an exemplary system architecture to which the device control method of an embodiment of the present disclosure may be applied;
[0019] Figure 6 It is a schematic diagram of the basic structure of an electronic device provided according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0021] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0022] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0023] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0024] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0025] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0026] The technical solution provided by the embodiments of the present disclosure can be applied to various application scenarios involving device trees. In these application scenarios, device trees are used to describe the rules of hardware attributes.
[0027] The concept of device tree was introduced after Linux 3.0 (an operating system). For example, the Android system is based on Linux. The development of devices based on the Android system requires the configuration of the corresponding device tree source files based on the hardware characteristics, and then the corresponding driver development is completed.
[0028] In addition to the device tree source file, these application scenarios also involve binary files of the device tree source file. When using the device tree source file, first modify the device tree source file according to the hardware, then use the file conversion tool to convert the device tree source file into a binary file during compilation, and then write the binary file to the corresponding device, such as a storage medium such as a disk.
[0029] Currently, in the product development platform, there are a large number of device tree source files, and there are complex reference relationships between the device tree source files.
[0030] In some application scenarios, multiple hardware products may be developed simultaneously during the device development process, and the software has to be maintained using multiple sets of code, or many device tree source files with the same meaning are defined based on the reference relationship of the existing device tree source files on the platform to adapt to different hardware designs. As a result, the maintenance cost of the device tree source files is high.
[0031] Considering that the device tree source file has its own project file, the project file can describe the system's programming language compilation rules. If macro definitions are performed in the project file, the defined macros can be used to distinguish different hardware, and a set of device tree source files can be implemented, which is suitable for multiple hardware products.
[0032] Based on this, the disclosed embodiment defines a target macro in the project file corresponding to the original device tree source file, so that the device tree source file corresponding to the target hardware can be called based on the target macro. Then, when the device tree source file is applied to the hardware, the device tree source file can be adapted to the hardware by defining a macro, without making complex changes to the device tree source file, and without using multiple sets of code maintenance. Therefore, by defining a macro in the project file of the device tree source file, the maintenance cost of the device tree source file is reduced.
[0033] Moreover, when applying the device tree source file, the target macro in the project file is identified, and the device tree source file corresponding to the target hardware can be called. The application method is also relatively simple, reducing the maintenance cost of the device tree source file.
[0034] Please refer to Figure 1, which shows the process of an embodiment of the device control method according to the present disclosure. The device control method can be applied to terminal devices. Figure 1 The device control method shown comprises the following steps:
[0035] Step 101, obtaining a project file corresponding to the original device tree source file.
[0036] In some embodiments, the original device tree source file can be understood as an existing device tree source file in the hardware development platform, and development needs to be done based on the original device tree source file to apply the device tree source file to the corresponding hardware product.
[0037] Among them, the hardware product involved in the embodiments of the present disclosure may be: a Linux-based kernel device.
[0038] In some embodiments, the project file corresponding to the device tree source file may be a Makefile file of the device tree source file, and the Makefile file is used to describe the program language compilation rules of the target system.
[0039] In different application scenarios, the target system and programming language compilation rules may be different accordingly.
[0040] It can be understood that there are countless source files in a project, which are placed in several directories according to type, function, and module. Makefile defines a series of rules to specify which files need to be compiled first, which files need to be compiled later, and which files need to be recompiled, and even more complex functional operations can be performed, because Makefile is like a Shell script and can also execute operating system commands.
[0041] Therefore, for the device tree source file, the target system may be an operating system, and the corresponding program language may be C / C++ or other code languages, which are not limited here.
[0042] Furthermore, based on the definition and understanding of the project file, if macro definitions are added to the project file, rules for calling the device tree source file can be added, making the application of the device tree source file more convenient without having to generate device tree source files for different hardware separately; or modifying the device tree source file before applying it.
[0043] By adopting the technical solution of the embodiment of the present disclosure, on the basis of various existing device tree source files, it is only necessary to use the project file and add macro definitions for calling the corresponding device tree source files to realize the application of the device tree source files to hardware products.
[0044] Step 102 : In response to receiving a macro definition request, define a target macro in a project file.
[0045] In some embodiments, the macro definition request may be initiated by a user or automatically during a device control process, which is not limited herein. When the macro definition request is initiated, it means that a macro needs to be defined in a project file.
[0046] In some embodiments, the target macro is used to call a device tree source file corresponding to the target hardware, and the device tree source file corresponding to the target hardware belongs to the original device tree source file.
[0047] In some embodiments, the original device tree source file is an applicable source file; for a device tree source file that is not in the original device tree source file, it cannot be directly applied by defining a macro; therefore, the device tree source file corresponding to the target hardware needs to belong to the original device tree source file in order to perform the corresponding macro definition.
[0048] In some embodiments, the number of target hardware may be at least two. That is, when there are multiple hardware, macro definitions may be performed for the multiple hardware to implement configuration of device tree source files corresponding to the multiple hardware.
[0049] Therefore, the technical solution of the embodiment of the present disclosure can define different macros for differentiation according to different hardware, so as to complete a set of codes, support multiple hardware products with very small changes, and save manpower and cost for code maintenance.
[0050] In some embodiments, step 102 includes: configuring an environment variable corresponding to the target macro in the project file; and configuring a value of the environment variable corresponding to the target macro based on a device tree source file corresponding to the target hardware.
[0051] In this implementation, the environment variable corresponding to the target macro is first configured in the project file; then the value of the environment variable is configured to implement the macro definition.
[0052] In some embodiments, the macro definition process includes not only configuring environment variables and the values of environment variables, but also other definition processes, which can be specifically referred to the macro definition methods in different programming languages, for example, the macro definition method in C / C++ code.
[0053] In some embodiments, when the number of target hardware is at least two, the value of the environment variable corresponding to the target macro includes at least two, and different environment variable values correspond to different device tree source files.
[0054] It can be understood that one macro corresponds to one environment variable value. When there are multiple environment variable values, it is equivalent to defining multiple macros. Therefore, the target macro can be understood as a collection of multiple macros or as a single macro. The specific one depends on the number of hardware and the number of environment variable values.
[0055] Therefore, based on at least two hardwares, multiple environment variable values can be used to implement the definition of macros corresponding to at least two hardwares respectively.
[0056] For example, assuming that the environment variable corresponding to the macro is: CUSTOMER_DTSIFLAGS+=-DPRODUCT_NAME, then CUSTOMER_DTSIFLAGS+=-DPRODUCT_NAME=hw01 can represent the macro corresponding to the device tree source file of hardware 1; CUSTOMER_DTSIFLAGS+=-DPRODUCT_NAME=hw02 can represent the macro corresponding to the device source file of hardware 2.
[0057] It should be noted that this is only an example of an environment variable and does not constitute a limitation on the form and specific value of the environment variable.
[0058] In some embodiments, the macro definition request may include: the form of the environment variable and the value of the environment variable. Thus, based on the macro definition request, the macro definition may be completed.
[0059] In other embodiments, the macro definition request may not include the form of the environment variable and the corresponding value. At this time, before executing the configuration environment variable and the environment variable value, the environment variable and the environment variable value may be requested to be input, and then, the subsequent configuration process is completed through the environment variable and the environment variable value input by the user.
[0060] In some embodiments, after the macro definition is completed, it is not necessarily guaranteed that the defined macro can be applied. Therefore, it is necessary to execute the relevant process of macro validation to ensure that the defined macro can be applied.
[0061] As an optional implementation, the device control method further includes: obtaining an editing script corresponding to the original device tree source file; adding a preprocessing command in the compilation script; and the preprocessing command is used to make the target macro effective.
[0062] In this implementation, a compilation script corresponding to the device tree source file is first obtained, and then a preprocessing command for making the macro effective is added to the compilation script, so that the macro in the project file can be identified and applied in the subsequent application process.
[0063] For example, in C / C++ code, the preprocessing command may be a preprocessing command in the form of: add $(CUSTOMER_DTSIFLAGS).
[0064] In other embodiments, the macro may be validated by other technical means that can make the macro definition effective, which is not limited here.
[0065] In some embodiments, after the macro definition is completed, a binary file may be generated based on the device tree source file, so that the device tree source file may be directly applied later.
[0066] Therefore, as an optional implementation, the device control method further includes: converting the original device tree source file into a binary file, so that the original device tree source file can be applied by the target hardware.
[0067] In some embodiments, the device tree source file may be converted into a binary file through a preset file conversion tool.
[0068] Through the introduction of the embodiments of the present disclosure, a target macro is defined in the project file corresponding to the original device tree source file, so that the device tree source file corresponding to the target hardware can be called based on the target macro. Then, when the device tree source file is applied to the hardware, the device tree source file can be adapted to the hardware by defining a macro, without making complex changes to the device tree source file, and without using multiple sets of code maintenance. Therefore, by defining a macro in the project file of the device tree source file, the maintenance cost of the device tree source file is reduced.
[0069] The technical solution of the embodiment of the present disclosure is used to implement macro definition, so that the device tree source file can implement the application of multiple hardware products based on the macro; in other embodiments, if the macro definition is not performed in the manner provided by the embodiment of the present disclosure, other methods may be used to implement the macro definition. Based on this, the embodiment of the present disclosure also provides a technical solution for implementing the application process of multiple hardware products based on the macro.
[0070] Please refer to Figure 2 , which shows the process of another embodiment of the device control method according to the present disclosure. The device control method can be applied to terminal devices. Figure 2 The device control method shown comprises the following steps:
[0071] Step 201, obtaining a project file corresponding to the original device tree source file, wherein the project file is used to describe the program language compilation rules of the target system.
[0072] In some embodiments, the implementation of the project file can refer to the implementation of the project file in the aforementioned embodiments, which will not be repeated here.
[0073] It can be understood that the project file is used to describe the program language compilation rules of the target system. Therefore, when calling the device tree source file, it is necessary to first identify the project file; therefore, before making the call, the project file is first obtained.
[0074] And, the device tree source file that can be applied is a binary file. Therefore, in step 202, the original device tree source file should be a binary file.
[0075] In other embodiments, if the original device tree source file is not a binary file, it may also be converted into a binary file first.
[0076] Step 202, identifying the target macro in the project file to call the device tree source file corresponding to the target hardware, wherein the device tree source file corresponding to the target hardware is an original device tree source file.
[0077] As an optional implementation, step 202 includes: identifying the value of an environment variable corresponding to the target macro; and calling a device tree source file corresponding to the target hardware according to the value of the environment variable.
[0078] As described in the above embodiments, macro definition can be achieved by configuring environment variables and their values. Therefore, when performing macro recognition, the value of the environment variable corresponding to the target macro can be directly recognized, and the device tree source file corresponding to the target hardware can be determined and called according to the value of the environment variable.
[0079] In some embodiments, the number of target hardware is at least two, the value of the environment variable corresponding to the target macro includes at least two, and different environment variable values correspond to different device tree source files.
[0080] Therefore, when different environment variable values are identified, the device tree source files corresponding to different hardware can be directly called.
[0081] In some embodiments, step 202 includes: identifying a target macro in a project file by executing a preprocessing command in an editing script corresponding to the original device tree source file.
[0082] As described in the above embodiments, macro definitions can be made effective through preprocessing commands. Therefore, correspondingly, during the application process, the target macro in the project file can be identified by executing the preprocessing commands in the editing script corresponding to the original device tree source file.
[0083] Through the introduction of the embodiments of the present disclosure, when applying a device tree source file, the target macro in the project file is identified, and the device tree source file corresponding to the target hardware can be called. The application method is also relatively simple, reducing the maintenance cost of the device tree source file.
[0084] Further references Figure 3 , as a response to the above Figure 1 The present disclosure provides an embodiment of a device control apparatus, and the device embodiment is Figure 1 Corresponding to the device control method embodiment shown, the apparatus can be specifically applied to various electronic devices.
[0085] like Figure 3As shown, the device control device of this embodiment includes: a first acquisition unit 301, used to acquire a project file corresponding to an original device tree source file; the project file is used to describe a program language compilation rule of a target system; a configuration unit 302, used to define a target macro in the project file in response to receiving a macro definition request; the target macro is used to call a device tree source file corresponding to target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
[0086] In some embodiments, the configuration unit 302 is further used to: configure the environment variables corresponding to the target macro in the project file; and configure the value of the environment variables corresponding to the target macro based on the device tree source file corresponding to the target hardware.
[0087] In some embodiments, the number of the target hardware is at least two, the value of the environment variable corresponding to the target macro includes at least two, and different environment variable values correspond to different device tree source files.
[0088] In some embodiments, the first acquisition unit 301 is further used to: acquire the editing script corresponding to the original device tree source file; the configuration unit 302 is further used to: add a preprocessing command in the compilation script; the preprocessing command is used to make the target macro effective.
[0089] In some embodiments, the configuration unit 302 is further configured to: convert the original device tree source file into a binary file, so that the original device tree source file can be applied by the target hardware.
[0090] Further references Figure 4 , as a response to the above Figure 2 The present disclosure provides another embodiment of a device control apparatus, which is similar to Figure 2 Corresponding to the device control method embodiment shown, the apparatus can be specifically applied to various electronic devices.
[0091] like Figure 4 As shown, the device control device of this embodiment includes: a second acquisition unit 401, used to acquire a project file corresponding to an original device tree source file; the project file is used to describe a program language compilation rule of a target system; a processing unit 402, used to identify a target macro in the project file to call a device tree source file corresponding to target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
[0092] In some embodiments, the processing unit 402 is further configured to: identify a value of an environment variable corresponding to the target macro; and call a device tree source file corresponding to the target hardware according to the value of the environment variable.
[0093] In some embodiments, the number of the target hardware is at least two, the value of the environment variable corresponding to the target macro includes at least two, and different environment variable values correspond to different device tree source files.
[0094] In some embodiments, the processing unit 402 is further configured to: identify the target macro in the project file by executing a preprocessing command in an editing script corresponding to the original device tree source file.
[0095] Please refer to Figure 5 , Figure 5 An exemplary system architecture is shown in which the device control method according to one embodiment of the present disclosure can be applied.
[0096] like Figure 5 As shown, the system architecture may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 may be used to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0097] The terminal devices 501, 502, and 503 can interact with the server 505 through the network 504 to receive or send messages, etc. Various client applications, such as web browser applications, search applications, and news information applications, can be installed on the terminal devices 501, 502, and 503. The client applications in the terminal devices 501, 502, and 503 can receive user instructions and perform corresponding functions according to the user instructions, such as adding corresponding information to the information according to the user instructions.
[0098] Terminal devices 501, 502, 503 can be hardware or software. When terminal devices 501, 502, 503 are hardware, they can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Compression Standard Audio Layer 3), MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Compression Standard Audio Layer 4) players, laptop computers and desktop computers, etc. When terminal devices 501, 502, 503 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0099] The server 505 may be a server that provides various services, such as receiving information acquisition requests sent by the terminal devices 501, 502, and 503, acquiring display information corresponding to the information acquisition requests in various ways according to the information acquisition requests, and sending relevant data of the display information to the terminal devices 501, 502, and 503.
[0100] It should be noted that the device control method provided in the embodiment of the present disclosure can be executed by a terminal device, and accordingly, the device control apparatus can be set in the terminal devices 501, 502, and 503. In addition, the device control method provided in the embodiment of the present disclosure can also be executed by a server 505, and accordingly, the device control apparatus can be set in the server 505.
[0101] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0102] Reference below Figure 6 , which shows an electronic device (eg, Figure 5 The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0103] like Figure 6 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0104] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0105] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0106] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0107] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0108] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0109] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains a project file corresponding to an original device tree source file; the project file is used to describe the program language compilation rules of the target system; in response to receiving a macro definition request, defines a target macro in the project file; the target macro is used to call a device tree source file corresponding to the target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
[0110] Or enable the electronic device to: obtain a project file corresponding to the original device tree source file; the project file is used to describe the program language compilation rules of the target system; identify the target macro in the project file to call the device tree source file corresponding to the target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
[0111] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0112] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0113] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of the unit does not limit the unit itself in some cases. For example, the configuration unit 302 may also be described as "a unit that defines a target macro in the project file in response to receiving a macro definition request."
[0114] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0115] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0116] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0117] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0118] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A device control method, characterized in that: include: Obtaining a project file corresponding to the original device tree source file; the project file is used to describe the program language compilation rules of the target system; In response to receiving a macro definition request, a target macro is defined in the project file; the target macro is used to call a device tree source file corresponding to the target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
2. The device control method according to claim 1, characterized in that: Defining the target macro in the project file includes: Configure the environment variables corresponding to the target macro in the project file; Based on the device tree source file corresponding to the target hardware, the value of the environment variable corresponding to the target macro is configured.
3. The device control method according to claim 2, characterized in that: The number of the target hardware is at least two, the value of the environment variable corresponding to the target macro includes at least two, and different environment variable values correspond to different device tree source files.
4. The device control method according to claim 1, characterized in that: The device control method further includes: Obtaining an editing script corresponding to the original device tree source file; In the compilation script, a preprocessing command is added; the preprocessing command is used to make the target macro effective.
5. The device control method according to claim 1, characterized in that: The device control method further includes: The original device tree source file is converted into a binary file, so that the original device tree source file can be applied by the target hardware.
6. A device control method, characterized in that: include: Obtaining a project file corresponding to the original device tree source file; the project file is used to describe the program language compilation rules of the target system; A target macro in the project file is identified to call a device tree source file corresponding to the target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
7. The device control method according to claim 6, characterized in that: The identifying the target macro in the project file comprises: Identify the value of the environment variable corresponding to the target macro; The device tree source file corresponding to the target hardware is called according to the value of the environment variable.
8. The device control method according to claim 7, characterized in that: The number of the target hardware is at least two, the value of the environment variable corresponding to the target macro includes at least two, and different environment variable values correspond to different device tree source files.
9. The device control method according to claim 6, characterized in that: The identifying the target macro in the project file comprises: The target macro in the project file is identified by executing the preprocessing command in the editing script corresponding to the original device tree source file.
10. A device control device, characterized in that: include: An acquisition unit, used for acquiring a project file corresponding to the original device tree source file; the project file is used for describing a program language compilation rule of a target system; a configuration unit, configured to define a target macro in the project file in response to receiving a macro definition request; The target macro is used to call the device tree source file corresponding to the target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
11. A device control device, characterized in that: include: An acquisition unit, used for acquiring a project file corresponding to the original device tree source file; the project file is used for describing a program language compilation rule of a target system; The processing unit is used to identify the target macro in the project file to call the device tree source file corresponding to the target hardware; the device tree source file corresponding to the target hardware belongs to the original device tree source file.
12. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.
13. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.