Compatibility adaptation system, program running method and device and power terminal equipment
By introducing a compatibility adaptation system into the power terminal equipment, determining the bit width type of the application and calling the corresponding system library, the problem of application incompatibility under different bit width type systems is solved, and the compatibility and development efficiency of the application are improved.
Patent Information
- Application Number
- CN202411761297.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-28
AI Technical Summary
In the prior art, applications under systems based on different bit width types have problems with incompatibility, which leads to redevelopment when running 32-bit applications on a 64-bit system, resulting in the problem of repeated development.
A compatibility adaptation system is proposed. By judging the bit width type of the application, determining the corresponding system library path, and calling the corresponding system library to run the application, thereby achieving compatibility of applications with different bit width types.
It realizes the solution to software compatibility problems at the system level, without the need to develop applications with the same functions for system architectures of different bit width types, avoiding the problem of repeated development.
Smart Images

Figure CN119718718A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of power terminal technology, and in particular to a compatibility adaptation system, a program running method and device, and a power terminal device. Background Art
[0002] In related technologies, power terminal equipment is used to realize functions such as data collection, monitoring and control, and thus plays a vital role in the power system. As the functional requirements for power terminal equipment increase, the processor performance and system requirements of power terminal equipment are also gradually improved, and the mainstream processors of power terminal equipment are upgraded from 32-bit architecture to 64-bit architecture. The processors with 32-bit architecture correspond to 32-bit systems, and the processors with 64-bit architecture correspond to 64-bit systems. The two systems are not compatible at the bottom layer, so some applications developed based on 32-bit systems will have incompatibility issues in 64-bit system environments. Summary of the invention
[0003] The present application aims to at least solve the problem of incompatibility of application programs in systems of different bit width types in the prior art or related art.
[0004] To this end, the first aspect of the present application proposes a compatibility adaptation system for power terminal equipment.
[0005] A second aspect of the present application provides a program running method for a power terminal device.
[0006] A third aspect of the present application provides a program running device for a power terminal device.
[0007] A fourth aspect of the present application provides a readable storage medium.
[0008] A fifth aspect of the present application provides a power terminal device.
[0009] In view of this, the first aspect of the present application provides a compatibility adaptation system for power terminal equipment, including: a system library; a compatibility processing module, used to obtain the bit width type of an application when an instruction to run the application is received; and determine the system library path corresponding to the system library based on the bit width type and environment variables; a program running module, used to call the system library to run the application based on the system library path.
[0010] In the technical solution, the bit width type specifically refers to the data width type that a computer processor can process or transmit at one time. Exemplarily, the bit width type includes 64 bits and 32 bits. Exemplarily, the bit width type also includes 8 bits and 16 bits. Exemplarily, the bit width type can also be 128 bits, 258 bits, etc.
[0011] The underlying systems of different bit widths are not compatible. For example, the processor architecture of ARMv7 is 32-bit, while the processor architecture of ARMv8 is 64-bit. The instruction sets of the two architectures are not compatible. ARMv8 corresponds to 64-bit systems, and can only run 64-bit applications. Some applications are developed based on 32-bit systems. In order to enable these applications to run on 64-bit systems, 64-bit architecture applications need to be redeveloped. This means that a program includes both 64-bit and 32-bit versions, and the functions of the two versions are exactly the same. This leads to duplicate development and affects efficiency.
[0012] In response to the above problems, this application proposes a compatibility adaptation system that is compatible with applications of different bit width types. In this system, an environment that can support the operation of applications of different bit width types is also provided. Taking the common 32-bit and 64-bit as an example, before running an application, first determine whether the bit width type of the application is 32-bit or 64-bit, and determine the corresponding operation path based on the judgment result. The operation path indicates different operation components, such as system libraries, environment variables, hal layers, drivers, etc.
[0013] By running applications of different bit widths through corresponding running paths, whether they are 32-bit applications, 64-bit applications, or 16-bit, 8-bit or 128-bit applications, software compatibility is solved at the system level. There is no need to develop applications with the same functions for system architectures of different bit widths, thus avoiding the problem of duplicate development.
[0014] For example, the compatibility adaptation system of the power terminal equipment includes a system library, which provides basic functions and services for the operation of the application. Taking the Linux (an open source Unix-like operating system) kernel operating system as an example, the system libraries of the Linux system include libc.so, libstdc++.so, and ld-linux.so.2, which are the basic dependencies for the operation of the application.
[0015] Due to differences in architecture and compiler, the system library itself can only support the corresponding application program. For example, a 32-bit system library can only support 32-bit applications, and a 64-bit system library supports 64-bit applications. In this regard, the present application sets different system libraries in the compatibility adaptation system, such as 8-bit system libraries, 16-bit system libraries, 32-bit system libraries, and 64-bit system libraries, which are stored in different system library paths.
[0016] Before running an application, the system library path of the corresponding bit width type is determined according to the bit width type of the application, so as to call the system library of the corresponding bit width type to run the current application, thereby achieving compatibility with applications of different bit width types.
[0017] The present application achieves compatibility with applications of different bit width types at the system level of the power terminal equipment, thereby avoiding the problem of repeatedly developing applications with the same functions for systems of different bit width types.
[0018] In addition, the compatibility adaptation system in the above technical solution provided by this application may also have the following additional technical features:
[0019] In some technical solutions of the present application, optionally, the system library includes a first system library and a second system library, the bit width type of the first system library is the first bit width type, and the bit width type of the second system library is the second bit width type; the compatibility processing module is also used to determine the first system library path according to the environment variable when the bit width type is the first bit width type, and the first system library path indicates the first system library; or, when the bit width type is the second bit width type, determine the second system library path according to the environment variable, and the second system library path indicates the second system library.
[0020] In this technical solution, exemplarily, the system library includes a first system library and a second system library, the first system library and the second system library have different bit width types, exemplarily, the first system library is a system library of the first bit width type, and the second system library is a system library of the second bit width type.
[0021] Environment variables are a mechanism used in operating systems to store and transmit configuration information. They are used by applications to link to corresponding system libraries. Taking the Linux kernel operating system as an example, the environment variable of the Linux system is defined as LD_LIBRARY_PATH.
[0022] For example, due to differences in architecture and compiler, the system library itself can only support the corresponding application program. For example, a 32-bit system library can only support 32-bit applications, and a 64-bit system library supports 64-bit applications. Therefore, in the design of a 64-bit system, it is necessary to include both 32-bit system libraries and 64-bit system libraries, store them in the same path, and clearly indicate whether the current path is a 64-bit system library or a 32-bit system library. The following example uses the first bit width type of 64 bits and the second bit width type of 32 bits. The compatibility adaptation system includes a 64-bit system library and a 32-bit system library, that is, the first system library and the second system library mentioned above.
[0023] Before running an application, the compatibility processing module determines whether the bit width type of the application is 32-bit or 64-bit. When it is determined that the application is a 32-bit application, the environment variable LD_LIBRARY_PATH contains the path where the 32-bit system library is located. The system library path of the 32-bit system library is determined through the environment variable, so that the application can be linked to the 32-bit system library, that is, the second system library. Similarly, when it is determined that the application is a 64-bit application, the environment variable LD_LIBRARY_PATH contains the path where the 64-bit system library is located. The system library path of the 64-bit system library is determined through the environment variable, so that the application can be linked to the 64-bit system library, that is, the first system library.
[0024] The system library paths of system libraries of different bit width types are included based on environment variables, so that applications of different bit width types can always locate the system libraries of the corresponding bit width types, thereby solving the compatibility problem.
[0025] In some technical solutions of the present application, optionally, the power terminal equipment includes a first hardware abstraction layer and a second hardware abstraction layer, the bit width type of the first hardware abstraction layer is a first bit width type, and the bit width type of the second hardware abstraction layer is a second bit width type; the compatibility processing module is also used to determine a first operating path according to environment variables when the bit width type is the first bit width type, and the first operating path indicates the first hardware abstraction layer; or, when the bit width type is the second bit width type, determine a second operating path according to environment variables, and the second operating path indicates the second hardware abstraction layer.
[0026] In this technical solution, the hardware abstraction layer, also known as the HAL layer, exists in the power terminal equipment in the form of a dynamic library. Unlike the system library, the HAL layer mainly abstracts the functions of the application based on the hardware interface.
[0027] In the present application, taking the example of a power terminal device that is compatible with both 32-bit applications and 64-bit applications, in order to ensure that both 32-bit applications and 64-bit applications can run normally, the compatibility adaptation system is equipped with a 32-bit HAL layer and a 64-bit HAL layer. Exemplarily, the bit width type of the first hardware abstraction layer is 64 bits, and the bit width of the second hardware abstraction layer is 32 bits. The first hardware abstraction layer and the second hardware abstraction layer are stored in different running paths.
[0028] Before running an application, the compatibility processing module determines whether the bit width type of the application is 32 bits or 64 bits. When it is determined that the application is a 32-bit application, the corresponding hardware abstraction layer is determined to be the second hardware abstraction. Similarly, when it is determined that the application is a 64-bit application, the corresponding hardware abstraction layer is determined to be the first hardware abstraction.
[0029] Among them, the compatibility adaptation system also includes drivers. Drivers are the bridge between the operating system and the hardware devices, enabling the operating system to communicate and control the hardware devices, thereby realizing the normal operation of the hardware devices. In order to achieve the same driver can meet the use of 32-bit applications and 64-bit applications at the same time, the kernel needs to configure the COFIG_COMPAT function to enable compatibility support for 32-bit applications in the 64-bit kernel. In addition, the differences between 64-bit and 32-bit data structures are processed differently in the driver to ensure that there will be no abnormal errors caused by data structure confusion when 32-bit applications and 64-bit applications call the driver interface.
[0030] Based on the environment variables, the running paths of hardware abstraction layers of different bit width types are included, so that applications of different bit width types can always locate the hardware abstraction layers of the corresponding bit width types, thereby solving the compatibility problem.
[0031] In some technical solutions of the present application, optionally, the compatibility adaptation system further includes: a data processing module, which is used to encapsulate and process the data structure of the running data of the application.
[0032] In this technical solution, the data structure of the running data of a 64-bit application is different from that of the running data of a 32-bit application. For example, the length of the long data structure is 4 bytes in a 32-bit system and 8 bytes in a 64-bit system. In the process of designing the business logic of an application, especially in the protocol, the data length is frequently used. By encapsulating the original data structure and managing it through macros, the data structure is guaranteed to remain unified in software design.
[0033] A second aspect of the present application provides a program running method for an electric terminal device, the electric terminal device including a system library, the program running method including: upon receiving an instruction to run an application, obtaining the bit width type of the application; determining a system library path corresponding to the system library based on the bit width type and environment variables; and based on the system library path, calling the system library to run the application.
[0034] In the technical solution, the bit width type specifically refers to the data width type that a computer processor can process or transmit at one time. Exemplarily, the bit width type includes 64 bits and 32 bits. Exemplarily, the bit width type also includes 8 bits and 16 bits. Exemplarily, the bit width type can also be 128 bits, 258 bits, etc.
[0035] The underlying systems of different bit widths are not compatible. For example, the processor architecture of ARMv7 is 32-bit, while the processor architecture of ARMv8 is 64-bit. The instruction sets of the two architectures are not compatible. ARMv8 corresponds to 64-bit systems, and can only run 64-bit applications. Some applications are developed based on 32-bit systems. In order to enable these applications to run on 64-bit systems, 64-bit architecture applications need to be redeveloped. This means that a program includes both 64-bit and 32-bit versions, and the functions of the two versions are exactly the same. This leads to duplicate development and affects efficiency.
[0036] In response to the above problems, this application proposes a compatibility adaptation system that is compatible with applications of different bit width types. In this system, an environment that can support the operation of applications of different bit width types is also provided. Taking the common 32-bit and 64-bit as an example, before running an application, first determine whether the bit width type of the application is 32-bit or 64-bit, and determine the corresponding operation path based on the judgment result. The operation path indicates different operation components, such as system libraries, environment variables, hal layers, drivers, etc.
[0037] By running applications of different bit widths through corresponding running paths, whether they are 32-bit applications, 64-bit applications, or 16-bit, 8-bit or 128-bit applications, software compatibility is solved at the system level. There is no need to develop applications with the same functions for system architectures of different bit widths, thus avoiding the problem of duplicate development.
[0038] For example, the compatibility adaptation system of the power terminal equipment includes a system library, which provides basic functions and services for the operation of the application. Taking the Linux (an open source Unix-like operating system) kernel operating system as an example, the system libraries of the Linux system include libc.so, libstdc++.so, and ld-linux.so.2, which are the basic dependencies for the operation of the application.
[0039] Due to differences in architecture and compiler, the system library itself can only support the corresponding application program. For example, a 32-bit system library can only support 32-bit applications, and a 64-bit system library supports 64-bit applications. In this regard, the present application sets different system libraries in the compatibility adaptation system, such as 8-bit system libraries, 16-bit system libraries, 32-bit system libraries, and 64-bit system libraries, which are stored in different system library paths.
[0040] Before running an application, the system library path of the corresponding bit width type is determined according to the bit width type of the application, so as to call the system library of the corresponding bit width type to run the current application, thereby achieving compatibility with applications of different bit width types.
[0041] The present application achieves compatibility with applications of different bit width types at the system level of the power terminal equipment, thereby avoiding the problem of repeatedly developing applications with the same functions for systems of different bit width types.
[0042] In some technical solutions of the present application, optionally, the system library includes a first system library and a second system library, the bit width type of the first system library is a first bit width type, and the bit width type of the second system library is a second bit width type; according to the bit width type, determining the running path corresponding to the system library includes: when the bit width type is the first bit width type, determining the first system library path according to the environment variable, and the first system library path indicates the first system library; or, when the bit width type is the second bit width type, determining the second system library path according to the environment variable, and the second system library path indicates the second system library.
[0043] In this technical solution, exemplarily, the system library includes a first system library and a second system library, the first system library and the second system library have different bit width types, exemplarily, the first system library is a system library of the first bit width type, and the second system library is a system library of the second bit width type.
[0044] Environment variables are a mechanism used in operating systems to store and transmit configuration information. They are used by applications to link to corresponding system libraries. Taking the Linux kernel operating system as an example, the environment variable of the Linux system is defined as LD_LIBRARY_PATH.
[0045] For example, due to differences in architecture and compiler, the system library itself can only support the corresponding application program. For example, a 32-bit system library can only support 32-bit applications, and a 64-bit system library supports 64-bit applications. Therefore, in the design of a 64-bit system, it is necessary to include both 32-bit system libraries and 64-bit system libraries, store them in the same path, and clearly indicate whether the current path is a 64-bit system library or a 32-bit system library. The following example uses the first bit width type of 64 bits and the second bit width type of 32 bits. The compatibility adaptation system includes a 64-bit system library and a 32-bit system library, that is, the first system library and the second system library mentioned above.
[0046] Before running an application, the compatibility processing module determines whether the bit width type of the application is 32-bit or 64-bit. When it is determined that the application is a 32-bit application, the environment variable LD_LIBRARY_PATH contains the path where the 32-bit system library is located. The system library path of the 32-bit system library is determined through the environment variable, so that the application can be linked to the 32-bit system library, that is, the second system library. Similarly, when it is determined that the application is a 64-bit application, the environment variable LD_LIBRARY_PATH contains the path where the 64-bit system library is located. The system library path of the 64-bit system library is determined through the environment variable, so that the application can be linked to the 64-bit system library, that is, the first system library.
[0047] The system library paths of system libraries of different bit width types are included based on environment variables, so that applications of different bit width types can always locate the system libraries of the corresponding bit width types, thereby solving the compatibility problem.
[0048] In some technical solutions of the present application, optionally, the power terminal device includes a first hardware abstraction layer and a second hardware abstraction layer, the bit width type of the first hardware abstraction layer is a first bit width type, and the bit width type of the second hardware abstraction layer is a second bit width type; according to the bit width type, determining the running path corresponding to the application, including: when the bit width type is the first bit width type, determining the first running path according to the environment variable, the first running path indicates the first hardware abstraction layer; or, when the bit width type is the second bit width type, determining the second running path according to the environment variable, the second running path indicates the second hardware abstraction layer.
[0049] In this technical solution, the hardware abstraction layer, also known as the HAL layer, exists in the power terminal equipment in the form of a dynamic library. Unlike the system library, the HAL layer mainly abstracts the functions of the application based on the hardware interface.
[0050] In the present application, taking the example of a power terminal device that is compatible with both 32-bit applications and 64-bit applications, in order to ensure that both 32-bit applications and 64-bit applications can run normally, the compatibility adaptation system is equipped with a 32-bit HAL layer and a 64-bit HAL layer. Exemplarily, the bit width type of the first hardware abstraction layer is 64 bits, and the bit width of the second hardware abstraction layer is 32 bits. The first hardware abstraction layer and the second hardware abstraction layer are stored in different running paths.
[0051] Before running an application, the compatibility processing module determines whether the bit width type of the application is 32 bits or 64 bits. When it is determined that the application is a 32-bit application, the corresponding hardware abstraction layer is determined to be the second hardware abstraction. Similarly, when it is determined that the application is a 64-bit application, the corresponding hardware abstraction layer is determined to be the first hardware abstraction.
[0052] Among them, the compatibility adaptation system also includes drivers. Drivers are the bridge between the operating system and the hardware devices, enabling the operating system to communicate and control the hardware devices, thereby realizing the normal operation of the hardware devices. In order to achieve the same driver can meet the use of 32-bit applications and 64-bit applications at the same time, the kernel needs to configure the COFIG_COMPAT function to enable compatibility support for 32-bit applications in the 64-bit kernel. In addition, the differences between 64-bit and 32-bit data structures are processed differently in the driver to ensure that there will be no abnormal errors caused by data structure confusion when 32-bit applications and 64-bit applications call the driver interface.
[0053] Based on the environment variables, the running paths of hardware abstraction layers of different bit width types are included, so that applications of different bit width types can always locate the hardware abstraction layers of the corresponding bit width types, thereby solving the compatibility problem.
[0054] In some technical solutions of the present application, optionally, after calling the corresponding operating environment to run the application based on the operating path, the method further includes: encapsulating the data structure of the operating data of the application.
[0055] In this technical solution, the data structure of the running data of a 64-bit application is different from that of the running data of a 32-bit application. For example, the length of the long data structure is 4 bytes in a 32-bit system and 8 bytes in a 64-bit system. In the process of designing the business logic of an application, especially in the protocol, the data length is frequently used. By encapsulating the original data structure and managing it through macros, the data structure is guaranteed to remain unified in software design.
[0056] The third aspect of the present application proposes a program running device for an electric power terminal device, comprising: a memory for storing programs or instructions; a processor for implementing the steps of the program running method for an electric power terminal device provided in any of the above-mentioned technical solutions when executing the programs or instructions, and therefore also includes all the beneficial effects, which will not be repeated here to avoid repetition.
[0057] The fourth aspect of the present application proposes a readable storage medium on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the program running method of the power terminal equipment provided in any of the above technical solutions are implemented, and therefore all the beneficial effects are also included. To avoid repetition, they will not be repeated here.
[0058] The fifth aspect of the present application proposes an electric power terminal device, comprising: a compatibility adaptation system for the electric power terminal device as provided in any of the above technical solutions; and / or a program running device for the electric power terminal device as provided in any of the above technical solutions; and / or a readable storage medium as provided in any of the above technical solutions, and therefore also includes all the beneficial effects, which will not be repeated here to avoid repetition. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0060] Figure 1 A structural block diagram showing a compatibility adaptation system for power terminal equipment in some embodiments of the present application is shown;
[0061] Figure 2 A logical schematic diagram showing a compatibility adaptation system for a power terminal device in some embodiments of the present application;
[0062] Figure 3 A flowchart showing a program running method of a power terminal device in some embodiments of the present application;
[0063] Figure 4 A structural block diagram of a program running device of an electric power terminal device in some embodiments of the present application is shown. DETAILED DESCRIPTION
[0064] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0065] In the following description, many specific details are set forth to facilitate a full understanding of the present application. However, the present application may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present application is not limited to the specific embodiments disclosed below.
[0066] Refer to the following Figures 1 to 4 Describe the compatibility adaptation system, program running method and device, and power terminal equipment provided according to some embodiments of the present application.
[0067] In some embodiments of the present application, a compatibility adaptation system for a power terminal device is provided. Figure 1 The structure block diagram of the compatibility adaptation system of the power terminal equipment in some embodiments of the present application is shown as follows: Figure 1As shown, the compatibility adaptation system 100 of the power terminal equipment includes: a system library 102; a compatibility processing module 104, which is used to obtain the bit width type of the application when receiving an instruction to run the application; and determine the system library path corresponding to the system library according to the bit width type and environment variables; a program running module 106, which is used to call the system library to run the application based on the system library path.
[0068] In this embodiment, the bit width type is specifically the data width type that the computer processor can process or transmit at one time. Exemplarily, the bit width type includes 64 bits and 32 bits. Exemplarily, the bit width type also includes 8 bits and 16 bits. Exemplarily, the bit width type can also be 128 bits, 258 bits, etc.
[0069] The underlying systems of different bit widths are not compatible. For example, the processor architecture of ARMv7 is 32-bit, while the processor architecture of ARMv8 is 64-bit. The instruction sets of the two architectures are not compatible. ARMv8 corresponds to 64-bit systems, and can only run 64-bit applications. Some applications are developed based on 32-bit systems. In order to enable these applications to run on 64-bit systems, 64-bit architecture applications need to be redeveloped. This means that a program includes both 64-bit and 32-bit versions, and the functions of the two versions are exactly the same. This leads to duplicate development and affects efficiency.
[0070] In response to the above problems, this application proposes a compatibility adaptation system that is compatible with applications of different bit width types. In this system, an environment that can support the operation of applications of different bit width types is also provided. Taking the common 32-bit and 64-bit as an example, before running an application, first determine whether the bit width type of the application is 32-bit or 64-bit, and determine the corresponding operation path based on the judgment result. The operation path indicates different operation components, such as system libraries, environment variables, hal layers, drivers, etc.
[0071] By running applications of different bit widths through corresponding running paths, whether they are 32-bit applications, 64-bit applications, or 16-bit, 8-bit or 128-bit applications, software compatibility is solved at the system level. There is no need to develop applications with the same functions for system architectures of different bit widths, thus avoiding the problem of duplicate development.
[0072] For example, the compatibility adaptation system of the power terminal equipment includes a system library, which provides basic functions and services for the operation of the application. Taking the Linux (an open source Unix-like operating system) kernel operating system as an example, the system libraries of the Linux system include libc.so, libstdc++.so, and ld-linux.so.2, which are the basic dependencies for the operation of the application.
[0073] Due to differences in architecture and compiler, the system library itself can only support the corresponding application program. For example, a 32-bit system library can only support 32-bit applications, and a 64-bit system library supports 64-bit applications. In this regard, the present application sets different system libraries in the compatibility adaptation system, such as 8-bit system libraries, 16-bit system libraries, 32-bit system libraries, and 64-bit system libraries, which are stored in different system library paths.
[0074] Before running an application, the system library path of the corresponding bit width type is determined according to the bit width type of the application, so as to call the system library of the corresponding bit width type to run the current application, thereby achieving compatibility with applications of different bit width types.
[0075] The present application achieves compatibility with applications of different bit width types at the system level of the power terminal equipment, thereby avoiding the problem of repeatedly developing applications with the same functions for systems of different bit width types.
[0076] In some embodiments of the present application, optionally, the compatibility adaptation system also includes a system library; the compatibility processing module is also used to determine the system library path corresponding to the system library according to the bit width type and environment variables; the program running module is also used to call the system library to run the application based on the system library path.
[0077] In this embodiment, the compatibility adaptation system of the power terminal equipment includes a system library, which is used to provide basic functions and services for the operation of the application. Taking the Linux (an open source Unix-like operating system) kernel operating system as an example, the system libraries of the Linux system include libc.so, libstdc++.so, and ld-linux.so.2, which are the basic dependencies for the operation of the application.
[0078] Due to differences in architecture and compiler, the system library itself can only support the corresponding application program. For example, a 32-bit system library can only support 32-bit applications, and a 64-bit system library supports 64-bit applications. In this regard, the present application sets different system libraries in the compatibility adaptation system, such as 8-bit system libraries, 16-bit system libraries, 32-bit system libraries, and 64-bit system libraries, which are stored in different system library paths.
[0079] Before running an application, the system library path of the corresponding bit width type is determined according to the bit width type of the application, so as to call the system library of the corresponding bit width type to run the current application, thereby achieving compatibility with applications of different bit width types.
[0080] In some embodiments of the present application, optionally, the system library includes a first system library and a second system library, the bit width type of the first system library is the first bit width type, and the bit width type of the second system library is the second bit width type; the compatibility processing module is further used to determine the first system library path according to the environment variable when the bit width type is the first bit width type, and the first system library path indicates the first system library; or, when the bit width type is the second bit width type, determine the second system library path according to the environment variable, and the second system library path indicates the second system library.
[0081] In this embodiment, exemplarily, the system library includes a first system library and a second system library, the first system library and the second system library have different bit width types, exemplarily, the first system library is a system library of the first bit width type, and the second system library is a system library of the second bit width type.
[0082] Environment variables are a mechanism used in operating systems to store and transmit configuration information. They are used by applications to link to corresponding system libraries. Taking the Linux kernel operating system as an example, the environment variable of the Linux system is defined as LD_LIBRARY_PATH.
[0083] For example, due to differences in architecture and compiler, the system library itself can only support the corresponding application program. For example, a 32-bit system library can only support 32-bit applications, and a 64-bit system library supports 64-bit applications. Therefore, in the design of a 64-bit system, it is necessary to include both 32-bit system libraries and 64-bit system libraries, store them in the same path, and clearly indicate whether the current path is a 64-bit system library or a 32-bit system library. The following example uses the first bit width type of 64 bits and the second bit width type of 32 bits. The compatibility adaptation system includes a 64-bit system library and a 32-bit system library, that is, the first system library and the second system library mentioned above.
[0084] Before running an application, the compatibility processing module determines whether the bit width type of the application is 32-bit or 64-bit. When it is determined that the application is a 32-bit application, the environment variable LD_LIBRARY_PATH contains the path where the 32-bit system library is located. The system library path of the 32-bit system library is determined through the environment variable, so that the application can be linked to the 32-bit system library, that is, the second system library. Similarly, when it is determined that the application is a 64-bit application, the environment variable LD_LIBRARY_PATH contains the path where the 64-bit system library is located. The system library path of the 64-bit system library is determined through the environment variable, so that the application can be linked to the 64-bit system library, that is, the first system library.
[0085] The system library paths of system libraries of different bit width types are included based on environment variables, so that applications of different bit width types can always locate the system libraries of the corresponding bit width types, thereby solving the compatibility problem.
[0086] In some embodiments of the present application, optionally, the power terminal device includes a first hardware abstraction layer and a second hardware abstraction layer, the bit width type of the first hardware abstraction layer is a first bit width type, and the bit width type of the second hardware abstraction layer is a second bit width type; the compatibility processing module is also used to determine a first operating path according to environment variables when the bit width type is the first bit width type, and the first operating path indicates the first hardware abstraction layer; or, when the bit width type is the second bit width type, determine a second operating path according to environment variables, and the second operating path indicates the second hardware abstraction layer.
[0087] In this embodiment, the hardware abstraction layer, also known as the HAL layer, exists in the power terminal device in the form of a dynamic library. Unlike the system library, the HAL layer mainly abstracts the functions of the application based on the hardware interface.
[0088] In the present application, taking the example of a power terminal device that is compatible with both 32-bit applications and 64-bit applications, in order to ensure that both 32-bit applications and 64-bit applications can run normally, the compatibility adaptation system is equipped with a 32-bit HAL layer and a 64-bit HAL layer. Exemplarily, the bit width type of the first hardware abstraction layer is 64 bits, and the bit width of the second hardware abstraction layer is 32 bits. The first hardware abstraction layer and the second hardware abstraction layer are stored in different running paths.
[0089] Before running an application, the compatibility processing module determines whether the bit width type of the application is 32 bits or 64 bits. When it is determined that the application is a 32-bit application, the corresponding hardware abstraction layer is determined to be the second hardware abstraction. Similarly, when it is determined that the application is a 64-bit application, the corresponding hardware abstraction layer is determined to be the first hardware abstraction.
[0090] Among them, illustratively, Figure 2 A logical schematic diagram of a compatibility adaptation system for a power terminal device in some embodiments of the present application is shown. Figure 2 As shown, the compatibility adaptation system also includes drivers, which are bridges between the operating system and the hardware devices, enabling the operating system to communicate and control the hardware devices, thereby achieving the normal operation of the hardware devices. In order to achieve that the same driver can meet the use of 32-bit applications and 64-bit applications at the same time, the kernel needs to configure the COFIG_COMPAT function to enable compatibility support for 32-bit applications in the 64-bit kernel. In addition, the differences between 64-bit and 32-bit data structures are processed differently in the driver to ensure that there will be no abnormal errors caused by data structure confusion when 32-bit applications and 64-bit applications call the driver interface.
[0091] Based on the environment variables, the running paths of hardware abstraction layers of different bit width types are included, so that applications of different bit width types can always locate the hardware abstraction layers of the corresponding bit width types, thereby solving the compatibility problem.
[0092] In some embodiments of the present application, optionally, the compatibility adaptation system further includes: a data processing module for encapsulating and processing the data structure of the running data of the application.
[0093] In this embodiment, the data structure of the running data of the 64-bit application is different from the data structure of the running data of the 32-bit application. For example, for the long data structure, the length is 4 bytes in a 32-bit system and 8 bytes in a 64-bit system. In the process of designing the application business logic, especially in the protocol, the data length is frequently used. By encapsulating the original data structure and managing it through macros, it is ensured that the data structure remains unified in the software design.
[0094] In some embodiments of the present application, a method for running a program of a power terminal device is provided. The power terminal device includes a system library. Figure 3 A flowchart showing a program running method of a power terminal device in some embodiments of the present application is shown. Figure 3 As shown, the method includes:
[0095] Step 302, when receiving an instruction to run an application, obtaining a bit width type of the application;
[0096] Step 304, determining the system library path corresponding to the system library according to the bit width type and the environment variable;
[0097] Step 306: Based on the system library path, call the system library to run the application.
[0098] In this embodiment, the bit width type is specifically the data width type that the computer processor can process or transmit at one time. Exemplarily, the bit width type includes 64 bits and 32 bits. Exemplarily, the bit width type also includes 8 bits and 16 bits. Exemplarily, the bit width type can also be 128 bits, 258 bits, etc.
[0099] The underlying systems of different bit widths are not compatible. For example, the processor architecture of ARMv7 is 32-bit, while the processor architecture of ARMv8 is 64-bit. The instruction sets of the two architectures are not compatible. ARMv8 corresponds to 64-bit systems, and can only run 64-bit applications. Some applications are developed based on 32-bit systems. In order to enable these applications to run on 64-bit systems, 64-bit architecture applications need to be redeveloped. This means that a program includes both 64-bit and 32-bit versions, and the functions of the two versions are exactly the same. This leads to duplicate development and affects efficiency.
[0100] In response to the above problems, this application proposes a compatibility adaptation system that is compatible with applications of different bit width types. In this system, an environment that can support the operation of applications of different bit width types is also provided. Taking the common 32-bit and 64-bit as an example, before running an application, first determine whether the bit width type of the application is 32-bit or 64-bit, and determine the corresponding operation path based on the judgment result. The operation path indicates different operation components, such as system libraries, environment variables, hal layers, drivers, etc.
[0101] By running applications of different bit widths through corresponding running paths, whether they are 32-bit applications, 64-bit applications, or 16-bit, 8-bit or 128-bit applications, software compatibility is solved at the system level. There is no need to develop applications with the same functions for system architectures of different bit widths, thus avoiding the problem of duplicate development.
[0102] For example, the compatibility adaptation system of the power terminal equipment includes a system library, which provides basic functions and services for the operation of the application. Taking the Linux (an open source Unix-like operating system) kernel operating system as an example, the system libraries of the Linux system include libc.so, libstdc++.so, and ld-linux.so.2, which are the basic dependencies for the operation of the application.
[0103] Due to differences in architecture and compiler, the system library itself can only support the corresponding application program. For example, a 32-bit system library can only support 32-bit applications, and a 64-bit system library supports 64-bit applications. In this regard, the present application sets different system libraries in the compatibility adaptation system, such as 8-bit system libraries, 16-bit system libraries, 32-bit system libraries, and 64-bit system libraries, which are stored in different system library paths.
[0104] Before running an application, the system library path of the corresponding bit width type is determined according to the bit width type of the application, so as to call the system library of the corresponding bit width type to run the current application, thereby achieving compatibility with applications of different bit width types.
[0105] The present application achieves compatibility with applications of different bit width types at the system level of the power terminal equipment, thereby avoiding the problem of repeatedly developing applications with the same functions for systems of different bit width types.
[0106] In some embodiments of the present application, optionally, the system library includes a first system library and a second system library, the bit width type of the first system library is a first bit width type, and the bit width type of the second system library is a second bit width type; according to the bit width type, determining the running path corresponding to the system library includes: when the bit width type is the first bit width type, determining the first system library path according to the environment variable, and the first system library path indicates the first system library; or, when the bit width type is the second bit width type, determining the second system library path according to the environment variable, and the second system library path indicates the second system library.
[0107] In this embodiment, exemplarily, the system library includes a first system library and a second system library, the first system library and the second system library have different bit width types, exemplarily, the first system library is a system library of the first bit width type, and the second system library is a system library of the second bit width type.
[0108] Environment variables are a mechanism used in operating systems to store and transmit configuration information. They are used by applications to link to corresponding system libraries. Taking the Linux kernel operating system as an example, the environment variable of the Linux system is defined as LD_LIBRARY_PATH.
[0109] For example, due to differences in architecture and compiler, the system library itself can only support the corresponding application program. For example, a 32-bit system library can only support 32-bit applications, and a 64-bit system library supports 64-bit applications. Therefore, in the design of a 64-bit system, it is necessary to include both 32-bit system libraries and 64-bit system libraries, store them in the same path, and clearly indicate whether the current path is a 64-bit system library or a 32-bit system library. The following example uses the first bit width type of 64 bits and the second bit width type of 32 bits. The compatibility adaptation system includes a 64-bit system library and a 32-bit system library, that is, the first system library and the second system library mentioned above.
[0110] Before running an application, the compatibility processing module determines whether the bit width type of the application is 32-bit or 64-bit. When it is determined that the application is a 32-bit application, the environment variable LD_LIBRARY_PATH contains the path where the 32-bit system library is located. The system library path of the 32-bit system library is determined through the environment variable, so that the application can be linked to the 32-bit system library, that is, the second system library. Similarly, when it is determined that the application is a 64-bit application, the environment variable LD_LIBRARY_PATH contains the path where the 64-bit system library is located. The system library path of the 64-bit system library is determined through the environment variable, so that the application can be linked to the 64-bit system library, that is, the first system library.
[0111] The system library paths of system libraries of different bit width types are included based on environment variables, so that applications of different bit width types can always locate the system libraries of the corresponding bit width types, thereby solving the compatibility problem.
[0112] In some embodiments of the present application, optionally, the power terminal device includes a first hardware abstraction layer and a second hardware abstraction layer, the bit width type of the first hardware abstraction layer is a first bit width type, and the bit width type of the second hardware abstraction layer is a second bit width type; according to the bit width type, determining the running path corresponding to the application, including: when the bit width type is the first bit width type, determining the first running path according to the environment variable, the first running path indicates the first hardware abstraction layer; or, when the bit width type is the second bit width type, determining the second running path according to the environment variable, the second running path indicates the second hardware abstraction layer.
[0113] In this embodiment, the hardware abstraction layer, also known as the HAL layer, exists in the power terminal device in the form of a dynamic library. Unlike the system library, the HAL layer mainly abstracts the functions of the application based on the hardware interface.
[0114] In the present application, taking the example of a power terminal device that is compatible with both 32-bit applications and 64-bit applications, in order to ensure that both 32-bit applications and 64-bit applications can run normally, the compatibility adaptation system is equipped with a 32-bit HAL layer and a 64-bit HAL layer. Exemplarily, the bit width type of the first hardware abstraction layer is 64 bits, and the bit width of the second hardware abstraction layer is 32 bits. The first hardware abstraction layer and the second hardware abstraction layer are stored in different running paths.
[0115] Before running an application, the compatibility processing module determines whether the bit width type of the application is 32 bits or 64 bits. When it is determined that the application is a 32-bit application, the corresponding hardware abstraction layer is determined to be the second hardware abstraction. Similarly, when it is determined that the application is a 64-bit application, the corresponding hardware abstraction layer is determined to be the first hardware abstraction.
[0116] Among them, the compatibility adaptation system also includes drivers. Drivers are the bridge between the operating system and the hardware devices, enabling the operating system to communicate and control the hardware devices, thereby realizing the normal operation of the hardware devices. In order to achieve the same driver can meet the use of 32-bit applications and 64-bit applications at the same time, the kernel needs to configure the COFIG_COMPAT function to enable compatibility support for 32-bit applications in the 64-bit kernel. In addition, the differences between 64-bit and 32-bit data structures are processed differently in the driver to ensure that there will be no abnormal errors caused by data structure confusion when 32-bit applications and 64-bit applications call the driver interface.
[0117] Based on the environment variables, the running paths of hardware abstraction layers of different bit width types are included, so that applications of different bit width types can always locate the hardware abstraction layers of the corresponding bit width types, thereby solving the compatibility problem.
[0118] In some embodiments of the present application, optionally, after calling the corresponding execution environment to execute the application based on the execution path, the method further includes: encapsulating the data structure of the execution data of the application.
[0119] In this embodiment, the data structure of the running data of the 64-bit application is different from the data structure of the running data of the 32-bit application. For example, for the long data structure, the length is 4 bytes in a 32-bit system and 8 bytes in a 64-bit system. In the process of designing the application business logic, especially in the protocol, the data length is frequently used. By encapsulating the original data structure and managing it through macros, it is ensured that the data structure remains unified in the software design.
[0120] In some embodiments of the present application, a program running device for a power terminal device is provided. Figure 4 A structural block diagram of a program running device of an electric power terminal device in some embodiments of the present application is shown, and the program running device 400 includes: a memory 402, which is used to store programs or instructions; a processor 404, which is used to implement the steps of the program running method of the electric power terminal device provided in any of the above embodiments when executing the program or instructions, and therefore also includes all the beneficial effects, which will not be repeated here to avoid repetition.
[0121] In some embodiments of the present application, a readable storage medium is proposed, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the program running method of the power terminal device provided in any of the above embodiments are implemented, and therefore all the beneficial effects are also included. To avoid repetition, they will not be repeated here.
[0122] In some embodiments of the present application, a power terminal device is proposed, comprising: a compatibility adaptation system for the power terminal device as provided in any of the above embodiments; and / or a program running device for the power terminal device as provided in any of the above embodiments; and / or a readable storage medium as provided in any of the above embodiments, and therefore also includes all the beneficial effects, which will not be described here to avoid repetition.
[0123] The methods may be implemented in various ways according to specific features and / or example applications. For example, the methods may be implemented by a combination of hardware, firmware, and / or software. For example, in a hardware implementation, the processor may be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, electronic devices, other equipment units for performing the above functions, and / or combinations thereof.
[0124] A computer readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device. A computer readable storage medium may be an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above devices, but is not limited thereto. A non-exhaustive list of more specific examples of computer readable storage media includes: a portable computer floppy disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM) or flash memory, a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory card, a floppy disk, a coding mechanical device (such as a punch card or a groove with a raised structure with instructions recorded thereon), and any suitable combination of the above devices. The computer-readable storage medium used herein should not be understood as a transmission signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagated through wave guides or other transmission media, or electrical signals transmitted through wires.
[0125] In the description of this application, the term "plurality" refers to two or more than two. Unless otherwise clearly defined, the terms "upper" and "lower" indicate positions or positional relationships based on the positions or positional relationships described in the accompanying drawings. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, they cannot be understood as limitations on this application. The terms "connect", "install", "fixed", etc. should be understood in a broad sense. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0126] In the description of the present application, the description of the terms "one embodiment", "some embodiments", "specific embodiments", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In the present application, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0127] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A compatibility adaptation system for power terminal equipment, characterized in that: include: System libraries; A compatibility processing module, configured to obtain a bit width type of the application upon receiving an instruction to run the application; as well as Determine a system library path corresponding to the system library according to the bit width type and the environment variable; The program running module is used to call the system library to run the application based on the system library path.
2. The compatibility adaptation system according to claim 1, characterized in that: The system library comprises a first system library and a second system library, the bit width type of the first system library is a first bit width type, and the bit width type of the second system library is a second bit width type; The compatibility processing module is further configured to determine, when the bit width type is the first bit width type, a first system library path according to the environment variable, wherein the first system library path indicates a first system library; Alternatively, when the bit width type is the second bit width type, a second system library path is determined according to the environment variable, and the second system library path indicates a second system library.
3. The compatibility adaptation system according to claim 1, characterized in that: The power terminal device comprises a first hardware abstraction layer and a second hardware abstraction layer, the bit width type of the first hardware abstraction layer is a first bit width type, and the bit width type of the second hardware abstraction layer is a second bit width type; The compatibility processing module is further configured to determine a first operating path according to the environment variable when the bit width type is the first bit width type, wherein the first operating path indicates a first hardware abstraction layer; Alternatively, when the bit width type is the second bit width type, a second execution path is determined according to the environment variable, and the second execution path indicates a second hardware abstraction layer.
4. The compatibility adaptation system according to any one of claims 1 to 3, characterized in that: Also includes: The data processing module is used to encapsulate the data structure of the running data of the application.
5. A program running method for power terminal equipment, characterized in that: The power terminal device includes a system library, and the program running method includes: Upon receiving an instruction to run an application, obtaining a bit width type of the application; Determine a system library path corresponding to the system library according to the bit width type and the environment variable; Based on the system library path, the system library is called to run the application.
6. The program running method according to claim 5, characterized in that: The system library comprises a first system library and a second system library, the bit width type of the first system library is a first bit width type, and the bit width type of the second system library is a second bit width type; Determining the system library path corresponding to the system library according to the bit width type and the environment variable includes: When the bit width type is the first bit width type, determining a first system library path according to the environment variable, the first system library path indicating a first system library; Alternatively, when the bit width type is the second bit width type, a second system library path is determined according to the environment variable, and the second system library path indicates a second system library.
7. The program running method according to claim 5, characterized in that: The power terminal device comprises a first hardware abstraction layer and a second hardware abstraction layer, the bit width type of the first hardware abstraction layer is a first bit width type, and the bit width type of the second hardware abstraction layer is a second bit width type; The program running method also includes: In a case where the bit width type is the first bit width type, determining a first operating path according to the environment variable, the first operating path indicating a first hardware abstraction layer; Alternatively, when the bit width type is the second bit width type, a second execution path is determined according to the environment variable, and the second execution path indicates a second hardware abstraction layer.
8. The program running method according to any one of claims 5 to 7, characterized in that: After calling the system library to run the application based on the system library path, the method further includes: The data structure of the running data of the application is encapsulated.
9. A program running device for power terminal equipment, characterized in that: include: Memory, used to store programs or instructions; A processor, used to implement the steps of the program running method as described in any one of claims 5 to 8 when executing the program or instruction.
10. A readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by a processor, the steps of the program running method according to any one of claims 5 to 8 are implemented.
11. A power terminal device, characterized in that: include: A compatibility adaptation system for a power terminal device as claimed in any one of claims 1 to 4; and / or The program running device of the power terminal device as claimed in claim 9; and / or The readable storage medium as claimed in claim 10.