CN102955707A - Method for mutual loading of drive program and application program based on foreground-background system - Google Patents
Method for mutual loading of drive program and application program based on foreground-background system Download PDFInfo
- Publication number
- CN102955707A CN102955707A CN2011102554821A CN201110255482A CN102955707A CN 102955707 A CN102955707 A CN 102955707A CN 2011102554821 A CN2011102554821 A CN 2011102554821A CN 201110255482 A CN201110255482 A CN 201110255482A CN 102955707 A CN102955707 A CN 102955707A
- Authority
- CN
- China
- Prior art keywords
- application program
- space
- driver
- program
- application
- 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.)
- Pending
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
The invention provides a method for mutual loading of a drive program and an application program based on a foreground-background system. The method comprising the following steps of: distributing a drive code area and an application code area in an ROM (read only memory) space; distributing a drive layer space, an application layer space and a program interaction area for the drive program and the application program in an RAM (random access memory) space; and writing entry addresses of a function in the program interaction area, and establishing a drive mapping table by means of compiling, wherein the drive mapping table comprises the one-to-one correspondence relationship between the entry addresses of the function and program codes, and the drive program and the application program are mutually called via the drive mapping table. With the adoption of the scheme, the running of the drive program and the running of the application program can be separated, so that only the application part can be updated during program update, thus shortening software update time; and the method has the advantages of increasing life, reducing expense, and the like.
Description
Technical field
The present invention relates generally to a kind of embedded software developing, refers in particular to a kind of method that realizes that driver and application program load mutually.
Background technology
Development along with the consumption electronic product technology, the continuous change of function is large, the size of code of program is also increasing, how effectively software is safeguarded it is very stubborn problem of one of Developmental Engineer, particularly increasing product is all with functions such as remote updates, remote update speed (particularly wireless) also becomes a standard weighing product day by day, in the AM/BAM system, if fixed part software can be separated with new portion software more, not only improve greatly updating speed, and reduced greatly the clear superiorities such as upgrading failure cause that caused by uncertain factor in the escalation process.
Summary of the invention
For solving the slow-footed problem of above-mentioned AM/BAM system upgrade, the invention provides a kind of method of the mutual loading based on AM/BAM system driver and application program, comprising:
Steps A: in the ROM space, minute be used in the driving code area of depositing driver code and be used for the application code district of depositing application code;
Step B: in ram space, distribute the driving sheaf space be used to the driver operation that the space is provided, be used to application program provide running space the application layer space, be used for depositing the program interaction district of driver function entrance address and application program function entrance address;
Step C: the entry address of function is write described program interaction district, set up the driving mapping table by compiling, described driving mapping table comprises the one-to-one relationship of function entrance address and program code, and driver and application program are called mutually by described driving mapping table.
Wherein, described steps A also is included in the ROM space distributes the protected location, and described protected location is driving between code area and the application code district.
Wherein, described step B also is included in to divide in the ram space and is used in for driver and the shared stack space of application program operation.
Wherein, among the described step C driver and application program mutually to call be that mode by defmacro realizes.
Wherein, also comprise:
Step D: described each among the described step C grandly is encapsulated as a function, offers calling of other utility functions.
Wherein, comprise that also the described step of safeguarding comprises driving increase, deletion or the modification of mapping table to driving the step of safeguarding of mapping table.
Wherein, described step B also is included in and distributes the Vector interrupt vector table in the ram space, deposits corresponding interrupt vector.
Adopt this technical scheme, because the code of driver and application program is deposited in different ROM spaces, when operation, because driver and application program are used in the driving sheaf space of ram space and application layer space as its corresponding internal memory, thereby realized minute open shop of driver and application program, therefore in system update, only need to upgrade the application program part, and do not need to upgrade fixing driver part, thereby improved updating speed, and reduced greatly in the escalation process again the upgrading failure cause that uncertain factor causes, increase the life-span and reduced the advantages such as expense.
Description of drawings
The overview flow chart that Fig. 1 provides for the embodiment of the invention;
The structural representation in the ROM space that Fig. 2 provides for the embodiment of the invention;
The structural representation of the ram space that Fig. 3 provides for the embodiment of the invention.
Embodiment
By describing technology contents of the present invention, structural attitude in detail, realized purpose and effect, below in conjunction with embodiment and cooperate that accompanying drawing is detailed to give explanation.
See also Fig. 1 and Fig. 2, the invention provides a kind of method of the mutual loading based on AM/BAM system driver and application program, may further comprise the steps,
Steps A: in the ROM space, minute be used in the driving code area of depositing driver code and be used for the application code district of depositing application code;
Step B: in ram space, distribute the driving sheaf space be used to the driver operation that the space is provided, distribute and be used to application program to provide the application layer space of running space and function entrance address that distribution is used to driver and application program that the program interaction district of parking space is provided;
Step C: the entry address of function is write described program interaction district, set up the driving mapping table by compiling, described driving mapping table comprises the one-to-one relationship of function entrance address and program code, and driver and application program are called mutually by described driving mapping table.
The below describes embodiments of the present invention in detail according to each step.
One, see also Fig. 1 and Fig. 2, steps A has been finished the distribution in ROM space.
The ROM space is used for solidifying code and uses for data, therefore application program and driver have separately independently code and data on engineering, usually have in the code operation and be divided into two territories: load domain and operation territory, load domain is that system powers on and begins to move the address that pre-sets separately to the code that will be solidificated in ROM, and RW, the initial phase of ZI section.After the operation territory refers to that then load phase is finished, really jump to the stage of principal function.Therefore whether can the coupling of the storage address of code be directly connected to this program and move.Owing under the development environment of each processor the initial entry address of the ROM that corresponding code is set is arranged, present embodiment is that driver and application program are provided with respectively two subregions with the ROM space: drive code area and application code district, the code of driver is write the driving code area, the code of application program is write the application code district, adopt this scheme, just the entry address with application program, the entry address of driver can be separated, just can the code address and the coupling of principal function when calling.
Simultaneously; as preferably, for the change that prevents the later stage code causes greatly the problem of insufficient space, in protected location of ROM spatial placement; this protected location is driving between code area and the application code district; refer to that specifically when the ROM space partition zone, it is adjacent with the protected location to drive residing sector, code area; simultaneously; residing sector, protected location is adjacent with the application code district again, and on Physical Extents, this protected location is located in and drives between code area and the application code district like this.
Two, see also Fig. 1 and Fig. 3, step B finishes the distribution of ram space.
In application, internal memory between the engineering also needs separate, otherwise can cause the whole system collapse, the distribution of ram space, mainly be to be each engineering distribution internal memory separately, the code of driver and application program is just separate in when operation like this, thereby prevents the stack between variable, the problem such as distorts.Arrange at ram space in the present embodiment and drive sheaf space and application layer space, for driver and application program provide different running memory spaces, separate when making its operation.
Because after an engineering compiling is finished, its RW section, the size of ZI section be fix as can be known, so the stack space that only needs given abundance just can guarantee the normal operation of a code, especially, because driver provides to application call, therefore storehouse can share, so as long as RW under the corresponding program of assurance, the space of ZI section can guarantee the normal operation of code, same, internal memory entry address separately can be set when compiling, the internal memory first address that therefore only application need to be driven separates and has enough spaces to get final product.For the foregoing reasons, in the present embodiment, be provided with stack space at ram space.
In the present embodiment, ram space has also distributed a Vector interrupt vector table in addition, in order to deposit corresponding interrupt vector.
In the present embodiment, the allocation order of ram space is the Vector interrupt vector table, drives sheaf space, application layer space, stack space and program interaction district.The allocation order that it is pointed out that this space is not what fix, and this is a kind of in all feasible schemes.
Ram space being distributed a part in step B has been the program interaction district, and the program interaction district is used for depositing the entry address of function, so each unit of interactive areas is necessary for an address size, when calling, utilizes the mode of pointer to carry out function call.The call method of pointer mode is what those skilled in the art were familiar with, only enumerates a kind of example 1 here, as:
1. void sys_init (void) is stored among the addr of interactive areas address
2. define a void*p pointer, then pointer p is pointed to the addr address
3. call * p=sys_init, namely realized the initialization in this program interaction district
4. application program just can be called sys_init () function under this address.
Three, see also Fig. 1, step C set up to drive mapping table, and each that set up that driving function calls is grand.
The function entrance address that needs is passed to application call among the step C has write the program interaction district one by one, has namely set up the driving mapping table that calls for driver.
The present invention comprises that also the described step of safeguarding comprises driving increase, deletion or the modification of mapping table to driving the step of safeguarding of mapping table in addition.
In the present embodiment, calling of function adopted the variable function pointer, had and just can load behind the function pointer that arbitrary shape is joined and the function of rreturn value, give an example 2 here:
1. the sys_init function pointer is inserted program interaction regional address addr;
2. at application program (void) function pointer of p of a void (*) of giving a definition, p is pointed to addr;
3. call p () and can finish calling of sys_init function.
Said method is to be the general case of variable for function address, but after the program interaction deinitialization of finishing ram space, all function addresses are all fixed, therefore as preferred, present embodiment gives another method, specifically refer to directly with a grand statement of finishing a function, such as example 3
1. with the sys_init function in the example 2, application program give a definition one grand: #define sys_init () (Void (*) is addr (Void)) ();
2. finish step 1, just can under application program, call the sys_init function.
Four, in addition, in order to save code, present embodiment also proposes a kind of method of optimization, and namely step D grandly is encapsulated as a function with described each among the described step C, offers calling of other utility functions.
Here for example how son 4 explains the Optimized code amount, and it is as follows to call the grand assembly code of the sys_init () of top step D:
If be packaged into a function call with grand, as follows:
The assembly code that calls this function generation is as follows:
Compare with the front and totally to have lacked three instructions, draw to draw a conclusion by above being not difficult: if this function of application call N time will not encapsulate the instruction of few 3* (N-1) bar after using the encapsulation function, to differ be very significant to this size of code in large-engineering.
It below is the implementation effect of present embodiment
The below contrasts for the general status after certain this invention of consumption electronic product software application:
As can be seen from the above before using application to drive mutually loading, each more new capital must not only lengthen originally stable driver update update time, and shorten the life-span of product greatly, and produces more communication cost.Drive and the driving after stablizing can be solidified after separation loads mutually, when upgrading application software, only need upgrade the applying portion of correspondence.Shorten greatly the time, increased the life-span and reduced the advantages such as expense, satisfied summary of the invention.
The above only is embodiments of the invention; be not so limit claim of the present invention; every equivalent structure or equivalent flow process conversion that utilizes instructions of the present invention and accompanying drawing content to do; or directly or indirectly be used in other relevant technical fields, all in like manner be included in the scope of patent protection of the present invention.
Claims (7)
1. the method based on the mutual loading of AM/BAM system driver and application program is characterized in that, comprising:
Steps A: in the ROM space, minute be used in the driving code area of depositing driver code and be used for the application code district of depositing application code;
Step B: in ram space, distribute the driving sheaf space be used to the driver operation that the space is provided, be used to application program provide running space the application layer space, be used for depositing the program interaction district of driver function entrance address and application program function entrance address;
Step C: the entry address of function is write described program interaction district, set up the driving mapping table by compiling, described driving mapping table comprises the one-to-one relationship of function entrance address and program code, and driver and application program are called mutually by described driving mapping table.
2. the method for described mutual loading based on AM/BAM system driver and application program according to claim 1, it is characterized in that: described steps A also is included in the ROM space distributes the protected location, and described protected location is driving between code area and the application code district.
3. the method for described mutual loading based on AM/BAM system driver and application program according to claim 1 is characterized in that: described step B also is included in the ram space and minute is used in the stack space that shares for driver and application program operation.
4. the method for described mutual loading based on AM/BAM system driver and application program according to claim 1 is characterized in that: mutually to call be that mode by defmacro realizes for driver and application program among the described step C.
5. the method for described mutual loading based on AM/BAM system driver and application program according to claim 4 is characterized in that, also comprises:
Step D: described each among the described step C grandly is encapsulated as a function, offers calling of other utility functions.
6. the method for described mutual loading based on AM/BAM system driver and application program according to claim 1 is characterized in that: comprise that also the described step of safeguarding comprises driving increase, deletion or the modification of mapping table to driving the step of safeguarding of mapping table.
7. the method for described mutual loading based on AM/BAM system driver and application program according to claim 1, it is characterized in that: described step B also is included in and distributes the Vector interrupt vector table in the ram space, deposits corresponding interrupt vector.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2011102554821A CN102955707A (en) | 2011-08-31 | 2011-08-31 | Method for mutual loading of drive program and application program based on foreground-background system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2011102554821A CN102955707A (en) | 2011-08-31 | 2011-08-31 | Method for mutual loading of drive program and application program based on foreground-background system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102955707A true CN102955707A (en) | 2013-03-06 |
Family
ID=47764539
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2011102554821A Pending CN102955707A (en) | 2011-08-31 | 2011-08-31 | Method for mutual loading of drive program and application program based on foreground-background system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102955707A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103731733A (en) * | 2013-12-19 | 2014-04-16 | 乐视网信息技术(北京)股份有限公司 | Version upgrading method and electronic device |
CN106371884A (en) * | 2016-09-18 | 2017-02-01 | 时瑞科技(深圳)有限公司 | Universal embedded application loading system and method |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1755626A (en) * | 2004-09-27 | 2006-04-05 | 乐金电子(昆山)电脑有限公司 | Bootloader updating method for portable personal digital assistant |
CN101004690A (en) * | 2007-01-09 | 2007-07-25 | 京信通信技术(广州)有限公司 | Integrative method for updating load program and application program in embedded type system |
CN101067789A (en) * | 2007-06-05 | 2007-11-07 | 上海微电子装备有限公司 | Program dynamic loading method |
CN101615128A (en) * | 2009-07-31 | 2009-12-30 | 北京华环电子股份有限公司 | A kind of method of single-chip microcomputer online upgrading and device |
CN101751277A (en) * | 2008-12-16 | 2010-06-23 | 联发科技股份有限公司 | Data processing and addressing methods for use in an electronic apparatus, as well as electronic apparatus |
-
2011
- 2011-08-31 CN CN2011102554821A patent/CN102955707A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1755626A (en) * | 2004-09-27 | 2006-04-05 | 乐金电子(昆山)电脑有限公司 | Bootloader updating method for portable personal digital assistant |
CN101004690A (en) * | 2007-01-09 | 2007-07-25 | 京信通信技术(广州)有限公司 | Integrative method for updating load program and application program in embedded type system |
CN101067789A (en) * | 2007-06-05 | 2007-11-07 | 上海微电子装备有限公司 | Program dynamic loading method |
CN101751277A (en) * | 2008-12-16 | 2010-06-23 | 联发科技股份有限公司 | Data processing and addressing methods for use in an electronic apparatus, as well as electronic apparatus |
CN101615128A (en) * | 2009-07-31 | 2009-12-30 | 北京华环电子股份有限公司 | A kind of method of single-chip microcomputer online upgrading and device |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103731733A (en) * | 2013-12-19 | 2014-04-16 | 乐视网信息技术(北京)股份有限公司 | Version upgrading method and electronic device |
CN103731733B (en) * | 2013-12-19 | 2018-08-10 | 乐视网信息技术(北京)股份有限公司 | A kind of version upgrading method and electronic equipment |
CN106371884A (en) * | 2016-09-18 | 2017-02-01 | 时瑞科技(深圳)有限公司 | Universal embedded application loading system and method |
CN106371884B (en) * | 2016-09-18 | 2019-12-20 | 时瑞科技(深圳)有限公司 | Universal embedded loading application system and method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103493011B (en) | Application with library operating systems is compatible | |
CN102087716B (en) | Multi-application Java smart card | |
CN106371838B (en) | A kind of method and system for safeguarding software package dependency relationship | |
CN104750528B (en) | A kind of assembly management method and apparatus in Android program | |
CN102073520A (en) | Dynamic management system and method for C++ application program version | |
CN103677884B (en) | Flash subarea list file is generated and its data updating method, device | |
CN104750555B (en) | Process management method and device in a kind of Android program | |
CN110275722A (en) | Method, apparatus, equipment and storage medium for upgrade application | |
MX2013005599A (en) | Pre-heated software installation. | |
CN101421711A (en) | The virtual execution system that is used for resource-constrained devices | |
CN102308280B (en) | Basic input/output system BIOS configuration data management method and system | |
CN102541619A (en) | Management device and method for virtual machine | |
CN103106058A (en) | Double-screen display method and intelligent display terminal based on android platform | |
CN101414264A (en) | Method for updating high reliable software version and three update modes | |
CN101004681A (en) | Method for implementing long jumping dynamic patch in embedded system | |
CN102023885A (en) | Method and system for storing bytecode of JCRE (Java card run time environment) | |
CN103246610A (en) | Dynamic storage management method of embedded system based on single-type memory | |
CN101872306B (en) | Embedded system for realizing software updating and software backup and implementation method thereof | |
CN104391714A (en) | Software update method and software update device for vehicle | |
CN101650663A (en) | Database system and upgrading method thereof | |
CN103793332B (en) | Data storage method and device based on memory, processor and electronic equipment | |
CN104364759A (en) | Method, system and an executable piece of code for controlling the use of hardware resources of a computer system | |
US10338847B1 (en) | Coherent buffer mapping for virtualized graphics processing | |
CN102955707A (en) | Method for mutual loading of drive program and application program based on foreground-background system | |
CN102024051B (en) | Data updating method for distributed memory database |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20130306 |