Embedded operating system dynamic configuration method and device

By setting the mapping table of the function ID and DTS nodes in the embedded operating system and dynamically configuring the DTS node status, the problem of poor maintenance of hardware board software in the embedded operating system is solved, and rapid product launch and cost savings are achieved.

CN111209048BActive Publication Date: 2025-09-02SHANGHAI SUMI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911388433.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-30
Publication Date
2025-09-02
Estimated Expiration
2039-12-30

AI Technical Summary

Technical Problem

In existing embedded operating systems, the software ROM of the hardware board needs to be compiled separately for different product needs, resulting in poor code maintainability and high product risks, and the DTS node status and attributes cannot be dynamically changed at runtime.

Method used

By setting the mapping table between the function ID and the DTS node in the DTS file and reserve configuration information on the board, the real-time operating system reads the configuration information at startup, dynamically configures the status and properties of the DTS node, and matches the driver to enable the corresponding functions.

Benefits of technology

It realizes dynamic configuration of embedded operating systems based on the same ROM, saving ROM maintenance costs and software development cycles, and improving product speed to market and development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111209048B_ABST
    Figure CN111209048B_ABST
Patent Text Reader

Abstract

The present invention provides a method and apparatus for dynamically configuring an embedded operating system. The method comprises: loading a DTS file of a real-time operating system at the device's startup, wherein the DTS file stores a mapping table between function IDs and DTS nodes; reading configuration information stored in a reserved area on a board during startup, parsing the corresponding function ID, determining corresponding DTS node information based on the function ID configuration, and sending the DTS node information to the device's real-time operating system; and parsing the DTS node information and executing a device driver. If the driver matches the DTS node information and the DTS node status is enabled, executing the driver enables the corresponding function. The present invention reduces ROM maintenance costs and shortens software development cycles.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the technical field of embedded operating systems, and in particular to a method and device for dynamically configuring an embedded operating system. Background Art

[0002] As market competition becomes increasingly fierce, embedded product R&D faces two key challenges: how to quickly launch products and seize market share, and how to reduce R&D costs, which are directly related to product success or failure.

[0003] To address these two issues, public releases are often released. This involves using the same hardware board with different software and design elements to create different product forms. While hardware boards can be universal, software is typically compiled into separate ROMs tailored to specific product requirements. The DTS (Device Tree Source) in the kernel (real-time operating system) is often hard-coded, preventing the dynamic modification of DTS node states and properties at runtime.

[0004] One existing solution is to add a board ID to the hardware board. The software ROM adapts to different board IDs to enable a single ROM version to correspond to multiple boards. However, this approach is often used when the board is updated within the same project with minor changes, such as hardware changes from the EDT to the PVT stage. Because the board ID and configuration information must be directly determined in the function code block, if there is too much configuration, the code will be filled with if-else statements, resulting in very poor code maintainability and extremely high product risks.

[0005] It should be noted that the above technical background is merely provided to provide a clear and complete description of the technical solutions of the present invention and to facilitate understanding by those skilled in the art. Simply because these solutions are described in the technical background section of the present invention, it should not be assumed that the above technical solutions are well known to those skilled in the art. Summary of the Invention

[0006] In response to the above problems, the purpose of the embodiments of the present invention is to provide a method and device for dynamic configuration of an embedded operating system, which can dynamically configure the embedded operating system based on the use of the same ROM, greatly saving the maintenance cost of the ROM and shortening the software development cycle.

[0007] To achieve the above-mentioned object, an embodiment of the present invention provides a method for dynamically configuring an embedded operating system, comprising: loading a DTS file of a real-time operating system at the startup of a device, wherein the DTS file stores a mapping table between function IDs and DTS nodes; reading configuration information stored in a reserved area on a board at the startup, parsing the corresponding function ID, determining corresponding DTS node information based on the function ID configuration, and sending the DTS node information to the real-time operating system of the device; the real-time operating system parsing the DTS node information and executing a driver of the device; if the driver matches the DTS node information and the DTS node status is on, executing the driver to enable the corresponding function.

[0008] An embodiment of the present invention also provides an embedded operating system dynamic configuration device, including: a first module, used to load the DTS file of the real-time operating system through startup loading, wherein the DTS file stores a mapping table between function ID and DTS node; a second module, used to read the configuration information stored in the reserved area on the board through startup loading, parse out the corresponding function ID, determine the corresponding DTS node information according to the function ID configuration, and send the DTS node information to the real-time operating system of the device; a third module, used to parse the DTS node information through the real-time operating system and execute the driver of the device, and if the driver matches the DTS node information and the DTS node status is on, execute the driver to enable the corresponding function.

