Method for executing an in-line code memory architecture and memory architecture system
By designing a module manager and hardware function interface modules, the problem of strong binding between the operating system kernel and controller hardware in embedded software architecture is solved, enabling flexible allocation and management of resources and improving code quality and consistency.
Patent Information
- Application Number
- CN202311589289.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-24
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-11-24
AI Technical Summary
In existing embedded software architecture solutions, the strong binding between the operating system kernel and the controller hardware leads to a large workload for porting and testing verification, and the lack of mandatory constraints on the allocation of task execution resources results in resource waste or abnormal access.
The design employs a module manager and hardware function interface modules. The unified module manager allocates MCU time slices and memory resources for code modules as needed, and uses interrupt switches and atomic variable locking operations to achieve resource constraints and management.
It simplifies the porting and testing process, ensures consistent code quality, reduces the risk of abnormal memory allocation and access, and improves the quality of the project code.
Smart Images

Figure CN117762610B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of embedded system software, specifically relating to an embedded code memory architecture design method and memory architecture system. Background Technology
[0002] Embedded software architecture solutions use operating system kernels for task scheduling, memory management, semaphore management, etc. Each functional module and task uses the operating system to provide resources and methods. However, the above solutions have the following problems: existing technologies use a strong binding between the underlying code of the operating system kernel and the controller hardware, which makes the porting and testing work very laborious. Furthermore, there is no mandatory constraint on the allocation of resources for task execution, which leads to the waste of resources or abnormal access during the collaboration of multiple modules. Summary of the Invention
[0003] The purpose of this invention is to provide an embedded code memory architecture design method and a memory architecture system.
[0004] To address the aforementioned technical problems, this invention provides an embedded code memory architecture system, comprising:
[0005] At least one code module, wherein the code module stores code module initialization constant parameters and code module initialization sub-functions;
[0006] The hardware function interface module is configured to include an interrupt switch interface and an atomic variable lock / unlock operation interface;
[0007] The module manager is configured to initialize constant parameters to allocate atomic variables corresponding to each task, allocate MCU time slice resources to code modules through time slice allocation sub-functions, and / or allocate memory runtime resources to code modules through architecture initialization sub-functions; whereby...
[0008] The module manager's initialization constant parameters, time slice allocation sub-function, and architecture initialization sub-function are all stored in the module manager.
[0009] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained through the structures particularly pointed out in the description and the drawings.
[0010] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0011] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0012] Figure 1 A schematic diagram of the structure of a code package in an embedded code-memory architecture system according to some embodiments is shown;
[0013] Figure 2 The diagram shows a schematic representation of the module manager structure in a code package as described in some embodiments;
[0014] Figure 3 The diagram shows a schematic representation of the structure of code modules in a code package involved in some embodiments;
[0015] Figure 4 The diagram shows a structural schematic of the hardware function interface module in the code package involved in some embodiments;
[0016] Figure 5 The diagram illustrates how some embodiments involve allocating MCU time slice resources to various code modules to perform tasks.
[0017] Figure 6 The module manager shown in some embodiments also constrains the initialization process of the memory runtime resources of code modules;
[0018] Figure 7 The module manager shown in some embodiments also constrains the execution of memory resources of code modules;
[0019] Figure 8 Schematic diagrams of the apparatus involved in some embodiments are shown. Detailed Implementation
[0020] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0021] Embedded software architecture solutions often employ task scheduling, memory management, and semaphore management based on the operating system kernel. Each functional module and task utilizes resources and methods provided by the operating system. However, this approach suffers from the following problems:
[0022] 1. The operating system kernel's low-level code and the controller hardware are strongly bound together. In addition to interrupt switches and atomic locks, its hardware-related functional interfaces also include process stack management, process switching, etc. Specific code needs to be written at the assembly language level for the controller kernel, which makes porting and testing a large workload.
[0023] 2. Failure to enforce resource allocation for task execution leads to wasted resources or abnormal access during multi-module collaboration.
[0024] To solve the above technical problems, such as Figures 1 to 4 As shown, at least one embodiment provides an embedded code-memory architecture system, including:
[0025] At least one module manager is configured to store module manager initialization constant parameters, code module query subfunction, time slice allocation subfunction, architecture initialization subfunction, and memory allocation subfunction.
[0026] At least one hardware function interface module is configured to include an interrupt switch interface and an atomic variable lock / unlock operation interface.
[0027] At least one code module is configured to store code, as well as periodically called sub-functions, a code module static memory usage calculation sub-function, and a code module initialization sub-function.
[0028] In some embodiments, the module manager, hardware function interface module, and at least one code module may be provided to the program developer in the form of being integrated into a code package.
[0029] like Figure 5 As shown, some embodiments illustrate the process of allocating MCU time slice resources to various code modules for task execution as follows:
[0030] The module manager initializes constant parameters to allocate atomic variables corresponding to each task. It is also configured to constrain the MCU (MicrocontrollerUnit) time slice resources of the code modules through the architecture initialization sub-function. That is, when the interrupt switch interface and atomic variable lock / unlock operation interface are called through the above time slice allocation sub-function to perform interrupt switch and atomic variable lock operations, the interrupt switch is turned off, the atomic variable is attempted to be locked, the interrupt switch is restored, and the atomic variable is checked to see if it is locked. If it is locked, the MCU time slice resources are allocated to each code module to execute the task, and the atomic variable is unlocked after the task of the corresponding code module is completed.
[0031] In some embodiments, the process of allocating atomic variables corresponding to each task through the module manager initialization constant parameters is as follows: the module manager initialization constant parameters are set as follows: the system memory is configured to have 8 modules, where modules 0 to 3 belong to task a, and modules 4 to 7 belong to data task b. Then, atomic variables are created for a and b respectively to complete the process of allocating atomic variables corresponding to each task.
[0032] At least one implementation provides an execution method for an embedded code memory architecture, wherein a module manager constrains the MCU time-slice resources of code modules through a time-slice allocation sub-function; and / or the module manager constrains the memory runtime resources of code modules through an architecture initialization sub-function; wherein constraining the MCU time-slice resources of code modules through a time-slice allocation sub-function by the module manager includes: when the module manager calls the interrupt switch interface and the atomic variable lock / unlock operation interface through the time-slice allocation sub-function to perform interrupt switch and atomic variable locking operations, the interrupt switch is turned off, an attempt is made to lock the atomic variable, and the interrupt switch is restored, and the atomic variable is checked to see if it is locked; if it is locked, the MCU time-slice resources are allocated to each code module to execute tasks, and the atomic variable is unlocked after the tasks of the corresponding code modules are completed.
[0033] This execution method provides module interface design requirements. Through a unified module manager, it allocates runtime and memory resources for each module as needed based on user initialization parameters. To address the two issues mentioned above, the embedded code memory architecture corresponding to this method only needs to rely on two hardware binding functions: interrupt switching and atomic variable locks, which facilitates portability and testing. Furthermore, it can effectively constrain the code quality developed by embedded engineers of different levels, ensure the consistency of external interfaces of code produced by different personnel, reduce the risks caused by abnormal memory allocation / access, and improve the quality of project code.
[0034] In some embodiments, the code module stores a periodically called sub-function. The input parameters of the periodically called sub-function include: a module manager pointer, a code module index number, and a current system runtime parameter. The module manager pointer is obtained by the architecture initialization sub-function. The code module index number is provided during initialization when an event occurs. The current system runtime parameter is provided by the code user, such as 10ms, which is a parameter in milliseconds. Specifically, after the atomic variable is locked, the method for allocating MCU time slice resources to each code module to execute tasks includes: executing the MCU time slice resources of the calling code module cycle through the periodically called sub-function; obtaining the current code module's own pointer within the MCU time slice using the module manager pointer and the code module index number; and executing the code cycle logic based on the current code module's own pointer and the current system runtime parameter. The cycle logic includes calculation results obtainable by code operation instructions, such as communication with the bus, I / O management, and reading / writing storage information.
[0035] In some embodiments, the periodic calling sub-function is described as follows, taking the Ethernet MAC module as an application scenario:
[0036]
[0037]
[0038] In some embodiments, the module manager further stores a code module query subfunction and a time slice allocation subfunction; wherein the module manager initialization constant parameters further include: the number of running task indices; the input parameters of the code module query subfunction include: a module manager pointer and a code module index number; its output parameter is a query code module pointer; the input parameters of the time slice allocation subfunction include: a module manager pointer, a running task index number, and a current system runtime parameter; the time slice allocation subfunction calls the periodic call subfunctions of all code modules related to the running task index number, and the periodic call subfunctions use the code module query subfunction to query the code module pointers according to the module manager pointer and the code module index number to execute the code cycle logic.
[0039] In some embodiments, the order in which each code module calls the MCU time slice is determined based on the execution frequency and execution phase in the code module initialization constant parameters. The code module initialization parameters include the call cycle and phase, and the module manager calls the corresponding code module's periodic sub-function according to the parameter definition in the corresponding time slice.
[0040] In some embodiments, the time slice allocation sub-function is described as follows:
[0041]
[0042]
[0043]
[0044]
[0045] like Figure 6 As shown, in some embodiments, the module manager constrains the memory runtime resources of the code module through the architecture initialization sub-function, including: the module manager also stores the architecture initialization sub-function; the architecture initialization sub-function implements memory runtime resource constraints through the code module initialization constant parameters and the code module initialization sub-function in the code module.
[0046] In some embodiments, the module manager initialization constant parameters further include: the number of memory pools, the starting address of each memory pool, and the length parameter (total length of the memory pool); and the architecture initialization subfunction creates its own module manager, checks whether the memory pool number of each code module exceeds the number of memory pools, allocates the required static memory from the corresponding memory pool according to the memory pool number of each code module, and executes the initialization subfunction of each code module to complete the memory initialization allocation of each code module; the module manager also includes a memory allocation subfunction; the input parameters of the memory allocation subfunction include: a module manager pointer, the requested memory pool number, the length of the required memory, and the total length of the memory pool. The memory allocation sub-function specifies the memory address alignment requirements. The output parameter is the allocated memory address. It obtains the starting address of the memory pool using the module manager pointer and the requested memory pool number. Based on this address, it adds the length of the already allocated memory as the allocated memory address. If the allocated memory address does not meet the memory address alignment requirements, padding bits are added until the alignment requirements are met. If, starting from this address and adding the required memory length, the result does not exceed the total length of the memory pool, the memory resource is locked using interrupt disabling and atomic locking, and the allocation process is executed. This address becomes the allocated memory address. After allocation, the atomic lock is released and the interrupt state is restored.
[0047] In some embodiments, the memory allocation sub-function is described as follows:
[0048]
[0049]
[0050]
[0051]
[0052] The code module also stores code module initialization constant parameters and a code module static memory usage calculation subfunction. The code module initialization constant parameters include: code module function-defined parameters. The input parameters of the code module static memory usage calculation subfunction include: a module manager pointer, module constant initialization parameters, and an output of the code module static segment memory usage calculation result. The code module static memory usage calculation subfunction obtains the code module static segment memory usage calculation result through the module manager pointer and module constant initialization parameters. The input parameters of the code module initialization subfunction include: a module manager pointer, module constant initialization parameters, a pointer to the code module itself, and an output parameter indicating whether initialization was successful. The code module initialization subfunction calculates the required memory length based on the module constant initialization parameters and passes this memory length and the module manager pointer to the memory allocation subfunction to allocate dynamic segment memory as needed. During the allocation process, atomic locks and interrupt switches are used to prevent concurrent access exceptions. The return address is stored in the memory space where the pointer to the code module exists, and the corresponding memory initialization allocation operation is performed. The code module static segment memory usage and dynamic segment memory constitute the memory operating resources of the code module.
[0053] In some embodiments, the sub-function for calculating the static memory usage of the code module is described as follows, taking the Ethernet MAC module as an application scenario:
[0054]
[0055]
[0056]
[0057]
[0058] Some embodiments also provide a computer-readable storage medium storing computer-readable instructions that, when executed by at least one processor, cause an execution method of an embedded code memory architecture to be executed; the execution method of the embedded code memory architecture includes: setting at least one code package, the code package including a module manager, a hardware function interface module, and at least one code module; the module manager is configured to constrain the MCU time slice resources of the code module through time slice allocation sub-functions, and / or the module manager constrains the memory runtime resources of the code module through architecture initialization sub-functions.
[0059] Some embodiments also provide a computer program product, including a computer program or instructions, wherein when the computer program or instructions are executed on a computer, an execution method of an embedded code memory architecture is executed; the execution method of the embedded code memory architecture includes: setting at least one code package, the code package including a module manager, a hardware function interface module, and at least one code module; the module manager is configured to constrain the MCU time slice resources of the code module through time slice allocation sub-functions, and / or constrain the memory runtime resources of the code module through architecture initialization sub-functions.
[0060] Some embodiments also provide a computer program product including a computer-readable storage medium having computer-readable program code stored thereon, the computer-readable program code including instructions that cause at least one processor (one or more computer devices) to perform the following operations: setting up at least one code package, the code package including a module manager, a hardware function interface module, and at least one code module; the module manager being configured to constrain MCU time slice resources of the code module through time slice allocation sub-functions, and / or constrain the memory runtime resources of the code module through architecture initialization sub-functions.
[0061] Some embodiments also provide an apparatus comprising: at least one memory and at least one processor, wherein the memory stores computer-executable instructions, which, when executed by the processor, cause the processor to perform an execution method of an embedded code memory architecture; the execution method of the embedded code memory architecture includes: setting at least one code package, the code package including a module manager, a hardware function interface module, and at least one code module; the module manager is configured to constrain the MCU time slice resources of the code module through time slice allocation sub-functions, and / or constrain the memory runtime resources of the code module through architecture initialization sub-functions.
[0062] In some embodiments, the device may be an embedded control device or a microcontroller control device, including at least one memory and at least one processor.
[0063] The execution method, system, and device of this embedded code memory architecture meet the module interface design requirements. Through a unified module manager, the runtime and memory resources of each module are allocated as needed based on user initialization parameters. Based on this architecture, the code quality developed by embedded engineers of different skill levels can be effectively constrained, ensuring consistency of external interfaces in code produced by different personnel, reducing the risks caused by abnormal memory allocation / access, and improving the quality of project code.
[0064] In some embodiments, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0065] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0066] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0067] Based on the above-described preferred embodiments of the present invention, and through the foregoing description, those skilled in the art can make various changes and modifications without departing from the inventive concept. The technical scope of this invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.
Claims
1. An embedded code memory architecture system, characterized in that, include: At least one code module, wherein the code module stores code module initialization constant parameters and code module initialization sub-functions; The hardware function interface module is configured to include an interrupt switch interface and an atomic variable lock / unlock operation interface; The module manager is configured to allocate atomic variables corresponding to each task through constant parameters initialization, constrain the MCU time slice resources of the code module through time slice allocation sub-functions, and constrain the memory runtime resources of the code module through architecture initialization sub-functions. in The module manager's initialization constant parameters, time slice allocation sub-function, and architecture initialization sub-function are all stored in the module manager; as well as Constraining the MCU time slice resources of the code module through time slice allocation sub-functions includes: When the interrupt switch interface and atomic variable lock / unlock operation interface are called through the time slice allocation subfunction to perform interrupt switch and atomic variable lock operations, the interrupt switch is turned off, the atomic variable is attempted to be locked, the interrupt switch is restored, and the atomic variable is checked to see if it is locked. If it is locked, the MCU time slice resources are allocated to each code module to execute tasks, and the atomic variable is unlocked after the tasks of the corresponding code module are completed. The architecture initializes the sub-function to constrain the memory runtime resources of the code module, including: The architecture initialization sub-function implements memory runtime resource constraints by initializing constant parameters through the code module initialization sub-function and the code module initialization sub-function. The module manager initialization constant parameters also include: the number of memory pools, the starting address of each memory pool, and the length parameters; and The architecture initialization subfunction creates its own module manager, checks whether the memory pool number of each code module exceeds the memory pool limit, allocates the required static memory from the corresponding memory pool according to the memory pool number of each code module, and executes the initialization subfunction of each code module to complete the memory initialization allocation of each code module. The module manager also stores memory allocation sub-functions; The input parameters of the memory allocation sub-function include: module manager pointer, requested memory pool number, required memory length, and memory address alignment requirements; the output parameter is the allocated memory address. The memory allocation sub-function obtains the starting address of the memory pool through the module manager pointer and the requested memory pool number, and adds the length of memory that has already been allocated to this address to obtain the allocated memory address; If the allocated memory address does not meet the memory address alignment requirements, padding bits are added until the memory address alignment requirements are met. If the length of the required memory added from this address does not exceed the total length of the memory pool, the memory resource is locked by disabling interrupts and using atomic locking, and the allocation process is executed. This address is then the allocated memory address. After allocation is completed, the atomic lock is released and the interrupt status is restored.
2. The embedded code memory architecture system according to claim 1, characterized in that, The code module stores periodically called sub-functions; The input parameters for the periodically called sub-function include: module manager pointer, code module index number, and current system runtime parameter; Methods for allocating MCU time-slice resources to various code modules to execute tasks after atomic variables are locked include: The MCU time slice resources of the calling code module are executed through the periodic call sub-function. Within the MCU time slice, the pointer of the current code module itself is obtained through the module manager pointer and the code module index number, and the code cycle logic is executed according to the pointer of the current code module itself and the current system runtime parameters.
3. The embedded code memory architecture system according to claim 2, characterized in that, The module manager also stores code module query sub-functions; in The module manager initialization constant parameters also include: the number of running task indexes; The input parameters of the code module query sub-function include: a module manager pointer and a code module index number; its output parameter is the pointer to the query code module. The input parameters for the time slice allocation subfunction include: a module manager pointer, the running task index number, and the current system runtime parameter; The time slice allocation subfunction calls the periodic call subfunctions of all code modules related to the running task index number. The periodic call subfunctions use the code module query subfunction to query the code module pointer based on the module manager pointer and the code module index number to execute the code cycle logic.
4. The embedded code memory architecture system according to claim 3, characterized in that, The order in which each code module calls the MCU time slice is determined by the execution frequency and execution phase in the code module's initialization constant parameters.
5. The embedded code memory architecture system according to claim 1, characterized in that, The code module also stores code module initialization constant parameters and code module static memory usage calculation sub-function; in The code module initializes constant parameters including: Custom parameters for code module functionality; and The code module static memory usage calculation sub-function obtains the code module static segment memory usage calculation result through the module manager pointer and module constant initialization parameters; The input parameters of the code module initialization subfunction include: a module manager pointer, module constant initialization parameters, a pointer to the code module itself, and an output parameter indicating whether the initialization was successful. The code module initialization subfunction calculates the required memory length based on the module constant initialization parameters, and passes this memory length and the module manager pointer to the memory allocation subfunction to allocate dynamic segment memory as needed. It then stores the return address in the memory space where its own pointer resides and performs the corresponding memory initialization and allocation operations. The static segment memory usage and dynamic segment memory usage of the code module constitute the memory operating resources of the code module.
6. A method for executing embedded code in memory architecture, characterized in that, include The module manager allocates MCU time slice resources to code modules through time slice allocation sub-functions; The module manager constrains the memory and runtime resources of code modules through the architecture initialization sub-function; in The MCU time slice resources of the code module constrained by the time slice allocation sub-function of the module manager include: When the interrupt switch and atomic variable locking operations are performed by calling the interrupt switch interface and atomic variable lock / unlock operation interface in the hardware function interface module through the time slice allocation subfunction in the module manager, the interrupt switch is turned off, an attempt is made to lock the atomic variable, and the interrupt switch is restored to check if the atomic variable is locked; if it is locked, the MCU time slice resources are allocated to each code module to execute tasks, and the atomic variable is unlocked after the tasks of the corresponding code modules have been completed; and The constraint of memory runtime resources for code modules by the module manager through the architecture initialization sub-function includes: The architecture initialization subfunction implements memory runtime resource constraints through constant parameters initialized in the code module and the code module initialization subfunction in the code module. The module manager initialization constant parameters also include: the number of memory pools, the starting address of each memory pool, and the length parameters; and The architecture initialization subfunction creates its own module manager, checks whether the memory pool number of each code module exceeds the memory pool limit, allocates the required static memory from the corresponding memory pool according to the memory pool number of each code module, and executes the initialization subfunction of each code module to complete the memory initialization allocation of each code module. The module manager also stores memory allocation sub-functions; The input parameters of the memory allocation sub-function include: module manager pointer, requested memory pool number, required memory length, and memory address alignment requirements; the output parameter is the allocated memory address. The memory allocation sub-function first obtains the starting address of the memory pool through the module manager pointer and the requested memory pool number, and then adds the length of the memory that has already been allocated as the memory address after allocation; If the allocated memory address does not meet the memory address alignment requirements, padding bits are added until the memory address alignment requirements are met. If the length of the required memory added from this address does not exceed the total length of the memory pool, the memory resource is locked by disabling interrupts and using atomic locking, and the allocation process is executed. This address is then the allocated memory address. After allocation is completed, the atomic lock is released and the interrupt status is restored.
7. The execution method according to claim 6, characterized in that, The code module stores periodically called sub-functions; The input parameters for the periodically called sub-function include: module manager pointer, code module index number, and current system runtime parameter; Methods for allocating MCU time-slice resources to various code modules to execute tasks after atomic variables are locked include: The MCU time slice resources of the calling code module are executed through the periodic call sub-function. Within the MCU time slice, the pointer of the current code module itself is obtained through the module manager pointer and the code module index number, and the code cycle logic is executed according to the pointer of the current code module itself and the current system runtime parameters.
8. The execution method according to claim 7, characterized in that, The module manager also stores code module query sub-functions; in The module manager initialization constant parameters also include: the number of running task indexes; The input parameters of the code module query sub-function include: a module manager pointer and a code module index number; its output parameter is the pointer to the query code module. The input parameters for the time slice allocation subfunction include: a module manager pointer, the running task index number, and the current system runtime parameter; The time slice allocation subfunction calls the periodic call subfunctions of all code modules related to the running task index number. The periodic call subfunctions use the code module query subfunction to query the code module pointer based on the module manager pointer and the code module index number to execute the code cycle logic.
9. The execution method according to claim 8, characterized in that, The order in which each code module calls the MCU time slice is determined by the execution frequency and execution phase in the code module's initialization constant parameters.
10. The execution method according to claim 6, characterized in that, The code module also stores code module initialization constant parameters and a sub-function for calculating the static memory usage of the code module; wherein The code module initializes constant parameters including: Custom parameters for code module functionality; and The code module static memory usage calculation sub-function obtains the code module static segment memory usage calculation result through the module manager pointer and module constant initialization parameters; The input parameters of the code module initialization subfunction include: a module manager pointer, module constant initialization parameters, a pointer to the code module itself, and an output parameter indicating whether the initialization was successful. The code module initialization subfunction calculates the required memory length based on the module constant initialization parameters, and passes this memory length and the module manager pointer to the memory allocation subfunction to allocate dynamic segment memory as needed. It then stores the return address in the memory space where its own pointer resides and performs the corresponding memory initialization and allocation operations. The static segment memory usage and dynamic segment memory usage of the code module constitute the memory operating resources of the code module.
11. A computer-readable storage medium storing computer-readable instructions that, when executed by at least one processor, cause the execution method of the embedded code memory architecture as described in any one of claims 6-10 to be executed.
12. An apparatus, characterized in that, include: At least one memory and at least one processor, wherein The memory stores computer-executable instructions that, when executed by a processor, cause the processor to perform the embedded code memory architecture as described in any one of claims 6-10.
Citation Information
Patent Citations
Multi-core RISV-CPU simulator based on Rust
CN113609066A
Embedded software generation method and system based on real-time operating system
CN115934423A
