Interface firmware generation method, database construction method, interface firmware automatic generation method and computer program product
By building an interface firmware shared framework and a unique code segment database, the method of users generating chip interface firmware without manual encoding is realized, solving the problem of cumbersome operations in the existing technology, and improving the efficiency and convenience of generating firmware.
Patent Information
- Application Number
- CN202411992444.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-18
AI Technical Summary
In the prior art, users need to manually encode each function of the chip interface to generate corresponding firmware, which is cumbersome to operate.
By building an interface firmware shared framework database and an interface firmware-specific code segment database, users can select the corresponding firmware shared framework and unique code segments according to the interface type and function, and automatically splice and generate the required firmware.
The interface firmware can be generated without manual encoding by users, which simplifies the operation process and facilitates the generation of required firmware quickly, suitable for users who do not have code development capabilities.
Smart Images

Figure CN119847641A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of interface firmware, and in particular to an interface firmware generation method, a database construction method, an interface firmware automatic generation method and a computer program product. Background Art
[0002] Due to size limitations, a chip usually has a limited number of interfaces. In order to enable the chip to support more types of interface functions, the interfaces of many chips are designed to support multiple functions, and each function needs to be supported by the corresponding firmware. In this case, the user needs to have certain code development capabilities and needs to manually encode and generate corresponding firmware for each function of the interface, which is cumbersome. Summary of the invention
[0003] The technical problem to be solved by the present invention is how to realize the generation of firmware without manual coding by the user.
[0004] The firmware corresponding to each function of an interface has mostly the same code, with only a small part different. The present invention takes into account that the same parts of the firmware under different functions of the same interface can be used as the common framework of the firmware of the interface, and the unique code segments of each firmware can be collected. If a user needs to generate firmware under a certain function for an interface, the common framework of the firmware of the interface and the unique code segments of the corresponding function firmware can be used to splice to form the firmware required by the user, without the need for manual coding by the user.
[0005] In order to solve the above technical problem, the present invention provides an interface firmware generation method, comprising the following steps:
[0006] P1. Construct an interface firmware common framework database, which contains multiple firmware common frameworks corresponding to multiple interface types, each firmware common framework only contains a common code segment and leaves the unique code segment blank;
[0007] P2. Build an interface firmware-specific code segment database, which contains multiple firmware-specific code segments, each firmware-specific code segment corresponds to a function of an interface;
[0008] S1. Selecting a corresponding firmware common framework from an interface firmware common framework database according to the interface type of the firmware generated by the user;
[0009] S2. According to the interface function of the firmware generated by the user, a corresponding firmware-specific code segment is selected from the interface firmware-specific code segment database;
[0010] S3. Insert the selected firmware-specific code segment into the selected firmware common framework to generate the firmware required by the user.
[0011] Furthermore, the method includes step S0 executed before step S1, receiving the interface type and interface function of the firmware to be generated selected by the user.
[0012] Furthermore, in step S0, multiple interface types and multiple interface functions of each interface type are listed to the user for selection.
[0013] Furthermore, the method includes step S4 executed after step S3, outputting the generated firmware to the user.
[0014] The present invention also provides a database construction method for automatically generating interface firmware, comprising the following steps:
[0015] P1. Construct an interface firmware common framework database, wherein the database contains multiple firmware common frameworks corresponding to multiple interfaces, each firmware common framework only contains a common code segment and a unique code segment is left blank;
[0016] P2. Build an interface firmware-specific code segment database, which contains multiple firmware-specific code segments, and each firmware-specific code segment corresponds to a function of an interface.
[0017] The present invention also provides a method for automatically generating an interface firmware, comprising the following steps:
[0018] S1. Selecting a corresponding firmware common framework from an interface firmware common framework database according to the interface type of the firmware generated by the user;
[0019] S2. According to the interface function of the firmware generated by the user, a corresponding firmware-specific code segment is selected from the interface firmware-specific code segment database;
[0020] S3. Insert the selected firmware-specific code segment into the firmware common framework to generate the firmware required by the user.
[0021] Furthermore, the method includes step S0 executed before step S1, receiving the interface type and interface function of the firmware to be generated selected by the user.
[0022] Furthermore, in step S0, multiple interface types and multiple interface functions of each interface type are listed to the user for selection.
[0023] Furthermore, the method includes step S4 executed after step S3, outputting the generated firmware to the user.
[0024] The present invention also provides a computer program product, including a computer program, which is executed by a processor to implement the above-mentioned method for automatically generating interface firmware.
[0025] The interface firmware generation method of the present invention constructs the interface firmware common framework database and the interface firmware unique code segment database in advance through steps P1 and P2. If the user needs to generate a firmware for a certain interface under a certain function, the corresponding firmware common framework and firmware unique code segment are automatically selected from the above two databases according to the interface type and interface function of the firmware required to be generated by the user, and the firmware required to be generated by the user is generated accordingly. The firmware can be generated without manual coding by the user, which is convenient and fast. In this way, even if the user does not have the ability to develop code, he can easily generate the interface firmware he wants. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a flowchart of the interface firmware generation method.
[0027] Figure 2 It is a flowchart of the method for automatically generating interface firmware. DETAILED DESCRIPTION
[0028] The present invention is further described in detail below in conjunction with specific implementation methods.
[0029] This embodiment forms a computer program product through computer code programming, and the computer processor executes the computer program product to implement the following Figure 2 The interface firmware automatic generation method shown in FIG.
[0030] To achieve Figure 2 The interface firmware automatic generation method shown in the figure must first be as follows Figure 1 The steps P1 and P2 shown build the corresponding database, and the construction process is as follows:
[0031] The technicians collect the firmware of each interface type in advance (each interface type corresponds to multiple firmwares with different functions). Taking the GPIO interface as an example, the GPIO interface can be reused into communication interfaces such as I2C, SPI, and USART. The firmware of the GPIO interface under its own function is different from the firmware reused into I2C, SPI, and USART. In this way, the GPIO interface corresponds to firmware under 4 functions. Then the technicians compare and analyze the firmware under each function of each interface type to determine the code segments shared by the firmware under each function of each interface type and the code segments unique to the firmware under each function. For example, for the interface type of GPIO interface, the firmware of the GPIO interface under 4 functions is compared and analyzed to determine the code segments shared by the firmware of the GPIO interface under these 4 functions and the code segments unique to the firmware under these 4 functions.
[0032] P1. Construct an interface firmware common framework database, which contains multiple firmware common frameworks corresponding to multiple interface types. Each firmware common framework only contains a common code segment and a unique code segment is left blank.
[0033] The technician constructs a firmware common framework for each interface type based on the code segments shared by the firmware under each function of each interface type. The firmware common framework only contains the common code segments and the unique code segments are left blank. The technician uses each firmware common framework corresponding to each interface type to construct an interface firmware common framework database in the computer.
[0034] P2. Build an interface firmware-specific code segment database, which contains multiple firmware-specific code segments, and each firmware-specific code segment corresponds to a function of an interface.
[0035] The technician uses the code segment specific to each firmware as the firmware specific code segment of the firmware, and then uses the firmware specific code segments of each firmware to construct an interface firmware specific code segment database in the computer.
[0036] After the technicians have built the interface firmware common framework database and the interface firmware unique code segment database in the computer, the computer can automatically generate the interface firmware based on the database. The process is as follows:
[0037] Step S0: receiving the interface type and interface function of the firmware to be generated selected by the user.
[0038] If the user needs to generate firmware for an interface under a certain function, he / she can enter the interface firmware automatic generation interface on the computer. In this interface, the computer lists multiple interface types and multiple interface functions of each interface type for the user to choose. The user selects the interface type and interface function of the firmware he / she requires to generate from the interface type list and interface function list listed in the interface. For example, if the user needs to generate firmware under the SPI function for the GPIO interface, he / she can select the GPIO interface from the interface types listed by the computer, and then select the SPI communication function from the four functions under the GPIO interface type (GPIO general repair function, I2C communication function, SPI communication function, USART communication function). The computer receives the interface type (GPIO interface) and interface function (SPI communication function) of the firmware to be generated selected by the user.
[0039] S1. According to the interface type of the firmware generated by the user, a corresponding firmware common framework is selected from the interface firmware common framework database.
[0040] After receiving the interface type and interface function of the firmware to be generated selected by the user, the computer selects the corresponding firmware common framework from the interface firmware common framework database according to the interface type of the firmware to be generated by the user. For example, according to the interface type of the firmware to be generated by the user, i.e., the GPIO interface, the computer selects the firmware common framework corresponding to the GPIO interface from the interface firmware common framework database.
[0041] S2. According to the interface function of the firmware generated according to the user's requirements, a corresponding firmware-specific code segment is selected from the interface firmware-specific code segment database.
[0042] The computer also selects a corresponding firmware-specific code segment from the interface firmware-specific code segment database according to the interface function of the firmware generated according to the user's requirements. For example, the computer selects a firmware-specific code segment of the SPI communication function under the GPIO interface from the interface firmware-specific code segment database according to the interface function of the firmware generated according to the user's requirements, namely, the SPI communication function.
[0043] S3. Insert the selected firmware-specific code segment into the selected firmware common framework to generate the firmware required by the user.
[0044] After the computer selects the corresponding firmware common framework and firmware-specific code segment, it inserts the selected firmware-specific code segment into the selected firmware common framework to generate the firmware required by the user. For example, the computer selects the firmware common framework corresponding to the GPIO interface and the firmware-specific code segment of the SPI communication function under the GPIO interface, and then inserts the firmware-specific code segment of the SPI communication function into the firmware common framework corresponding to the GPIO interface to generate the firmware required by the user.
[0045] S4. Output the generated firmware to the user.
[0046] After the computer generates the firmware requested by the user, it outputs it to the user.
[0047] The interface firmware generation method of the present invention constructs the interface firmware common framework database and the interface firmware unique code segment database in advance through steps P1 and P2. If the user needs to generate a firmware for a certain interface under a certain function, the corresponding firmware common framework and firmware unique code segment are automatically selected from the above two databases according to the interface type and interface function of the firmware required to be generated by the user, and the firmware required to be generated by the user is generated accordingly. It is convenient and fast, and the firmware can be generated without manual coding by the user. In this way, even if the user does not have the ability to develop code, he can easily generate the interface firmware he wants.
[0048] The above is only an implementation method of the invention, and does not limit the scope of patent protection. Those skilled in the art can make non-substantial changes or substitutions based on the invention, which still fall within the scope of patent protection.
Claims
1. A method for generating interface firmware, characterized in that: The following steps are involved: P1. Construct an interface firmware common framework database, which contains multiple firmware common frameworks corresponding to multiple interface types, each firmware common framework only contains a common code segment and leaves the unique code segment blank; P2. Build an interface firmware-specific code segment database, which contains multiple firmware-specific code segments, each firmware-specific code segment corresponds to a function of an interface; S1. Selecting a corresponding firmware common framework from an interface firmware common framework database according to the interface type of the firmware generated by the user; S2. According to the interface function of the firmware generated by the user, a corresponding firmware-specific code segment is selected from the interface firmware-specific code segment database; S3. Insert the selected firmware-specific code segment into the selected firmware common framework to generate the firmware required by the user.
2. The interface firmware generation method according to claim 1, characterized in that: The method comprises step S0 executed before step S1, receiving the interface type and interface function of the firmware to be generated selected by the user.
3. The interface firmware generation method according to claim 2, characterized in that: In step S0, multiple interface types and multiple interface functions of each interface type are listed to the user for selection.
4. The interface firmware generation method according to claim 1, characterized in that: The method comprises step S4 executed after step S3, outputting the generated firmware to the user.
5. A database construction method for automatically generating interface firmware, characterized in that: The following steps are involved: P1. Construct an interface firmware common framework database, which contains multiple firmware common frameworks corresponding to multiple interfaces, each firmware common framework only contains a common code segment and leaves the unique code segment blank; P2. Build an interface firmware-specific code segment database, which contains multiple firmware-specific code segments, and each firmware-specific code segment corresponds to a function of an interface.
6. A method for automatically generating interface firmware, characterized in that: The following steps are involved: S1. Selecting a corresponding firmware common framework from an interface firmware common framework database according to the interface type of the firmware generated by the user; S2. According to the interface function of the firmware generated by the user, a corresponding firmware-specific code segment is selected from the interface firmware-specific code segment database; S3. Insert the selected firmware-specific code segment into the firmware common framework to generate the firmware required by the user.
7. The method for automatically generating interface firmware according to claim 6, characterized in that: The method comprises step S0 executed before step S1, receiving the interface type and interface function of the firmware to be generated selected by the user.
8. The method for automatically generating interface firmware according to claim 7, characterized in that: In step S0, multiple interface types and multiple interface functions of each interface type are listed to the user for selection.
9. The method for automatically generating interface firmware according to claim 6, characterized in that: The method comprises step S4 executed after step S3, outputting the generated firmware to the user.
10. A computer program product comprising a computer program, characterized in that The computer program is executed by a processor to implement the method for automatically generating interface firmware as described in any one of claims 6 to 9.