[0009] As can be seen from the foregoing, the embedded operating system dynamic configuration method and apparatus provided by the embodiments of the present invention pre-sets a mapping table between function IDs and DTS nodes in a DTS file and reserves a region on the board to store this configuration information. Therefore, when the board is powered on, the bootloader reads the configuration information and dynamically configures the status and properties of the DTS nodes based on this information. The real-time operating system then matches the DTS nodes with the drivers. If a match is successful, the drivers are executed to enable the corresponding functions. Compared to existing technologies, this eliminates the need to compile separate ROMs for different projects, significantly reducing ROM maintenance costs and software development cycles, thereby improving product time-to-market and development costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0011] Figure 1A schematic flow chart of a method for dynamically configuring an embedded operating system according to an embodiment of the present invention.

[0012] Figure 2 A schematic diagram of the mapping between function IDs and DTS nodes provided in an embodiment of the present invention.

[0013] Figure 3 A detailed flowchart of a dynamic configuration method for an embedded operating system provided by an embodiment of the present invention.

[0014] Figure 4 A schematic diagram of the structure of a dynamic configuration device for an embedded operating system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0015] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. In addition, the singular forms of "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0016] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0017] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings.

[0018] The embodiment of the present invention provides a method for dynamically configuring an embedded operating system, which is applied to a device having an embedded operating system, such as Figure 1 and Figure 2 As shown, the method includes the following steps:

[0019] Step S101 : The device starts up and loads a DTS file of a real-time operating system. The DTS file stores a mapping table between function IDs and DTS nodes.

[0020] In this step, the id_node_map node is pre-added in the DTS file of the real-time operating system (Kernel). This node is used to store the mapping table between function ID and DTS node. Figure 2 As shown, according to the functions that the driver can support, the supported function ID and the corresponding DTS node are formed in the mapping table, that is, each function ID is mapped to which DTS node of the driver. Figure 2 M01 corresponds to the DTS node mipi_lcd_01.

[0021] By default, the DTS node status corresponding to the function ID is disabled, that is, the function will not be enabled. When the device is turned on, the bootloader loads the DTS file of the real-time operating system (Kernel).

[0022] In the embodiment of the present invention, the function ID has a total of M bytes and is used to configure N functions. The format is not limited. The following is only an example of the function ID:

[0023] N1MXXM00 S01T0PXW0E0M0V110FXC1U1XXXX

[0024] The function ID is 32 bytes long and can be configured with 12 functions. If more configuration items are required to implement more functions, the length of the function ID can be increased. Table 1 below explains the meaning of each function in the function ID.

[0025] Table 1

[0026]

[0027] Step S102 , starting loading and reading configuration information stored in a reserved area on the board, parsing the corresponding function ID, configuring corresponding DTS node information according to the function ID, and sending the DTS node information to the real-time operating system.

[0028] In this step, a reserved area is set on the board Flash. During the equipment production stage, the configuration information is burned into the reserved area on the board Flash according to product requirements.

[0029] Specifically, Figure 3As shown, when the board is powered on, in the Bootloader running phase, first read the configuration information stored in the reserved area of ​​the board Flash in S102, and parse out the corresponding function ID; traverse all the function IDs that need to be enabled, and determine whether the traversal is completed; if not, further query the mapping table of function IDs and DTS nodes in S101 to determine whether the function ID exists in the mapping table; if so, find the DTS node corresponding to the function ID in the mapping table, and configure the status and properties of the DTS node according to the configuration information, for example, change the status of the corresponding DTS node in the mapping table to "on"; until the traversal is completed, send the configured DTS node status and property information to the Kernel.

[0030] In step S103, the real-time operating system parses the DTS node information and executes a driver. If the driver matches the DTS node information and the DTS node status is enabled, the driver is executed to enable the corresponding function.

[0031] In this step, the kernel is developed to provide a corresponding driver for each material of the device, and to set the compatible attribute value of the corresponding node in DTS and the of_device_id.compatible attribute value of the driver. For example, if there are two materials on the device: material A TP1 and material B TP2, different drivers are provided for TP1 and TP2 respectively, so that the of_device_id.compatible of the driver is "A-company,tp" and "B-company,tp" respectively. In this way, the drivers of TP1 and TP2 correspond to the TP1 and TP2 nodes in DTS respectively. During the initialization process, the kernel matches the node information in DTS. If there is a mismatch, the corresponding function will not be enabled; if there is a match, for example, if the of_device_id.compatible of driver A is "A-company,tp", it means that it matches the node with compatible "A-company,tp" in DTS:

[0032] struct of_device_id tp_of_match[] = {

[0033] { .compatible = "A-company,tp",},

[0034] };

[0035] If Bytes 12-13 of the function ID are TP1, after kernel parsing, the TP1 node status in the DTS is dynamically set to "on", then the drive matching for material A is successful, the drive for material A is executed, and the corresponding function is enabled.

