Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, a computer device, and a storage medium for generating a configuration file, which can automatically generate a register configuration file corresponding to the IDE version information quickly and accurately, avoid manually compiling a code and manually editing the register configuration file, save resources, reduce the probability of errors, and improve efficiency.
The technical scheme adopted by the invention for solving the technical problems is as follows:
according to an aspect of the embodiments of the present invention, there is provided a method for generating a configuration file, the method including:
acquiring register information according to a chip specification file, wherein the register information comprises register bit bits and at least one of the following information: register address, register name, chip type name;
acquiring IDE version information of an integrated development environment;
and generating a register configuration file corresponding to the IDE version information according to the register information and the IDE version information, wherein the register configuration file at least comprises register bit definition information.
In one possible design, the chip specification file includes at least one of: user manual, specification.
In one possible design, the chip specification file includes a special function register SFR table, and the obtaining of the register information according to the chip specification file includes:
acquiring SFR data information according to the SFR table;
and acquiring the register information from the SFR data information.
In one possible design, the generating a register configuration file corresponding to the IDE version information according to the register information and the IDE version information includes:
determining a file format according to the IDE version information, wherein the file format comprises at least one of an h file format, a c file format and a conf file format;
and generating a register configuration file at least comprising register bit definition information according to the file format.
In one possible design, the register configuration file further includes at least one of a file header, macro definition information, and register definition information.
According to another aspect of the embodiments of the present invention, there is provided an apparatus for automatically generating a configuration file, which is applied to a method for automatically generating a configuration file, the apparatus including: the device comprises an acquisition module and a generation module, wherein:
the acquisition module is used for acquiring register information and integrated development environment IDE version information according to the chip specification file, wherein the register information comprises a register bit and at least one of the following information: register address, register name, chip type name;
and the generating module is used for generating a register configuration file corresponding to the IDE version information according to the register information and the IDE version information, and the register configuration file at least comprises register bit definition information.
In one possible design, the chip specification file includes a special function register SFR table, and the obtaining of the register information according to the chip specification file includes:
acquiring SFR data information according to the SFR table;
and acquiring the register information from the SFR data information.
In one possible design, the generating a register configuration file corresponding to the IDE version information according to the register information and the IDE version information includes:
determining a file format according to the IDE version information, wherein the file format comprises at least one of an h file format, a c file format and a conf file format;
and generating a register configuration file at least comprising register bit definition information according to the file format.
According to another aspect of the embodiments of the present invention, there is provided a computer apparatus including: the invention relates to a method for generating a configuration file, comprising a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the computer program realizes the steps of the method for generating the configuration file according to the embodiment of the invention when being executed by the processor.
According to an aspect of the embodiments of the present invention, there is provided a storage medium, on which a program of a method for generating a configuration file is stored, wherein the program of the method for generating a configuration file, when executed by a processor, implements the steps of the method for generating a configuration file according to the embodiments of the present invention.
Compared with the related art, the embodiment of the invention provides a method, a device, computer equipment and a storage medium for generating a configuration file, wherein the method for generating the configuration file comprises the following steps: acquiring register information according to a chip specification file, wherein the register information comprises register bit bits and at least one of the following information: register address, register name, chip type name; acquiring IDE version information of an integrated development environment; and generating a register configuration file corresponding to the IDE version information according to the register information and the IDE version information, wherein the register configuration file at least comprises register bit definition information. According to the embodiment of the invention, the register information is acquired according to the specification file of the chip, the register information is analyzed quickly and accurately, and the register configuration file corresponding to the IDE version information is automatically generated quickly and accurately according to the acquired IDE version information, so that the register configuration file is prevented from being edited manually by compiling codes manually, resources are saved, the error probability is reduced, and the efficiency is improved.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects to be solved by the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for facilitating the explanation of the present invention, and have no specific meaning in itself. Thus, "module", "component" or "unit" may be used mixedly.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
In one embodiment, as shown in fig. 1, the present invention provides a method of generating a configuration file, the method comprising:
step S1, obtaining register information according to the chip specification file, wherein the register information includes register bit (bit) and at least one of the following information: register address, register name, chip type name.
Wherein, the chip specification file at least comprises one of the following components: user manual, specification. The user manual and/or specification contains register information, which includes register bits and at least one of register address, register name, chip type name, etc.
The specific reference content of the register bit may vary with the specific chip design. For example, a register bit may include the meaning and function of each bit in the register.
And step S2, acquiring integrated development environment IDE version information.
In particular, the IDE version information is used to indicate the IDE version to which the register configuration file applies. An Integrated Development Environment (IDE) is an application program for providing a program Development Environment, and generally includes tools such as a code editor, a compiler, a debugger, and a graphical user interface, which integrate Development software services such as a code writing function, an analysis function, a compiling function, and a debugging function. In this embodiment, the IDE may be configured to perform at least one of editing, compiling, debugging, analyzing, and the like on the register configuration file.
In a specific chip design, because different IDE versions have different requirements for file formats, the IED version format needs to be output according to the different version requirements of the IDE, so as to obtain the IDE version format. Therefore, the generated register configuration file should comply with the format requirements of the target IED version. Optionally, the IDE versions may include any one or more of IDE V3 version, IDE V4 version, IDE V5 version, and accordingly, the required formats of the IDE versions include any one or more of IDEV3 version format, IDE V4 version format, IDE V5 version format.
Step S3, generating a register configuration file corresponding to the IDE version information according to the register information and the IDE version information, where the register configuration file at least includes register bit definition information.
Wherein the register bit definition information includes a definition of the function or stored information for each bit of the register.
Optionally, the register configuration file includes at least one of a file header, macro definition information, and register definition information in addition to the register bit definition information.
The definitions are commonly used in chip design and are indicative terms, and specific references of the definitions may vary with the specific chip design. For example, macro definitions refer to replacing certain text patterns according to a series of predefined rules. A register is a storage medium.
In the embodiment, the register information is acquired according to the specification file of the chip, and the register configuration file corresponding to the IDE version information is automatically generated quickly and accurately according to the acquired IDE version information, so that the register configuration file is prevented from being edited manually by compiling codes manually, resources are saved, the error probability is reduced, and the efficiency is improved.
In one embodiment, the chip specification file includes at least one of: user manual, specification.
Further, the chip specification file includes a Special Function Register (SFR) table, and in step S1, the obtaining of the register information according to the chip specification file includes: acquiring SFR data information according to the SFR table; the register information is obtained from the SFR data information.
An example of SFR data contained in a user manual or specification is shown in the following table:
according to the table, information such as the number, address, name, data for storage, power-on reset value, and the like of each bit of the register can be acquired.
In one embodiment, in step S3, generating a register configuration file corresponding to the IDE version information according to the register information and the IDE version information includes: determining a file format according to the IDE version information, wherein the file format comprises at least one of an h file format, a c file format and a conf file format; according to the file format, a register configuration file is generated that includes at least register bit definition information. Specifically, different IDE versions have different requirements on file formats, e.g., some IDE versions require h-file format, some IDE versions require c-file format, and some IDE versions require conf-file format. The embodiment may further determine the required file format after determining the IDE version information according to the corresponding relationship between the IDE version and the file format requirement thereof, and then generate the configuration file based on the file format. The configuration file comprises register bit definition information and at least one of register definition information, file header and macro definition information.
In the embodiment, the register information is acquired according to the specification file of the chip, the register information is analyzed quickly and accurately, at least one file format selected from an h file format, a c file format and a conf file format is determined according to the acquired IDE version information, and the register configuration file corresponding to the IDE version information is automatically generated quickly and accurately according to the determined file format, so that the register configuration file is prevented from being edited manually by compiling codes, resources are saved, the error probability is reduced, and the efficiency is improved.
In an embodiment, as shown in fig. 2, the present invention provides an apparatus for automatically generating a configuration file, which is applied to a method for automatically generating a configuration file according to any of the above embodiments, the apparatus includes an obtainingmodule 10 and agenerating module 20, where:
the obtainingmodule 10 is configured to obtain register information and integrated development environment IDE version information according to a chip specification file, where the register information includes a register bit and at least one of the following information: register address, register name, chip type name.
Wherein, the chip specification file at least comprises one of the following: user manual, specification. The user manual and/or specification contains register information, and the register information includes register bit and at least one kind of information of register address, register name, chip type name, etc.
The specific reference content of the register bit may vary with the specific chip design. For example, a register bit may include the meaning and function of each bit in the register.
In particular, the IDE version information is used to indicate the IDE version of the register configuration file that is needed. An Integrated Development Environment (IDE) is an application program for providing a program Development Environment, and generally includes tools such as a code editor, a compiler, a debugger, and a graphical user interface, which integrate Development software services such as a code writing function, an analysis function, a compiling function, and a debugging function. In this embodiment, the IDE may be configured to perform at least one of editing, compiling, debugging, analyzing, and the like on the register configuration file.
In a specific chip design, because different IDE versions have different requirements for file formats, the IED version format needs to be output according to the different version requirements of the IDE, so as to obtain the IDE version format. Therefore, the generated register configuration file should comply with the format requirements of the target IED version. Optionally, the IDE versions may include any one or more of IDE V3 version, IDE V4 version, IDE V5 version, and accordingly, the required formats of the IDE versions include any one or more of IDEV3 version format, IDE V4 version format, IDE V5 version format.
And a generatingmodule 20, configured to generate a register configuration file corresponding to the IDE version information according to the register information and the IDE version information, where the register configuration file at least includes register bit definition information.
Optionally, the memory configuration file includes at least one of a file header, macro definition information, and register definition information in addition to the register bit definition information.
The definitions are commonly used in chip design and are indicative terms, and specific references of the definitions may vary with the specific chip design. For example, macro definitions refer to replacing certain text patterns according to a series of predefined rules. A register is a storage medium.
In the embodiment, the register information is acquired by the acquisition module according to the specification file of the chip, the register information is analyzed quickly and accurately, and the generation module automatically generates the register configuration file corresponding to the IDE version information quickly and accurately according to the acquired IDE version information, so that the register configuration file is prevented from being edited manually by compiling codes manually, resources are saved, the error probability is reduced, and the efficiency is improved.
In one embodiment, the chip specification file includes a special function register SFR table, and the obtainingmodule 10 is configured to obtain the register information according to the chip specification file, including: acquiring SFR data information according to the SFR table; register information is obtained from the SFR data information.
In one embodiment, the generatingmodule 20 is configured to generate a register configuration file corresponding to the IDE version information according to the register information and the IDE version information, and includes:
determining a file format according to the IDE version information, wherein the file format comprises at least one of an h file format, a c file format and a conf file format;
according to the file format, a register configuration file is generated that includes at least register bit definition information.
In the embodiment, the register information is acquired according to the specification file of the chip, the register information is analyzed quickly and accurately, at least one file format selected from the h file format, the c file format and the conf file format is determined according to the acquired IDE version information, and the register configuration file corresponding to the IDE version information is automatically generated quickly and accurately according to the determined file format, so that the register configuration file is prevented from being edited manually by compiling codes manually, resources are saved, the error probability is reduced, and the efficiency is improved.
It should be noted that the device embodiment and the method embodiment belong to the same concept, and specific implementation processes thereof are described in the method embodiment in detail, and technical features in the method embodiment are correspondingly applicable in the device embodiment, which is not described herein again.
In an embodiment, an embodiment of the present invention further provides a computer device, as shown in fig. 3, where thecomputer device 900 includes: amemory 902, aprocessor 901 and one or more computer programs stored in thememory 902 and operable on theprocessor 901, thememory 902 and theprocessor 901 being coupled together by abus system 903, the one or more computer programs, when executed by theprocessor 901, implementing the following steps of a method of generating a configuration file according to an embodiment of the present invention:
step S1, register information is obtained according to the chip specification file, wherein the register information includes register bit and at least one of the following information: register address, register name, chip type name.
And step S2, acquiring integrated development environment IDE version information.
Step S3, generating a register configuration file corresponding to the IDE version information according to the register information and the IDE version information, where the register configuration file at least includes register bit definition information.
The method disclosed in the above embodiments of the present invention may be applied to theprocessor 901, or implemented by theprocessor 901. Theprocessor 901 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be implemented by an integrated logic circuit of hardware or an instruction in the form of software in theprocessor 901. Theprocessor 901 may be a general purpose processor, a DSP, or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. Theprocessor 901 may implement or perform the methods, steps and logic blocks disclosed in the embodiments of the present invention. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed by the embodiment of the invention can be directly implemented by a hardware decoding processor, or can be implemented by combining hardware and software modules in the decoding processor. The software modules may be located in a storage medium located in thememory 902, and theprocessor 901 reads the information in thememory 902 to complete the steps of the foregoing method in combination with the hardware thereof.
It is to be understood that thememory 902 of embodiments of the present invention may be either volatile memory or nonvolatile memory, and may include both volatile and nonvolatile memory. Among them, the nonvolatile Memory may 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), a magnetic Random Access Memory (FRAM), a magnetic Random Access Memory (Flash Memory) or other Memory technologies, a Compact disc Read-Only Memory (CD-ROM), a Digital Versatile Disc (DVD), or other optical disc storage, magnetic cartridge, magnetic tape, magnetic Disk storage, or other magnetic storage devices; volatile Memory can be Random Access Memory (RAM), and by way of exemplary and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Double Data Rate Synchronous Random Access Memory (ESDRAM), Synchronous Link Dynamic Random Access Memory (SLDRAM), Direct Memory bus Random Access Memory (DRRAM). The described memory for embodiments of the present invention is intended to comprise, without being limited to, these and any other suitable types of memory.
It should be noted that the embodiments of the computer device and the embodiments of the method belong to the same concept, and specific implementation processes thereof are described in the embodiments of the method, and technical features in the embodiments of the method are correspondingly applicable in the embodiments of the computer device, which is not described herein again.
In addition, in an exemplary embodiment, an embodiment of the present invention further provides a computer storage medium, specifically a computer readable storage medium, for example, amemory 902 storing a computer program, where the computer storage medium stores one or more programs of a method for generating a configuration file, and when the one or more programs of the method for generating a configuration file are executed by aprocessor 901, the following steps of the method for generating a configuration file provided by the embodiment of the present invention are implemented:
step S1, obtaining register information according to the chip specification file, where the register information includes register bits and at least one of the following information: register address, register name, chip type name.
And step S2, acquiring integrated development environment IDE version information.
Step S3, generating a register configuration file corresponding to the IDE version information according to the register information and the IDE version information, where the register configuration file at least includes register bit definition information.
It should be noted that, the method program embodiment and the method embodiment for generating a configuration file on the computer-readable storage medium belong to the same concept, and specific implementation processes thereof are described in detail in the method embodiment, and technical features in the method embodiment are applicable to all the embodiments of the computer-readable storage medium, which is not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.