CN101661436B - Dynamic allocation method and device of embedded system memory - Google Patents

Dynamic allocation method and device of embedded system memory Download PDF

Info

Publication number
CN101661436B
CN101661436B CN200910204091XA CN200910204091A CN101661436B CN 101661436 B CN101661436 B CN 101661436B CN 200910204091X A CN200910204091X A CN 200910204091XA CN 200910204091 A CN200910204091 A CN 200910204091A CN 101661436 B CN101661436 B CN 101661436B
Authority
CN
China
Prior art keywords
memory
value
embedded system
consumed
memory size
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN200910204091XA
Other languages
Chinese (zh)
Other versions
CN101661436A (en
Inventor
周玉辉
李仁杰
陈惠林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN200910204091XA priority Critical patent/CN101661436B/en
Publication of CN101661436A publication Critical patent/CN101661436A/en
Application granted granted Critical
Publication of CN101661436B publication Critical patent/CN101661436B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a dynamic allocation method and a device of an embedded system memory. The method comprises the following steps: determining the size of the memory consumed by the operating system of the embedded system; adding up the size of the memory consumed by the operating system and a predetermined value; assigning the added value to a dividing value variable of the embedded system memory used for dynamic allocation; and taking the value of the dividing value variable as the dividing line of the operating system memory and a user memory to initialize the operating system and a user program. Applying the method can effectively and dynamically adapt to the extension of codes and data segments, but the normal running of the version is not influenced, and the use ratio of the available memory of the system user program can be increased.

Description

A kind of embedded system memory dynamic allocation method and device
Technical field
The present invention relates to field of embedded technology, specifically described the embedded system of the reflection that has BOOTLOAD and need to load, a kind of dynamic allocation method of internal memory in reflection.
Background technology
In the embedded system, because often function ratio is more single for the memory management module that operating system provides, at this time the user often develops the memory management module of oneself, increase level diagnosis information, from resource utilization ratio, because all being the user basically, application program writes, so at this moment often except the needed base memory of operating system, all the other all are allocated to user management.And because user's the code and the uncertainty of global variable, determine for the separatrix of operating system and user management internal memory is bad, give the too many words of internal memory of user management, because size of code and global variable resource cause the operating system memory resource not enough after becoming greatly, thereby can not start, often need the test manual modification, and for an exploitation new hand, often do not know reason, and kernel portion can not be debugged often, need expend time in and energy add to be printed and to be diagnosed, and revise normal after, can not prevent that still this class problem from taking place later on again, if and give operating system memory too big, can lack then for user's internal memory, the exploitation of meeting limits application influences the realization of systemic-function.
Summary of the invention
In view of this, fundamental purpose of the present invention is to propose the adaptive reflection internal memory of a kind of internal memory dynamic allocation method, make be loaded into the reflection version by BOOTLOADER after, before the operation of reflection version, know the required internal memory that expends of reflection version operating system, pass to the reflection version then, thereby can determine the separation of operating system required memory and user memory.
The present invention proposes a kind of embedded system memory dynamic allocation method, may further comprise the steps: the memory size that operating system consumed of determining embedded system; With memory size and predetermined value addition that operating system consumed; The value of addition is composed to the cut off value variable that is used for the described embedded system memory of dynamic assignment; Come initialization operation system and user program with the value of cut off value variable as the boundary of operating system memory and user memory.
Wherein, the memory size that operating system consumed of determining embedded system specifically comprises: determine code segment, data segment in the reflection version and the memory size that is consumed with the piece BSS section of sign-on; Determine embedded system initialization files system, task management, message management, the memory size that memory management and equipment control consumed; With above-mentioned two additions, thereby draw the memory size that operating system consumed of described embedded system.
Wherein, if embedded system has memory management unit MMU, then before the step of the memory size that consumed of code segment, data segment and the BSS section in determining the reflection version, also comprise: the physical memory size of obtaining embedded system; Determine the shared internal memory of MMU table according to the system physical internal memory size of being obtained; In addition, in the step of the value of addition being composed to the cut off value variable in the reflection version, also the value with described addition adds that MMU shows shared internal memory and composes to the cut off value variable in the reflection version.
Wherein, the physical memory of embedded system can be machine made, also can be pluggable memory bar.
Wherein, in the step of the value of addition being composed to the cut off value variable in the described reflection version, specifically comprise: the value of addition is stored in core position outside the operating system management of boot-loader device; Operation reflection version program; Obtain the value of the addition of storage from the core position, and the value of addition is composed to the cut off value variable in the reflection version.
Wherein, before the step of the memory size that code segment, data segment and the BSS section in determining the reflection version consumed, further comprising the steps of: the version of will videoing is loaded in the internal memory, and wherein the method for Jia Zaiing comprises: network loads, serial ports loads and FLASH loads.
Wherein, determine embedded system initialization files system, task management, message management, memory size that memory management and equipment control consumed by the test of compiling beta version, the user estimates and the overall addition of driving piles in any mode finish.
The invention allows for a kind of embedded system memory dynamic assignment device, comprising: determination module, the memory size that operating system consumed of embedded system; Computing module is with memory size and predetermined value addition that operating system consumed; The assignment module composes the value of addition to the cut off value variable that is used for the described embedded system memory of dynamic assignment; Initialization module comes initialization operation system and user program with the value of cut off value variable as the boundary of operating system memory and user memory.
Wherein, also comprise: determination module: determine code segment, data segment in the reflection version and the memory size that is consumed with the piece BSS section of sign-on; Determine embedded system initialization files system, task management, message management, the memory size that memory management and equipment control consumed; Computing module:, thereby draw the memory size that operating system consumed of embedded system with above-mentioned two additions.
Wherein, if embedded system has MMU, then device also comprises: acquisition module, obtain the physical memory size of described embedded system; Determination module is determined the shared internal memory of MMU table according to the system physical internal memory size of being obtained; And computing module is with the value and the shared internal memory addition of MMU table of addition.
By above technical scheme as seen, the present invention proposes the method that dynamic assignment reflection version internal memory distributes in a kind of embedded system, the effectively expansion of dynamically adapting code, data segment and do not influence the normal operation of version, and can improve system user program free memory utilization factor.
Description of drawings
Accompanying drawing described herein is used to provide further understanding of the present invention, constitutes the application's a part, and illustrative examples of the present invention and explanation thereof are used to explain the present invention, do not constitute improper qualification of the present invention.In the accompanying drawings:
Fig. 1 is the internal memory distribution schematic diagram of reflection of the present invention;
Fig. 2 is Installed System Memory dynamic assignment self adaptive flow figure;
Fig. 3 is according to device of the present invention.
Embodiment
Technical scheme of the present invention is as follows:
1.BOOTLOADER initialization internal memory hardware dynamically obtains the actual size of system physical internal memory.
2. video internal memory the inside of load application version.
3. determine institute's consumes memory of code segment, data segment, BSS section in the reflection version.
4. if system is the function with MMU management, determine the shared internal memory of MMU table according to physical memory, if do not have, save as zero in then shared.
5. all the other function institute consumes memory of operating system nucleus initialization (because the BSP function is relatively stable, can measure by beta version of compiling, this does not need to finish in program).
6.3, the internal memory total value of 4,5 the insides is exactly the required minimum internal memory that expends of operating system.
7. the internal memory with 6 steps adds an estimation surplus again, can be according to the empirical value of each system oneself.
8. the spent amount of ram of operating system that 7 steps were obtained deposits a position (on the operating system management internal memory that can deposit BOOTLOADER) that is not operated system management ram in.
9. move the reflection version program.
10. the position from the storage of 8 steps obtains the data that 7 steps deposit in, composes the cut off value variable of giving in the reflection version.
11. the reflection version is border initialization operation system and an application program respectively with this cut off value variable.
Internal memory in the above-mentioned steps 1 can be machine made, also can be pluggable memory bar.
The method that BOOTLOADER in the above-mentioned steps 2 loads the reflection version can have multiple mode, includes but not limited to: network loads, serial ports loads, FLASH loads etc.
Reflection version file form can be multiple mode in the above-mentioned steps 3, includes but not limited to: ELF form, AOUT form, COFF form etc.
MMU in above-mentioned steps 4 is the function that optional CPU can have, and differs and establishes a capital needs.
The method that obtains required all the other internal memories of operating system in the above-mentioned steps 5 also can be multiple, includes but not limited to: the test of compiling beta version; Oneself is estimated; The overall addition etc. of driving piles.
Above-mentioned steps 7 estimation surpluses can provide in conjunction with each system's actual conditions.
The position of the storage separatrix size of above-mentioned steps 8 so long as by the BOOTLOADER operating system management to just can.
In addition, the embedded OS in the literary composition includes but not limited to: vxWorks, pSos, Linux etc.
The present invention is further illustrated below in conjunction with the drawings and specific embodiments.
As shown in Figure 2, self-adaptation storage allocation scope comprises following concrete implementation step:
Step 101, BOOT LOADER initialization internal memory.
Step 102 obtains the actual physics memory size.
Step 103, load application version are videoed inside the internal memory.
Step 104 is determined code segment, the data segment in the version reflection, the position and the length of BSS section.
Step 105 is determined all the other internal memories that MMU shows shared internal memory and BOOT system initialization, comprising: embedded system initialization files system, task management, message management, the memory size that memory management and equipment control consumed.
Step 106, the total value of statistic procedure 104 and step 105 and self-defined amount of redundancy.
Step 107, the data that step 106 is obtained deposit the outer internal memory place of BOOT LOADER operating system management in.
Step 108, operation version map program is transferred to Version Control with the CPU control.
Step 109 is read the internal memory cut off value from 107 step core positions, composes and gives the cut off value variable.
Step 110, reflection version with the value of cut off value variable as bounds, initialization operation system and user program.
In certain distributed systems, used the inventive method and done the test code checking.
Master control and ply-yarn drill are used the inventive method respectively, and operating system is vxWorks, and the CPU of master control is PPC750FX or PPC8540, and the CPU of ply-yarn drill is PPC8270 or PPC8347.Can be dynamically according to the code and the global variable of program, the suitable adjustment operating system and the scope of user program managing internal memory have improved the utilization factor and the adaptivity of Installed System Memory.
In addition, the invention allows for a kind of embedded system memory dynamic assignment device, comprising: determination module, the memory size that operating system consumed of embedded system; Computing module is with memory size and predetermined value addition that operating system consumed; The assignment module composes the value of addition to the cut off value variable that is used for the described embedded system memory of dynamic assignment; Initialization module comes initialization operation system and user program with the value of cut off value variable as the boundary of operating system memory and user memory.
Wherein, determination module: determine code segment, data segment in the reflection version and the memory size that is consumed with the piece BSS section of sign-on; Determine embedded system initialization files system, task management, message management, the memory size that memory management and equipment control consumed; Computing module:, thereby draw the memory size that operating system consumed of embedded system with above-mentioned two additions.
If embedded system has MMU, then device also comprises: acquisition module, obtain the physical memory size of described embedded system; Determination module is determined the shared internal memory of MMU table according to the system physical internal memory size of being obtained; And computing module is with the value and the shared internal memory addition of MMU table of addition.
The present invention proposes the method that the reflection of dynamic assignment in a kind of embedded system version internal memory distributes, the effectively expansion of dynamically adapting code, data segment and do not influence the normal operation of version, and can improve system user program free memory utilization factor.
Those skilled in the art should be understood that, above-mentioned each module of the present invention or each step can realize with the general calculation device, they can concentrate on the single calculation element, perhaps be distributed on the network that a plurality of calculation element forms, alternatively, they can be realized with the executable program code of calculation element, thereby, they can be stored in the memory storage and carry out by calculation element, perhaps they are made into each integrated circuit modules respectively, perhaps a plurality of modules in them or step are made into the single integrated circuit module and realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (8)

1. an embedded system memory dynamic allocation method is characterized in that, said method comprising the steps of:
Determine the memory size that operating system consumed of described embedded system;
With memory size and predetermined value addition that described operating system consumed;
The value of described addition is composed to the cut off value variable that is used for the described embedded system memory of dynamic assignment;
Come initialization operation system and user program with the value of described cut off value variable as the boundary of operating system memory and user memory;
Wherein, the memory size that operating system consumed of determining described embedded system specifically comprises:
Determine code segment, data segment in the reflection version and the memory size that is consumed with the piece BSS section of sign-on;
Determine described embedded system initialization files system, task management, message management, the memory size that memory management and equipment control consumed;
With above-mentioned two additions, thereby draw the memory size that operating system consumed of described embedded system.
2. method according to claim 1 is characterized in that, if described embedded system has memory management unit MMU, then before the step of the memory size that consumed of code segment, data segment and the BSS section in determining the reflection version, also comprises:
Obtain the physical memory size of described embedded system;
Determine the shared internal memory of MMU table according to the system physical internal memory size of being obtained;
In addition, in the step of the value of described addition being composed to described cut off value variable, also the value of described addition is added the shared internal memory of the above MMU table and compose to the cut off value variable in the described reflection version.
3. method according to claim 2 is characterized in that, the physical memory of described embedded system can be machine made, also can be pluggable memory bar.
4. method according to claim 1 is characterized in that, in the step of the value of described addition being composed to described cut off value variable, specifically comprises:
The value of described addition is stored in core position outside the operating system management of boot-loader device;
Move described reflection version program;
Obtain the value of the described addition of storage from described core position, and the value of described addition is composed to the cut off value variable in the described reflection version.
5. method according to claim 1 is characterized in that, and is before the step of the memory size that code segment, data segment and the BSS section in determining the reflection version consumed, further comprising the steps of:
Described reflection version is loaded in the internal memory, and the method for wherein said loading comprises: network loads, serial ports loads and FLASH loads.
6. method according to claim 1, it is characterized in that, determine described embedded system initialization files system, task management, message management, memory size that memory management and equipment control consumed by the test of compiling beta version, the user estimates and the overall addition of driving piles in any mode finish.
7. an embedded system memory dynamic assignment device is characterized in that, comprising:
Determination module is determined the memory size that operating system consumed of described embedded system;
Computing module is with memory size and predetermined value addition that described operating system consumed;
The assignment module composes the value of described addition to the cut off value variable that is used for the described embedded system memory of dynamic assignment;
Initialization module comes initialization operation system and user program with the value of described cut off value variable as the boundary of operating system memory and user memory;
Wherein, described determination module:
Determine code segment, data segment in the reflection version and the memory size that is consumed with the piece BSS section of sign-on;
Determine described embedded system initialization files system, task management, message management, the memory size that memory management and equipment control consumed; Described computing module:
With above-mentioned two additions, thereby draw the memory size that operating system consumed of described embedded system.
8. device according to claim 7 is characterized in that, if described embedded system has MMU, then described device also comprises:
Acquisition module obtains the physical memory size of described embedded system;
Described determination module is determined the shared internal memory of MMU table according to the system physical internal memory size of being obtained; And
Described computing module is with the value and the shared internal memory addition of described MMU table of described addition.
CN200910204091XA 2009-09-30 2009-09-30 Dynamic allocation method and device of embedded system memory Expired - Fee Related CN101661436B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200910204091XA CN101661436B (en) 2009-09-30 2009-09-30 Dynamic allocation method and device of embedded system memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200910204091XA CN101661436B (en) 2009-09-30 2009-09-30 Dynamic allocation method and device of embedded system memory

Publications (2)

Publication Number Publication Date
CN101661436A CN101661436A (en) 2010-03-03
CN101661436B true CN101661436B (en) 2011-12-07

Family

ID=41789475

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200910204091XA Expired - Fee Related CN101661436B (en) 2009-09-30 2009-09-30 Dynamic allocation method and device of embedded system memory

Country Status (1)

Country Link
CN (1) CN101661436B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101937402A (en) * 2010-09-08 2011-01-05 无锡中星微电子有限公司 Memory management method
CN104216781B (en) * 2013-05-29 2019-10-08 上海联影医疗科技有限公司 Video memory distribution method and system
CN104679666A (en) * 2013-12-02 2015-06-03 上海联影医疗科技有限公司 Embedded system memory management method and management system
CN105785824B (en) * 2016-04-12 2020-02-11 上海斐讯数据通信技术有限公司 Method and system for transmitting memory size parameters to Linux kernel
TWI587133B (en) * 2016-05-20 2017-06-11 慧榮科技股份有限公司 A page alignment method for data storage device and a look up table production method thereof
CN107247673B (en) * 2017-06-07 2020-05-26 苏州浪潮智能科技有限公司 Memory allocation method and device
CN109614056B (en) * 2018-12-28 2021-11-23 杭州迪普科技股份有限公司 Method and device for coping with natural aging of memory

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5594903A (en) * 1991-02-26 1997-01-14 Lynx Real-Time Systems, Inc. Operating System architecture with reserved memory space resident program code identified in file system name space
CN1776619A (en) * 2005-12-15 2006-05-24 北京中星微电子有限公司 Method for realizing embedded system run based on start loading programme
CN1869922A (en) * 2005-05-27 2006-11-29 青岛大学 Resource management device of built-in real-time operation system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5594903A (en) * 1991-02-26 1997-01-14 Lynx Real-Time Systems, Inc. Operating System architecture with reserved memory space resident program code identified in file system name space
CN1869922A (en) * 2005-05-27 2006-11-29 青岛大学 Resource management device of built-in real-time operation system
CN1776619A (en) * 2005-12-15 2006-05-24 北京中星微电子有限公司 Method for realizing embedded system run based on start loading programme

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李岩 等.基于S3C44B0X的uClinux操作系统内核移植.《哈尔滨理工大学学报》.2006,第11卷(第2期),第74页-第75页. *

Also Published As

Publication number Publication date
CN101661436A (en) 2010-03-03

Similar Documents

Publication Publication Date Title
CN101661436B (en) Dynamic allocation method and device of embedded system memory
US8756591B2 (en) Generating compiled code that indicates register liveness
US20060129852A1 (en) Bios-based systems and methods of processor power management
US9916165B2 (en) Systems and methods to optimize boot for information handling system comprising persistent memory
US9710179B2 (en) Systems and methods for persistent memory timing characterization
KR20080075870A (en) Method, system and computer program for metering usage of software products based on real-time benchmarking of processing power
CN103927187A (en) Program execution method of embedded system
US7921247B1 (en) Sharing a dynamically located memory block between components executing in different processor modes in an extensible firmware interface environment
CN108710583A (en) Management method, device, computer equipment and the medium in SSD write buffers area
CN107408090A (en) The dynamic configuration of i/o controller access path
CN104156234A (en) Multi-core processor starting and bootloader big-little endian mode adapting method device
CN103348333A (en) Methods and apparatus for efficient communication between caches in hierarchical caching design
US10996876B2 (en) Systems and methods for dynamically modifying memory namespace allocation based on memory attributes and application requirements
CN114090498A (en) Method for realizing mutual decoupling of multi-core starting and service of embedded SOC (system on chip)
CN105739982B (en) A kind of method and device of system suspend mode
CN102622257A (en) On-line meter self-updating method and device
US10133654B1 (en) Firmware debug trace capture
US8799625B2 (en) Fast remote communication and computation between processors using store and load operations on direct core-to-core memory
CN113760543A (en) Resource management method and device, electronic equipment and computer readable storage medium
EP2876557B1 (en) Detecting a read access to unallocated or uninitialized memory
US10942880B2 (en) Aging tolerant system design using silicon resource utilization
US8078637B1 (en) Memory efficient peim-to-peim interface database
US7577814B1 (en) Firmware memory management
US20100083269A1 (en) Algorithm for fast list allocation and free
CN109656720B (en) Address space allocation method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20111207

Termination date: 20190930

CF01 Termination of patent right due to non-payment of annual fee