[0036] Specifically, Figure 3 As shown, during kernel runtime, the kernel parses DTS node information, identifies enabled DTS nodes, and adds the DTS node information, including the compatible attribute value, to the corresponding device bus. The kernel then executes all drivers and adds the driver with the of_device_id.compatible attribute value to the corresponding device bus. If the values ​​match, the driver matches the corresponding DTS node information and enters the driver's probe function. If the corresponding material is successfully detected, the driver executes to enable the corresponding function. If the values ​​do not match, the driver's probe function is not entered, the driver terminates, and the corresponding function is not enabled. The kernel continues executing subsequent programs until the system is shut down.

[0037] Further references Figure 4 The embodiment of the present invention further provides an embedded operating system dynamic configuration device, comprising:

[0038] The first module 401 is used to load the DTS file of the real-time operating system by booting the loader. The DTS file stores a mapping table between function IDs and DTS nodes.

[0039] Specifically, the first module pre-adds an id_node_map node in the DTS file of the real-time operating system. The id_node_map node is used to store a mapping table between function IDs and DTS nodes. By default, the DTS node corresponding to the function ID is closed.

[0040] The second module 402 is used to read the configuration information stored in the reserved area on the board by starting loading, parse the corresponding function ID, determine the corresponding DTS node information according to the function ID configuration, and send the DTS node information to the real-time operating system of the device.

[0041] Specifically, the second module burns the configuration information into the reserved area on the board Flash by setting a reserved area on the board Flash; when the board is powered on, the configuration information stored in the reserved area of ​​the board Flash is read by starting the loader, and the corresponding function ID is parsed; all function IDs that need to be enabled are traversed, and it is determined whether the traversal is completed; if the traversal is not completed, the mapping table between the function ID and the DTS node is further queried to determine whether the function ID exists in the mapping table; if it exists in the mapping table, the DTS node corresponding to the function ID is found in the mapping table, and the DTS node information is configured according to the configuration information, and the DTS node information includes the status and attributes of the DTS; until the traversal is completed, the configured DTS node information is sent to the real-time operating system.

[0042] The third module 403 is used to parse the DTS node information through the real-time operating system and execute the device driver. If the driver matches the DTS node information and the DTS node status is enabled, the driver is executed to enable the corresponding function.

[0043] Specifically, the third module provides a corresponding driver for each material of the device through the real-time operating system, and sets the compatible attribute value of the corresponding node of the material in the DTS and the of_device_id.compatible attribute value of the driver; the DTS node information is parsed through the real-time operating system, the DTS node whose status is turned on is determined, and the DTS node information including the compatible attribute value is added to the corresponding device bus; all drivers are executed through the real-time operating system and the driver including the of_device_id.compatible attribute value is added to the corresponding device bus; it is determined whether there is a DTS node with the same compatible attribute value and the of_device_id.compatible attribute value of the driver on the device bus; if so, the driver matches the corresponding DTS node information and enters the probe function of the driver. When the DTS node status is turned on, the driver is executed to enable the corresponding function.

[0044] The specific technical details of the embedded operating system dynamic configuration device described above are similar to those of the embedded operating system dynamic configuration method. The technical effects achieved in the implementation of the embedded operating system dynamic configuration device can also be achieved in the implementation of the embedded operating system dynamic configuration method. To reduce repetition, they are not further described here. Accordingly, the relevant technical details mentioned in the implementation of the embedded operating system dynamic configuration device can also be applied in the implementation of the embedded operating system dynamic configuration method.

[0045] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the method described in the above embodiments when the program is executed by a processor.

[0046] An embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the above embodiments when executing the program.

[0047] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0048] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0049] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0050] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0051] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for dynamically configuring an embedded operating system, applied to a device having an embedded operating system, characterized in that: include: The device boots up and loads the DTS file of the real-time operating system, wherein the DTS file stores a mapping table between function IDs and DTS nodes; The startup loader reads the configuration information stored in the reserved area on the board, parses the corresponding function ID, determines the corresponding DTS node information according to the function ID configuration, and sends the DTS node information to the real-time operating system of the device; The real-time operating system parses the DTS node information and executes the device driver. If the driver matches the DTS node information and the DTS node status is enabled, the driver is executed to enable the corresponding function.

2. The method for dynamic configuration of an embedded operating system according to claim 1, wherein: The DTS file stores a mapping table between function IDs and DTS nodes, specifically including: Pre-add an id_node_map node in the DTS file of the real-time operating system. The id_node_map node is used to store a mapping table between function IDs and DTS nodes. According to the functions that the driver can support, the supported function ID and the corresponding DTS node are formed in the mapping table; By default, the DTS node status corresponding to the function ID is closed.

3. The method for dynamic configuration of an embedded operating system according to claim 1, wherein: The function ID has a total of M bytes, which are used to configure N function configuration items. Function configuration items are increased by increasing the byte length.

