Two-Stage Link Process for Shared Memory Allocation in Multi-Core Embedded Systems
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In multi-core embedded systems without a memory management unit (MMU) or common operating system instance, managing shared memory for programs that symbolically refer to each other's data/code is challenging, as the linker cannot allocate correct memory addresses for shared symbols at build time.
Innovation Solution
A two-stage link process is implemented, where in the first stage, shared memory addresses are allocated to symbols and stored in a library, and in the second stage, executable code and initialized data are generated for non-shared code/data, linked to the shared data/code via these addresses, ensuring correct memory allocation and sharing between programs.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Manufacturing precision
If a single-stage linking process is used for multi-core embedded systems, then the build process is simple and fast, but the linker cannot allocate correct memory addresses for shared symbols between programs
Solution Approach 1:
The linking process is divided into two distinct stages: a first link stage that processes non-shared symbols and generates initial object files, and a second link stage that processes shared symbols and generates final executables. This segmentation allows each stage to focus on specific tasks, ensuring correct memory address allocation for shared symbols while maintaining overall process manageability.
Solution Approach 2:
The first link stage performs preliminary processing by allocating memory addresses to non-shared symbols and generating intermediate object files before the second link stage. This preliminary action prepares the groundwork for the subsequent shared symbol linking, ensuring that when shared symbols are processed, all other symbols have already been assigned their final memory addresses.
2Productivity
If programs share data/code through symbolic references in embedded systems, then memory sharing efficiency is improved, but the linker cannot determine correct memory addresses at build time
Solution Approach 1:
The first link stage performs preliminary processing by allocating memory addresses to all non-shared symbols and generating intermediate object files. This preliminary action ensures that when the second link stage processes shared symbols, all other symbols have already been assigned their final memory addresses, enabling correct resolution of symbolic references.
Solution Approach 2:
The two-stage linking process acts as an intermediary mechanism between the need for symbolic references (for memory sharing) and the requirement for definite memory addresses (for correct access). The intermediate object files produced in the first stage serve as a mediator, containing placeholder information that is resolved in the second stage with actual memory addresses.
3Device complexity
If memory is shared between programs without a MMU or common OS instance, then system complexity is reduced, but managing shared memory addresses becomes challenging
Solution Approach 1:
The linking process is segmented into two stages, with the first stage handling non-shared symbols and the second stage handling shared symbols. This segmentation simplifies the overall task by breaking it into manageable parts, making shared memory management easier despite the absence of a MMU or common OS instance.
Solution Approach 2:
The linker driver automatically manages the two-stage linking process, including generating appropriate linker scripts and coordinating the linking of shared and non-shared symbols. This self-service approach to shared memory management eliminates the need for manual address allocation or complex runtime management mechanisms.
Data Source
AI summary
Methods for generating executable files for two or more independent programs to be run on separate processor cores of an embedded system wherein the programs share data/code via shared memory by symbolically referring to data/code generated by another program. The methods implement a two-stage link process. In the first link stage addresses in shared memory are allocated to the shared code and data of the independent programs, and the allocated memory addresses are stored in a library. In a second link stage executable code and initialized data is generated for the non-shared code and initialized data of each independent program which is linked to the shared data/code by the addresses in the library.


