A lightweight universal compilation method, system and device
By employing a lightweight and universal compilation method, the compatibility issues of microkernel operating systems with various processor architectures were resolved, achieving lightweight system kernel and testability of applications, thus ensuring the functional safety of embedded systems.
Patent Information
- Application Number
- CN202210816359.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-12
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2042-07-12
AI Technical Summary
Existing microkernel embedded operating systems lack third-party development tool support, resulting in bloated system kernels, poor testability of applications, and difficulty in compatibility with various processor architectures.
This paper provides a lightweight and universal compilation method. By obtaining the source code of the microkernel operating system and the compiler of the target processor, the paper compiles and modifies the call agent code to generate a compatible kernel, dynamic library loader and limited call interface library. The call agent is used to encapsulate the differences of processors with different architectures and realize memory allocation, dynamic library loading and permission management.
It achieves universal support for various processor architectures in the microkernel operating system, ensuring the functional safety and testability of embedded systems, and reducing the size of the system kernel.
Smart Images

Figure CN115268926B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of microkernel embedded operating systems, and more particularly relates to a lightweight universal compiling method, system and device applied to a microkernel operating system. BACKGROUND
[0002] Existing operating systems generate compilers according to instruction sets. For example, Linux has compilers for multiple versions such as arm, armv7 and arm64 to support corresponding CPUs; Windows supports different types of CPUs through different subsystems; and some operating systems come with arm versions or x86 versions of compilers. This processing method is based on the assumption that the support of CPUs for instruction sets is stable. On the other hand, in recent years, a large number of domestic CPUs are increasingly applied to the field of embedded applications. These domestic CPUs usually come with compilers, rather than using standard arm compilers. However, it is often unknown what modifications these domestic CPUs have made to be able to use the standard arm compiler. The CPU manufacturers can only guarantee that the system kernel and application programs can be compiled to work normally using the compilers they provide. At the same time, in the past, there were only x86 and arm architecture CPUs in the chip market, but in recent years, RISC-V architecture CPUs have gradually emerged, and many CPU manufacturers have begun to provide RISC-V architecture CPUs. These CPU manufacturers will also provide their own compilers. In addition, GPUs originally used only for graphics cards are also expanding their application range, and different GPU manufacturers are also providing their own compilers.
[0003] At present, the above processors are all applied in the field of embedded systems. For operating system providers, in order to support all types of processors, more work has to be done, and the risk of using standard compilers is also increasing. Existing operating system providers provide compiling tools according to instruction sets to support their own operating systems. For example, the Windows operating system provides the windows studio platform, which uses SDK and DDK and other support tools to assist in the development of x86_64 and arm32 / 64 platforms. Developers can choose a variety of third-party tools and libraries for software development. Linux operating system has a variety of development tools to support various CPU architectures and various CPU manufacturers, and GPU manufacturers also provide Linux platform development tools. Developers can choose a variety of development tools and libraries for software development. Other operating systems often lack third-party development tool support, and usually need to provide corresponding development tools according to the standard instruction set of each CPU architecture supported, and then have multiple language compilers. These compilers are usually based on the gcc compiler of the macrokernel operating system.
[0004] However, for the above-mentioned embedded operating system lacking third-party development tool support, the development compiler process causes the operating system kernel to become increasingly bloated. Specifically, the operating system kernel needs to be tightly coupled with different instruction sets, and only the arm architecture is divided into different instruction sets such as armv4-v8, and different codes such as armv4 / func.c, armv5 / func.c, armv6 / func.c, armv7 / func.c, and armv8 / func.c are bound, but these codes are also necessary in order to support different instruction sets. On the other hand, in the development process of existing embedded applications, there is no restriction on the compilation tool itself, and developers can arbitrarily use various interfaces, so that when testing, different projects need to determine the interfaces that need to be tested according to the specific development method of the project, and then the test team analyzes the specific interfaces used and the value range to generate test cases. However, this can cause different project test plans and test cases to be difficult to reuse, and the test plan is difficult to fully cover the tested project, which can further cause the limited needs of customers to be difficult to guarantee functional safety. Further, for the microkernel embedded operating system lacking third-party development tool support, because the memory allocation method, dynamic library loading method, and permission management method are different from those of the macrokernel operating system, the program compiled by the gcc compiler based on the macrokernel operating system cannot be used in the microkernel operating system. SUMMARY
[0005] The purpose of the present application is to solve the problems of the existing microkernel embedded operating system lacking third-party development tool support, which is bloated due to the implementation of universal support for processors of various architectures, and poor testability of the corresponding application.
[0006] In order to achieve the above-mentioned purpose, the present application provides a lightweight universal compilation method, system and device applied to a microkernel operating system.
[0007] According to a first aspect of the present application, a lightweight universal compilation method applied to a microkernel operating system is provided, which comprises the following steps:
[0008] Obtaining the source code of the microkernel operating system, the source code including kernel code, dynamic library loading code, C function library code, limited call interface library function, and call agent code;
[0009] Obtaining a compiler of a target processor, the target processor being a processor used by a user;
[0010] Compiling the kernel code, the dynamic library loading code, the C function library code, and the limited call interface library function using the compiler to obtain a compatible kernel, a compatible dynamic library loader, a compatible C function library, and a compatible limited call interface library.
[0011] modifying and / or supplementing the calling agent code according to the architecture of the target processor, and compiling the modified and / or supplemented calling agent code by using the compiler to obtain a compatible calling agent library.
[0012] Optionally, the lightweight universal compiling method applied to the microkernel operating system further comprises the following steps:
[0013] obtaining source code of an application program developed according to the calling interface defined in advance according to the limited calling interface library function;
[0014] calling the limited calling interface library function;
[0015] compiling the source code of the application program by using the pre-updated compiler, and linking the compatible calling agent library to obtain target code;
[0016] linking the compatible dynamic library loader, the compatible C function library and the compatible limited calling interface library to the target code to obtain an executable program.
[0017] Optionally, the compatible kernel has the following functions:
[0018] compatibility with the posix standard, support for the elf format, support for common variable types, and support for common macro definitions and pre-compiled options.
[0019] Optionally, the modifying the calling agent code according to the architecture of the target processor comprises:
[0020] obtaining a memory allocation mode, a dynamic library loading mode and a permission management mode of the target processor according to the architecture of the target processor;
[0021] adaptively modifying the calling agent code according to the memory allocation mode, the dynamic library loading mode and the permission management mode of the target processor.
[0022] Optionally, after the obtaining the compiler of the target processor, the compiling options of the compiler are set according to the architecture of the target processor.
[0023] Optionally, before the compiling the source code of the application program by using the compiler, and linking the compatible calling agent library to obtain target code, the following step is further included:
[0024] replacing the corresponding library files of the compiler by using the compatible dynamic library loader, the compatible C function library, the compatible limited calling interface library and the compatible calling agent library to obtain the pre-updated compiler.
[0025] According to a second aspect of the present application, a lightweight universal compiling system applied to a microkernel operating system is provided, and the compiling system comprises the following functional modules:
[0026] A first source code obtaining module is configured to obtain source code of the microkernel operating system, wherein the source code comprises kernel code, dynamic library loading code, C function library code, a limited calling interface library function and calling agent code;
[0027] A compiler obtaining module is configured to obtain a compiler of a target processor;
[0028] A first compiling module is configured to compile the kernel code, the dynamic library loading code, the C function library code and the limited calling interface library function by using the compiler to obtain a compatible kernel, a compatible dynamic library loader, a compatible C function library and a compatible limited calling interface library;
[0029] A patching and compiling module is configured to modify and / or supplement the calling agent code according to the architecture of the target processor, and to compile the modified and / or supplemented calling agent code by using the compiler to obtain a compatible calling agent library.
[0030] Optionally, the lightweight universal compiling system applied to the microkernel operating system further comprises the following functional modules:
[0031] A second source code obtaining module is configured to obtain source code of an application program developed according to a calling interface defined by the limited calling interface library function;
[0032] A library function calling module is configured to call the limited calling interface library function;
[0033] A second compiling module is configured to compile the source code of the application program by using a pre-updated compiler, and to link the compatible calling agent library to obtain target code,
[0034] and to link the compatible dynamic library loader, the compatible C function library and the compatible limited calling interface library to the target code to obtain an executable program.
[0035] According to a third aspect of the present application, a lightweight universal compiling device applied to a microkernel operating system is provided, and the compiling device comprises a processor and a memory, and the processor executes a computer program stored in the memory to execute any one of the above-mentioned lightweight universal compiling methods applied to the microkernel operating system.
[0036] The present application has the following advantages:
[0037] The lightweight universal compiling method applied to the microkernel operating system provided by the application firstly acquires source code of the microkernel operating system, wherein the source code comprises kernel code, dynamic library loading code, C function library code, limited calling interface library function and calling agent code; secondly, a compiler of a target processor is acquired; thirdly, the compiler is used to compile the kernel code, the dynamic library loading code, the C function library code and the limited calling interface library function, to obtain compatible kernel, compatible dynamic library loader, compatible C function library and compatible limited calling interface library; and finally, the calling agent code is modified and / or supplemented according to the architecture of the target processor, and the calling agent code after the modification and / or supplementation is compiled by using the compiler to obtain a compatible calling agent library.
[0038] The lightweight universal compiling method applied to the microkernel operating system provided by the application, the calling agent code is used to realize a calling agent, and the differences of processors of different architectures in memory allocation, dynamic library loading and permission management are encapsulated through the calling agent, so that the microkernel operating system can recognize the calling of the limited function by the processors of different architectures, to realize the binding of the microkernel operating system kernel and the instruction set, and to solve the problem that the system kernel of the microkernel embedded operating system lacking of the support of the third-party development tool is bloated due to the universal support of various architectures of processors.
[0039] The lightweight universal compiling method applied to the microkernel operating system provided by the application, the limited calling interface library function is used to realize a limited calling interface, that is, the application program can only call the interface function and data type within the limited range to realize the function within the limited range, so as to guarantee the testability of the application program and the functional safety of the embedded system, and the calling interface within the limited range can be completely tested.
[0040] The lightweight universal compiling system applied to the microkernel operating system and the lightweight universal compiling equipment applied to the microkernel operating system provided by the application belong to one general inventive concept as the lightweight universal compiling method applied to the microkernel operating system, and the beneficial effects thereof will not be repeated here.
[0041] Other features and advantages of the application will be described in detail in the following specific embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0042] The application can be better understood by referring to the following description made in conjunction with the accompanying drawings, wherein the same or similar reference signs are used to represent the same or similar components in all the drawings.
[0043] Figure 1 An implementation flowchart of the lightweight universal compiling method applied to the microkernel operating system according to the embodiment of the application is shown;
[0044] Figure 2 Fig. 2 shows a decoupling operation schematic diagram of a system kernel and an instruction set according to an embodiment of the present application;
[0045] Figure 3 Fig. 3 shows a compilation flowchart of an application program according to an embodiment of the present application;
[0046] Figure 4 Fig. 4 shows an implementation function flowchart of an application program after calling a library function according to an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to enable a person skilled in the art to more fully understand the technical solutions of the present application, in the following, exemplary embodiments of the present application will be described more fully and in detail with reference to the accompanying drawings. Obviously, one or more of the embodiments of the present application described below are only one or more of the specific manners in which the technical solutions of the present application can be implemented, and are not exhaustive. It should be understood that the technical solutions of the present application can be implemented in other manners belonging to the same general inventive concept without being limited by the exemplary described embodiments. Based on one or more embodiments of the present application, all other embodiments obtained by a person skilled in the art without creative labor should belong to the scope of protection of the present application.
[0048] Embodiment: Figure 1 Fig. 1 shows an implementation flowchart of a lightweight universal compilation method applied to a microkernel operating system according to an embodiment of the present application, Figure 2 Fig. 2 shows a decoupling operation schematic diagram of a system kernel and an instruction set according to an embodiment of the present application; Figure 1 and Figure 2 The lightweight universal compilation method applied to a microkernel operating system according to an embodiment of the present application includes the following steps:
[0049] Step S100, source code of the microkernel operating system is obtained, the source code including kernel code, dynamic library loading code, C function library code, limited calling interface library function and calling proxy code;
[0050] Step S200, a compiler of a target processor is obtained, the target processor being a processor used by a user;
[0051] Step S300, the compiler is used to compile the kernel code, the dynamic library loading code, the C function library code and the limited calling interface library function, to obtain a compatible kernel, a compatible dynamic library loader, a compatible C function library and a compatible limited calling interface library;
[0052] Step S400, modifying and / or supplementing the calling agent code according to the architecture of the target processor, and compiling the modified and / or supplemented calling agent code by using the compiler to obtain a compatible calling agent library.
[0053] Further, with reference to Figure 1 The light-weight universal compiling method applied to the micro-kernel operating system in the embodiment of the present application further comprises the following steps:
[0054] Step S500, obtaining the source code of an application program developed according to the calling interface defined by the limited calling interface library function;
[0055] Step S600, calling the limited calling interface library function;
[0056] Step S700, compiling the source code of the application program by using the pre-updated compiler, and linking the compatible calling agent library to obtain target code;
[0057] Step S800, linking the compatible dynamic library loader, the compatible C function library and the compatible limited calling interface library to the target code to obtain an executable program.
[0058] Further, in the embodiment of the present application, the compiler is a gcc compiler.
[0059] Further, in the embodiment of the present application, the compatible kernel has the following functions:
[0060] Compatible with the posix standard, supports the elf format, supports common variable types, and supports common macro definitions and pre-compiled options.
[0061] Further, in the embodiment of the present application, the modification of the calling agent code according to the architecture of the target processor in step S400 comprises:
[0062] Obtaining the memory allocation mode, the dynamic library loading mode and the permission management mode of the target processor according to the architecture of the target processor;
[0063] Adaptively modifying the calling agent code according to the memory allocation mode, the dynamic library loading mode and the permission management mode of the target processor.
[0064] Further, in the embodiment of the present application, after obtaining the compiler of the target processor in step S200, the compiling options of the compiler are set according to the architecture of the target processor.
[0065] Further, before the step S700, the application further comprises the following steps:
[0066] The application further comprises the following steps:
[0067] Figure 3 The application further comprises the following steps: Figure 3 In the past, the calling mode was too expensive to use, but with the continuous improvement of CPU performance such as arm, a large number of embedded systems run at idle speed, and it is possible to use this calling mode. Using the calling agent makes the kernel decoupled from the CPU architecture, reduces the size of the kernel, increases the compatibility of different CPU architectures, and enhances the portability. Using the calling agent will cause the efficiency to be reduced, and the development demand of the present compiling environment is that the project does not need to give priority to the efficiency according to the existing CPU performance.
[0068] Regarding the limited interface: from the design, compared with the existing operating system compiling environment, the limited calling interface is supported, only specific interfaces are provided for specific functions, and the testability of the project is guaranteed.
[0069] Regarding the unbound compiler: from the design, compared with the existing operating system compiling environment, by supporting the posix standard, supporting the elf format, supporting common variable types, supporting common macro definitions and pre-compiled options, adding corresponding compiling options according to different CPUs, replacing the crt1.o, crti.o, crtn.o and other files used by the customer gcc compiler, linking the compatible limited calling interface library file, and through the calling vendor's linux version gcc compiler, the kernel and application program supporting the domestic microkernel operating system are compiled.
[0070] The lightweight universal compiling method applied to the microkernel operating system of the embodiment of the application limits the development scale of the compiler by limiting the interface, and guarantees the universal support for CPUs of various architectures by calling the agent, so as to be applicable to small operating system companies to complete the development of the compiler with limited manpower and resources, and meanwhile provide support for various CPU architectures. Regarding the limited calling interface: the application program can only call the interface functions and data types within the limited range to realize the functions within the limited range. The limited calling interface guarantees that the small operating system company can complete the development of the compiler with limited manpower and resources, and the functions of the limited calling interface also include: guaranteeing testability, guaranteeing the functional safety required by the embedded system, and the calling interface within the limited range can be completely tested. The customer embedded system usually does not require complete functional support, for example, the user development board only needs to support the serial port and the network port, or only needs the specific display function to only need a simple interface and interaction. The limited calling interface only includes the operation required by the user, and provides the corresponding code. These codes are recompiled in different CPU environments using the compiling environment provided by the customer to generate standard executable elf format files.
[0071] Regarding the calling agent: whether the compiling result of the compiler can run, the problem does not lie in the elf file format used, but in memory allocation, dynamic library loading, permission management and other operations. The differences of different CPUs in calling interface and permission management and the like are encapsulated through the calling agent, so that the microkernel of the domestic operating system can recognize the calling of the limited functions by different CPUs.
[0072] The calling agent is a library encapsulating specific function interfaces, which is used for the agent of the operating system functions, and is used for encapsulating the different requirements of different CPU architectures and designs for the kernel.
[0073] The calling agent function mainly involves: inter-process communication IPC, mutual exclusion memory pool and resource management, thread management, timer interrupt management and the like. The calling agent encapsulates the adjustments required by the operating system due to different CPU architectures and designs.
[0074] The calling agent has a unified interface, as long as the corresponding interface can be implemented, the operating system can run on the corresponding CPU; the kernel includes the support for the standard instruction set and can run on the corresponding CPU after recompilation, but when the corresponding functions are involved, the kernel is completed through the calling agent. The calling agent has different implementation codes for different architecture CPUs; as long as the CPU of the same architecture can be compiled, it can be supported.
[0075] By compatible with the POSIX standard, calling the macro kernel Linux platform gcc compiler provided by the CPU vendor, limiting the supported calling interface, using the calling agent, generating an executable program that can run on the domestic microkernel operating system and conforms to the functional safety of the compilation architecture.
[0076] Figure 4 The implementation function flowchart after the application program calls the library function of the embodiment of the application is shown. Figure 4 In the embodiment of the application, when the application program calls the library function, the library function accesses the corresponding interface of the kernel, and the kernel accesses the functions of different architecture CPUs through the calling agent interface.
[0077] The lightweight universal compilation method of the application applied to the microkernel operating system has the following beneficial effects:
[0078] In terms of chip support, by limiting the calling interface, using the calling agent, ignoring the execution efficiency and the size of the compilation result, calling the compilation environment provided by the CPU vendor, a program that can run on the domestic microkernel operating system is generated, thereby maximizing the compatibility of the domestic microkernel operating system to various chips at home and abroad, providing support and guarantee for the support of subsequent domestic chips, realizing the full industry chain of domestic chips and domestic high-end operating systems. Break through the neck of foreign high-end operating systems. Compatible with POSIX and other specifications, compatible with existing algorithm, logic and other application requirements.
[0079] The effect of the lightweight universal compilation method of the application applied to the microkernel operating system is described below through a specific example:
[0080] The Kirk microkernel core is verified and tested on the ARM a35 architecture, and the Kirk microkernel operating system kernel part is compiled using the RISC compiler.
[0081] The / px30_linux / prebuilts / gcc / linux-x86 / aarch64 / gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu / bin / aarch64-linux-gnu-gcc program in the compilation environment of RISC is configured.
[0082] The calling agent library is compiled, the Kirk kernel is compiled, and the ld-kirk and the limited interface library including libc are compiled.
[0083] Replace the crt1.o, crti.o, crtn.o and other files used by the gcc compiler of the customer platform.
[0084] Compile the HelloWorld test program using the client platform gcc compiler.
[0085] The HelloWorld output can be seen in the terminal.
[0086] Code related to the limited interface:
[0087] / / Limited to only support standard 8250 serial port operations
[0088] #define 8250_IO_REG 0x00 / / 8250 I / O Data
[0089] #define 8250_IER_REG 0x04 / / 8250 Interrupt Enable
[0090] #define 8250_IER_TXEN (1<<1)
[0091] #define 8250_IER_RXEN (1<<0)
[0092] #define 8250_IIR_REG 0x08 / / 8250 Interrupt Identify
[0093] #define 8250_LCR_REG 0x0c / / 8250 Line Control
[0094] #define 8250_MCR_REG 0x10 / / 8250 Modem Control
[0095] #define 8250_LSR_REG 0x14 / / 8250 Line Status
[0096] #define 8250_MSR_REG 0x18 / / 8250 Modem Status
[0097] #define 8250_CFG_STATUS 0x1c / / 8250 Config Status
[0098] DisplayChar() ...
[0100] ldr w2, [x7, #8250_LSR_REG]
[0101] tbz w2, #5, 0b / / wait line status
[0102] and w2,w1,#0xff
[0103] str w2,[x7,#8250_IO_REG] / / transmit
[0104] ldr w2,[x7,#8250_LSR_REG]
[0105] tbz w2,#6,1b / / check line status for transmit ...
[0107] When the kernel performs interrupt processing, instead of directly processing the interrupt, the interrupt agent is called, and the kernel itself code remains unchanged:
[0108] Kernel code:
[0109] intcall_isr_prodigy(IsrEvent*isrEvent){
[0110] returnisr_prodigy_handler(isrEvent);
[0111] }
[0112] Call agent library code:
[0113] 32-bit arm platform:
[0114] intisr_prodigy_handler(IsrEvent*isrEvent){ ...
[0116] if(inEL3){
[0117] If(fSecureState){
[0118] handleIrq(isrEvent);
[0119] }else{
[0120] handleFiq(isrEvent);
[0121] }
[0122] } ...
[0124] }
[0125] 64-bit arm platform:
[0126] int intisr_prodigy_handler(IsrEvent *isrEvent) { ...
[0128] if (inEL3) {
[0129] handleF1q(isrEvent);
[0130] } ...
[0132] }
[0133] Correspondingly, on the basis of the light universalization compiling method applied to the microkernel operating system proposed in the embodiments of the present application, the embodiments of the present application further propose a light universalization compiling system applied to the microkernel operating system, which comprises the following functional modules:
[0134] a first source code acquisition module, configured to acquire source code of the microkernel operating system, the source code comprising kernel code, dynamic library loading code, C function library code, limited calling interface library function and calling agent code;
[0135] a compiler acquisition module, configured to acquire a compiler of a target processor;
[0136] a first compiling module, configured to compile the kernel code, the dynamic library loading code, the C function library code and the limited calling interface library function by using the compiler to obtain a compatible kernel, a compatible dynamic library loader, a compatible C function library and a compatible limited calling interface library;
[0137] a patching and compiling module, configured to modify and / or supplement the calling agent code according to the architecture of the target processor, and to compile the modified and / or supplemented calling agent code by using the compiler to obtain a compatible calling agent library.
[0138] Further, the light universalization compiling system applied to the microkernel operating system of the embodiments of the present application further comprises the following functional modules:
[0139] a second source code acquisition module, configured to acquire source code of an application program developed in advance according to a calling interface defined by the limited calling interface library function;
[0140] a library function calling module, configured to call the limited calling interface library function;
[0141] a second compiling module, configured to compile the source code of the application program by using a pre-updated compiler, and to link the compatible calling agent library to obtain target code,
[0142] and linking the compatible dynamic library loader, the compatible C function library and the compatible limited call interface library to the object code to obtain an executable program.
[0143] Correspondingly, based on the light-weight universal compiling method applied to the micro-kernel operating system proposed in the embodiments of the present application, the embodiments of the present application further propose a light-weight universal compiling device applied to the micro-kernel operating system, which comprises a processor and a memory. The processor executes the computer program stored in the memory to execute the compiling method applied to the micro-kernel operating system proposed in the embodiments of the present application.
[0144] Although one or more embodiments of the present application have been described above with a certain degree of particularity, one skilled in the art could make numerous alterations to the details of the present application without departing from the spirit and the scope of the present application. Hence, the above description of the embodiments is not intended to limit the present application, but rather is to provide an enabling disclosure as required by the patent statutes.
Claims
1. A lightweight universal compilation method applied to a microkernel operating system, characterized in that, The method comprises the following steps: obtaining source code of the microkernel operating system, which comprises kernel code, dynamic library loading code, C function library code, limited calling interface library functions and calling agent code; obtaining a compiler of a target processor; compiling the kernel code, the dynamic library loading code, the C function library code and the limited calling interface library functions by using the compiler to obtain a compatible kernel, a compatible dynamic library loader, a compatible C function library and a compatible limited calling interface library; modifying and / or supplementing the calling agent code according to the architecture of the target processor, and compiling the modified and / or supplemented calling agent code by using the compiler to obtain a compatible calling agent library; obtaining source code of an application program developed according to a calling interface defined in advance according to the limited calling interface library functions; calling the limited calling interface library functions; compiling the source code of the application program by using a pre-updated compiler and linking the compatible calling agent library to obtain target code; linking the compatible dynamic library loader, the compatible C function library and the compatible limited calling interface library to the target code to obtain an executable program.
2. The lightweight universal compilation method for microkernel operating system according to claim 1, wherein, The compatible kernel has the following functions: compatibility with the posix standard, support for the elf format, support for common variable types and support for common macro definitions and pre-compiled options.
3. The lightweight universal compilation method for microkernel operating system according to claim 1, wherein, The modification of the calling agent code according to the architecture of the target processor comprises the following steps: obtaining the memory allocation mode, the dynamic library loading mode and the permission management mode of the target processor according to the architecture of the target processor; adaptively modifying the calling agent code according to the memory allocation mode, the dynamic library loading mode and the permission management mode of the target processor.
4. The lightweight universal compilation method for microkernel operating system according to claim 1, wherein, After obtaining the compiler of the target processor, the compilation options of the compiler are set according to the architecture of the target processor.
5. The lightweight universal compilation method for microkernel operating system according to claim 1, wherein, Before the source code of the application program is compiled by using the pre-updated compiler and the compatible calling agent library is linked to obtain target code, the following step is further included: replacing the corresponding library files of the compiler by using the compatible dynamic library loader, the compatible C function library, the compatible limited calling interface library and the compatible calling agent library to obtain the pre-updated compiler.
6. A lightweight universal compilation system applied to a microkernel operating system, characterized in that, The method comprises the following steps: a first source code obtaining module is configured to obtain source code of the microkernel operating system, which comprises kernel code, dynamic library loading code, C function library code, limited calling interface library functions and calling agent code; a compiler obtaining module is configured to obtain a compiler of a target processor; a first compiling module is configured to compile the kernel code, the dynamic library loading code, the C function library code and the limited calling interface library functions by using the compiler to obtain a compatible kernel, a compatible dynamic library loader, a compatible C function library and a compatible limited calling interface library; a patching and compiling module is configured to modify and / or supplement the calling agent code according to the architecture of the target processor, and compile the modified and / or supplemented calling agent code by using the compiler to obtain a compatible calling agent library; a first compiling module is configured to compile the source code of the application program by using a pre-updated compiler and link the compatible calling agent library to obtain target code; a linking module is configured to link the compatible dynamic library loader, the compatible C function library and the compatible limited calling interface library to the target code to obtain an executable program. a second source code obtaining module, configured to obtain source code of an application program developed according to a defined calling interface library function defined by the defined calling interface; a library function calling module, configured to call the defined calling interface library function; a second compiling module, configured to compile the source code of the application program by using a pre-updated compiler, and link the compatible calling agent library to obtain target code, and link the compatible dynamic library loader, the compatible C function library and the compatible defined calling interface library to the target code to obtain an executable program.
7. A lightweight universal compilation device applied to a microkernel operating system, characterized in that, The application comprises a processor and a memory, and the processor executes a computer program stored in the memory to execute the light-weight universal compiling method applied to the microkernel operating system according to any one of claims 1-5.
Citation Information
Patent Citations
Remote communication packaging method and system based on heterogeneous environment
CN107070964A
Method and system for distributed building application supporting multiple cores
CN109117140A