Dynamic loading technology of module in embedded system

Source: Internet
Author: User
Tags file system advantage

In this paper, a new dynamic loading technique for embedded system is proposed, which is simple in design, small in resource and low in cost, and is applied successfully in Deltaos. It can improve the flexibility of the system and expand the properties. The principle and application of loading and dynamic linkage, explain the relevant terminology, describe the basic design idea: Detailed description of the core of the technology. That is, the module declaration, the call library, the two level relocation table, finally gives the conclusion. Keyword module dynamic adding embedded system Deltaos

Introduction
With the rapid development of electronic technology, the application of embedded-type equipment is more and more extensive and the complexity is more and more high. This makes the hardware and software design ratio has changed greatly, the proportion of software development is more and more large. However, the traditional embedded development process needs to link the application with the operating system compilation into a whole, and then download to the target computer to run. If you find a problem during debugging, you need to rearrange the links and then repeat the download run process. Such development process cycle is long and cumbersome, has been increasingly not adapted to the needs of rapid marketing.

In order to adapt to the diversification of embedded applications and speed up the development process of embedded system, in addition to the need for reliable platform software support, such as file system, network protocol stack RTOs and supporting the integrated development environment, it is more important to be able to dynamically expand the system platform. In recent years, the new generation of embedded operating systems has begun to use dynamic expansion technology: The basic system (including the operating system and other shared function call library) and application development separately processing, support module update and dynamic loading technology. Many mainstream traditional embedded operating system manufacturers, such as WindRiver, Green Hilis, Lynxworks, have launched a highly reliable, high-performance RTOs version for aerospace, basic communications equipment and other fields to support the dynamic loading and updating of applications and system components. In consumer electronics, the relevant operating system vendors, such as Symbian, Palm and Microsoft, are actively introducing operating systems with corresponding functions, which have been widely used in the next generation of mobile devices.

In order to become a dynamically scalable system platform, most embedded operating systems need to use dynamic loading technology. In general, dynamic loading refers to the application or the system needs to use a module during the operation of the service, so through a series of scheduled actions to load the specified module into the system, so that the caller continue to work smoothly. The key to its implementation is loading and dynamic link technology. Because loads and dynamic links are interdependent and closely related, they are discussed together.

1 load and dynamic link mechanism
Loading is mainly responsible for moving the module program from level Two storage devices (such as hard disk or flash) to the specified memory space, and the module to the system loader unified management.

Program links are divided into static links, load-time links, and run-time links. A static link is a link between a program and all the libraries it needs to run into an execution file. It has the advantage of being able to run independently and quickly, but it links the generated code to a larger size. Load-time link refers to the program when compiling the link will not be used in the library link to the execution of the program, but when it is loaded by the loader to parse the execution file, in turn, the use of the library loaded into the system to run. The advantage of this is that the amount of code in the program itself is reduced, but the memory that the Run-time program occupies does not decrease, while increasing the workload of the loader. Dynamic linking is the further development of the load-time link, which refers to delaying the loading process of the library to execution when the program is run. This approach does not introduce additional code to the program, nor does it add overhead to the loader, which is only loaded when the application is actually using a library, reducing unnecessary space consumption. Its disadvantage is that there may be some running overhead.

Dynamic loading in embedded systems is similar to the common concept of dynamic linkage, but the loading linker in the embedded system has its own characteristics: it is cross loading, the host side does part of the work, such as the relocation of the program, the implementation of file resolution, and so on, and the target machine is relatively simple, mainly to do module search location and space allocation, and specify the physical address or map the virtual address to run it. Part of the embedded system does not support virtual memory, application and kernel shared storage space. When the system is loaded with multiple applications to the system, it is generally necessary to use overlap technology to solve the problem of limited memory space, that is, when multiple applications run the address space conflict, the loader will freeze the current temporarily not running the application, so that the new loaded application using the specified address space, This design is used in the Pairnos. For embedded systems that support virtual memory, the loader's work is greatly simplified, and each application can run in the same virtual space without the need for the loader to reposition or use overlap technology, thus increasing the efficiency. Vxworks6. O,wince all use this design. There are many applications in different fields in the two ways.

The dynamic loading technology of the module is based on the 32-bit embedded operating system supported MMU (Memory Management unit), and the technology of loading and dynamic linking is adopted in this paper. The embedded system built with this technology is oriented to the high-end market, especially to the areas with high reliability and security requirements. In the development of a new generation of highly reliable versions of Har (High Available reliable system), the loader lambdaloader based on the design was successfully implemented, achieving the expected sexual
Can ask.

Design of dynamic loading of 2 modules
2.1 Design Ideas
First, define concepts: module, target program, interface function Address table, and call library.
The ① module, mainly refers to a unit loaded by the loader, and the concept of the module here is primarily to emphasize that it is a provider of a range of services for applications or systems.
② target program, refers to the user of the module. It can be an application, or it can be another module.
③ Interface Function Address Table (also referred to as the module relocation table), refers to the module in an array table, the array table content is the module external function interface provided by the address.
The ④ call Library, which is a proprietary library for use by the module caller link. It corresponds to the relevant module one by one, and the encapsulated module interface is used by the target program. In addition, it has a runtime to determine the module relocation table address pointer and module dynamic lookup positioning code.

If dynamic loading is to be realized in the system, a module positioning mechanism is needed first, so that the caller can dynamically locate the required module in the system, and secondly, it can make the module relate to the target program dynamically and coordinate the work. In order to solve these problems, we need a series of related design: the declaration mode of the module, the work of simplifying the address space of the target machine module, the mechanism of the relocation table, and so on. Based on this design, the system can achieve dynamic loading more smoothly. The module dynamically loads the workflow as shown in Figure L. The main purpose described here is the work of the target machine.

2.2 Statement of the module
The module first defines its associated properties. This is done using the module declaration file. The module declaration file needs to be defined: The module name, version, API interface provided externally. After the system compiles the module program, a series of script code is invoked. The script finds the module declaration file for the module based on the module name, and builds the call library for the module caller and the additional library that is linked to the module based on the file. The Add-in library contains the interface function address table and module registration function generated by calling script in the system background. In each module's initialization function, a module's registration function is invoked (the function is primarily to register the module's name and interface function Address table addresses to the system). When the module is loaded, the initialization function is called by the system to register the module information to the system, and then the module is managed by the loader.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.