Dynamic Relocatable File Loading via Veneer Code for Embedded Systems
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Dynamic loading of applications in embedded microkernel operating systems fails due to excessive address distance between function caller and callee exceeding the range of short skipping, leading to errors and inefficiencies in application development and debugging.
Innovation Solution
A method and device for dynamically loading relocatable files, which analyzes and recombines the file, calculates memory requirements, and adds veneer code to transform short skipping into effective short and long skipping instructions, enabling relocation loading even when the calling distance exceeds the short skipping range.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If dynamic loading is implemented in embedded microkernel operating systems, then software development efficiency is improved and hardware resources are saved, but the relocation process fails when the address distance between function caller and callee exceeds the range of short skipping
Solution Approach 1:
The patent introduces a veneer code as an intermediary component between the function caller and callee. When the address distance exceeds the short skipping range, the veneer code acts as a mediator that contains a long skipping instruction to bridge the gap, enabling successful relocation without compromising the dynamic loading process
Solution Approach 2:
The patent dynamically changes the skipping parameter based on the address distance. When the distance is within the short skipping range, it uses short skipping instructions for efficiency. When the distance exceeds the range, it switches to long skipping instructions via veneer code, thus adapting the relocation mechanism to the specific address distance scenario
2Reliability
If static linking is used for application development, then the application can run on the mobile phone, but the file size increases hardware resource requirements and code modification requires complete re-linking and re-burning
Solution Approach 1:
The patent segments the application into a static platform part and a dynamic relocatable file part. The static platform contains core system functions, while the relocatable file contains application-specific code that can be independently modified, loaded, and executed without affecting the entire system
Solution Approach 2:
The patent performs preliminary linking of the application code with the static platform at compile time, generating a relocatable file with placeholder references. This preliminary action allows the code to be prepared in advance without complete linking, enabling faster modifications by only re-compiling and re-loading the relocatable file portion
3Adaptability or versatility
If the entire mobile phone version is re-linked and re-burned each time code is modified, then the application can be updated, but the burning time increases and debugging efficiency decreases
Solution Approach 1:
The patent extracts the application code from the complete mobile phone version, placing it in a separate relocatable file. This extraction allows only the necessary application portion to be re-linked and re-loaded during updates, rather than re-burning the entire system image, thus significantly reducing burning time
Data Source
Figure 1
Figure 2
Figure 3
AI summary
The disclosure provides a method for dynamically loading a relocatable file, comprising: analyzing the relocatable file; searching for a relocation section according to the information obtained through the analysis; obtaining a relocation target address after the relocation section is found and calculating an address to be relocated and a skipping distance; determining whether the skipping distance exceeds a range of a short skipping, and if the skipping distance does not exceed the range of the short skipping, then writing the relocation target address into the address to be relocated to perform relocation loading; if the skipping distance exceeds the range of the short skipping, then adding a veneer code segment and making the skipping whose distance exceeds the range of the short skipping indirectly skip to the relocation target address to perform relocation loading. Accordingly, the disclosure provides a device for dynamically loading a relocatable file, comprising: an analyzing module, a calculating module, a searching module, a determining module, and a relocation dynamic loading module. With the solution, dynamically loading a relocatable file can be realized when the calling distance of a function exceeds the range of the short skipping.