4. The method for dynamic configuration of an embedded operating system according to claim 2, wherein: The bootloader reads the configuration information stored in the reserved area on the board, parses the corresponding function ID, determines the corresponding DTS node information according to the function ID configuration, and sends the DTS node information to the real-time operating system of the device, specifically including: Set a reserved area on the board Flash and burn the configuration information into the reserved area on the board Flash; When the board is powered on, the startup loader reads the configuration information stored in the reserved area of ​​the board's Flash and parses the corresponding function ID; Traverse all function IDs that need to be enabled and find the DTS node corresponding to the function ID in the mapping table; The DTS node information is configured according to the configuration information, wherein the DTS node information includes the state and attributes of the DTS, and the configured DTS node information is sent to the real-time operating system.

5. The method for dynamic configuration of an embedded operating system according to claim 4, wherein: The traversal of all function IDs that need to be enabled and finding the DTS node corresponding to the function ID in the mapping table specifically includes: Traverse all function IDs that need to be enabled and determine whether the traversal is complete; If the traversal is not completed, further query the mapping table between the function ID and the DTS node to determine whether the function ID exists in the mapping table; If it exists in the mapping table, the DTS node corresponding to the function ID is searched in the mapping table until the traversal is completed.

6. The method for dynamic configuration of an embedded operating system according to claim 4, wherein: The real-time operating system parses the DTS node information and executes the device driver, specifically including: The real-time operating system provides a corresponding driver for each material of the device and sets the compatible attribute value of the corresponding node of the material in DTS and the of_device_id.compatible attribute value of the driver; The real-time operating system parses the DTS node information, determines the DTS nodes that are in the enabled state, and adds the DTS node information including the compatible attribute value to the corresponding device bus; The RTOS executes all drivers and adds the driver to the corresponding device bus, including the value of the of_device_id.compatible property.

7. The method for dynamic configuration of an embedded operating system according to claim 6, wherein: If the driver matches the DTS node information and the DTS node status is enabled, executing the driver enables the corresponding function, specifically including: Determine whether there is a DTS node with the same compatible attribute value as the driver's of_device_id.compatible attribute value on the device bus; If it exists, the driver matches the corresponding DTS node information and enters the driver's probe function. When the DTS node status is turned on, the driver is executed to turn on the corresponding function.

8. A dynamic configuration device for an embedded operating system, characterized in that: include: The first module is used to load the DTS file of the real-time operating system through startup loading, wherein the DTS file stores a mapping table between function IDs and DTS nodes; The second module is used to read the configuration information stored in the reserved area on the board by starting loading, parse the corresponding function ID, determine the corresponding DTS node information according to the function ID configuration, and send the DTS node information to the real-time operating system of the device; The third module is used to parse the DTS node information through the real-time operating system and execute the device driver. If the driver matches the DTS node information and the DTS node status is on, the driver is executed to enable the corresponding function.

9. The embedded operating system dynamic configuration device according to claim 8, characterized in that: The first module is specifically used to: pre-add an id_node_map node in the DTS file of the real-time operating system, wherein the id_node_map node is used to store a mapping table between function IDs and DTS nodes; by default, the DTS node corresponding to the function ID is closed.

10. The embedded operating system dynamic configuration device according to claim 9, characterized in that: The second module is specifically configured to: burn configuration information into the reserved area on the board Flash by setting a reserved area on the board Flash; read the configuration information stored in the reserved area on the board Flash by starting the loader when the board is powered on, and parse the corresponding function ID; traverse all function IDs that need to be enabled, and determine whether the traversal is complete; If the traversal is not completed, further query the mapping table between the function ID and the DTS node to determine whether the function ID exists in the mapping table; If it exists in the mapping table, the DTS node corresponding to the function ID is found in the mapping table, and the DTS node information is configured according to the configuration information. The DTS node information includes the status and properties of the DTS; until the traversal is completed, the configured DTS node information is sent to the real-time operating system.

11. The embedded operating system dynamic configuration device according to claim 10, characterized in that: The third module is specifically used to: provide a corresponding driver for each material of the device through the real-time operating system, and set the compatible attribute value of the corresponding node of the material in the DTS and the of_device_id.compatible attribute value of the driver; parse the DTS node information through the real-time operating system, determine the DTS node with an on status, and add the DTS node information including the compatible attribute value to the corresponding device bus; execute all drivers through the real-time operating system and add the driver including the of_device_id.compatible attribute value to the corresponding device bus; determine whether there is a DTS node with the same compatible attribute value and the of_device_id.compatible attribute value of the driver on the device bus; if so, match the driver with the corresponding DTS node information and enter the probe function of the driver. When the DTS node status is on, execute the driver to enable the corresponding function.

Citation Information

Patent Citations

  • Product ID configuration method and program loading method of embedded equipment

    CN106681755A

  • Intelligent diagnosis system and method

    CN109581995A