CN101853181A - Subprogram mutual calling method used in embedded system - Google Patents

Subprogram mutual calling method used in embedded system Download PDF

Info

Publication number
CN101853181A
CN101853181A CN 201010170472 CN201010170472A CN101853181A CN 101853181 A CN101853181 A CN 101853181A CN 201010170472 CN201010170472 CN 201010170472 CN 201010170472 A CN201010170472 A CN 201010170472A CN 101853181 A CN101853181 A CN 101853181A
Authority
CN
China
Prior art keywords
subprogram
subroutine
embedded system
cpu
mutual calling
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
Application number
CN 201010170472
Other languages
Chinese (zh)
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.)
Delta Greentech China Co Ltd
Original Assignee
Delta Greentech China Co Ltd
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 Delta Greentech China Co Ltd filed Critical Delta Greentech China Co Ltd
Priority to CN 201010170472 priority Critical patent/CN101853181A/en
Publication of CN101853181A publication Critical patent/CN101853181A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a subprogram mutual calling method used in an embedded system, which comprises the following steps of: step one, when the embedded system is started for operation, setting an initial environment, checking an initial mark, and determining a subprogram to be called; step two, starting operating the subprogram, clearing a reset mark and setting an independent subprogram operating environment first, and then entering a subprogram main body; and step three, when another subprogram is needed to be called, repeating the step two. The subprogram mutual calling method has the advantages that: 1) each subprogram can use almost all RAM; 2) the interrelation among the subprograms are isolated to the utmost extent; and 3) each subprogram can acquire an independent operating environment.

Description

The method that is used for the Subprogram mutual calling of embedded system
Technical field
The invention belongs to the robot calculator field, relate to a kind of method that is used for the Subprogram mutual calling of embedded system.
Background technology
Embedded system says to be exactly computer system in a broad sense, and it comprises except with general being all computing machines the computing machine of purpose.Can to satisfy multiple-task different with general-purpose computing system, and embedded system can only be finished the task of some specific purpose.Part is called as firmware for the embedded system written program, and they are stored in ROM (read-only memory) or the flash chip, and they operate in the computer hardware of resource-constrained.Return address when the overall situation/local variable that the subroutine in the embedded system is used when operation and subroutine call all takies ram space, level increase along with nesting allocation, the ram space that takies is also big more, and ram space is very limited in the embedded system.In addition, the bug of a subroutine is easy to have influence on other subroutines.
In some single-chip microcomputer, after powering on, some function registers can only write once, when using these registers, must integrated planning, thus reduced the dirigibility of program.
Summary of the invention
Technical matters to be solved by this invention is: the contact between a kind of program of separaant to greatest extent is provided, thoroughly discharge the resource that previous runtime subroutine takies, and the resetting sub program is to the method for the Subprogram mutual calling that is used for embedded system of the modification of running environment.
For solving the problems of the technologies described above, the present invention adopts following technical scheme.
A kind of method that is used for the Subprogram mutual calling of embedded system may further comprise the steps:
Step 1 when embedded system starts operation, is provided with initial environment, checks initial mark, which subroutine that decision is called;
Step 2, subroutine brings into operation: remove reseting mark, independently subprogram activation environment is set, enter the subroutine main body then;
Step 3 when needs call another subroutine, is provided with reseting mark and call parameters, restarts CPU, thus the step 1 of changing over to.
As a preferred embodiment of the present invention, described independently subprogram activation environment is realized by restarting CPU.
As another kind of preferred version of the present invention, described CPU restarts by hard reset rather than warm reset, and described hard reset comprises house dog or reset signal are set; Described warm reset comprises article one instruction operation of carrying out when leaping to CPU powers on.
As another preferred version of the present invention, by being set, house dog restarts a kind of method to set up of CPU, and the subprogram activation environment of setting has: A1, house dog is set; A2, interrupt vector is set; A3, timer is set.
As another preferred version of the present invention, restart a kind of method to set up of CPU by hard reset, being operating as of call subroutine:
B1, close interrupt source, shielding is interrupted;
B2, reseting mark is set is eigenwert, and the entry address that subroutine address is masked as subroutine is set; Setting passes to the parameter of subroutine;
B3, stop the house dog that resets, wait for watchdog reset CPU, thus runtime subroutine.
As another preferred version of the present invention, in the step 1, the described initial environment that is provided with comprises and initial storehouse is set, the zero clearing interrupt vector table.
As another preferred version of the present invention, in the step 1, described inspection initial mark comprises the inspection reseting mark, and the subroutine address sign.
Beneficial effect of the present invention is:
1) each subroutine all can be used most RAM;
2) behind the hard reset, the register of write once can be write again;
3) isolated the interference of subroutine bug to greatest extent to other subroutine;
4) each subroutine all can obtain independently running environment.
Description of drawings
Fig. 1 is the synoptic diagram of subroutine call method;
Embodiment
Below in conjunction with accompanying drawing the specific embodiment of the present invention is described in further detail.
Embodiment
Present embodiment provides a kind of method that is used for the Subprogram mutual calling of embedded system, and this method may further comprise the steps:
A kind of method that is used for the Subprogram mutual calling of embedded system may further comprise the steps:
Step 1 when embedded system starts operation, is provided with initial environment, checks initial mark, and which subroutine decision calls; The described initial environment that is provided with comprises and initial storehouse is set, the zero clearing interrupt vector table; Described inspection initial mark comprises the inspection reseting mark, and the subroutine address sign; Initial mark can be placed in RAM or the External memory equipment, and also available I/O indicates.
Step 2, the subroutine that brings into operation is at first removed reseting mark, and independently subprogram activation environment is set, and enters the subroutine main body then; Described independently subprogram activation environment is realized by hard reset CPU; Described hard reset CPU is by being provided with house dog or reset signal restarts;
The subprogram activation environment that is provided with has:
A1, house dog is set;
A2, low-voltage detecting is set;
A3, battery saving mode is set;
A4, clock generator is set;
A5, interrupt vector is set;
A6, timer is set.
Step 3 when needs call another subroutine, is operating as:
B1, close interrupt source, shielding is interrupted;
B2, reseting mark is set is eigenwert, and the entry address that subroutine address is masked as subroutine is set, and the parameter that passes to subroutine is set;
B3, stop the house dog that resets, wait for watchdog reset CPU, enter step 1.
The method of the invention is by checking reseting mark and subroutine address sign, and which subroutine decision calls.Each subroutine includes independently subprogram activation environment and subroutine main body two parts is set; The flow process of the method for Subprogram mutual calling of the present invention as shown in Figure 1.As can be seen from Figure 1, subroutine call method of the present invention can make the register of the back write once that resets that the running environment of each subroutine initialization completely oneself can be set again.Have only between the subroutine outside a small amount of sign and the parameter transmission, do not have other contacts, hardware all reinitializes, and has realized maximum isolation, avoids the phase mutual interference, has also isolated the interference of bug certainly.Whole RAM that each subroutine is almost used have utilized resource to greatest extent.
Here description of the invention and application is illustrative, is not to want with scope restriction of the present invention in the above-described embodiments.Here the distortion of disclosed embodiment and change are possible, and the various parts of the replacement of embodiment and equivalence are known for those those of ordinary skill in the art.Those skilled in the art are noted that under the situation that does not break away from spirit of the present invention or essential characteristic, and the present invention can be with other forms, structure, layout, ratio, and realize with other elements, material and parts.

Claims (4)

1. a method that is used for the Subprogram mutual calling of embedded system is characterized in that, may further comprise the steps:
Step 1 when embedded system starts operation, is provided with initial environment, checks initial mark, which subroutine that decision is called;
Step 2, subroutine brings into operation: remove reseting mark, independently subprogram activation environment is set, enter the subroutine main body then;
Step 3 when needs call another subroutine, is provided with reseting mark and call parameters, restarts CPU, thus the step 1 of changing over to.
2. the method that is used for the Subprogram mutual calling of embedded system according to claim 1 is characterized in that: described independently subprogram activation environment is realized by restarting CPU.
3. the method that is used for the Subprogram mutual calling of embedded system according to claim 2 is characterized in that: described CPU restarts by hard reset rather than warm reset, and described hard reset comprises house dog or reset signal are set; Described warm reset comprises article one instruction operation of carrying out when leaping to CPU powers on.
4, the method that is used for the Subprogram mutual calling of embedded system according to claim 3 is characterized in that: during execution in step three, the step by the hard reset call subroutine is:
B1, stop response and interrupt;
B2, reseting mark is set is eigenwert, preserves the entry address of subroutine in the subroutine address sign; Setting passes to the parameter of subroutine;
B3, hard reset restart CPU.
5. according to any described method that is used for the Subprogram mutual calling of embedded system of claim 1 to 4, it is characterized in that: in the step 1, described inspection initial mark comprises the inspection reseting mark, and the subroutine address sign.
CN 201010170472 2010-05-11 2010-05-11 Subprogram mutual calling method used in embedded system Pending CN101853181A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010170472 CN101853181A (en) 2010-05-11 2010-05-11 Subprogram mutual calling method used in embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010170472 CN101853181A (en) 2010-05-11 2010-05-11 Subprogram mutual calling method used in embedded system

Publications (1)

Publication Number Publication Date
CN101853181A true CN101853181A (en) 2010-10-06

Family

ID=42804687

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010170472 Pending CN101853181A (en) 2010-05-11 2010-05-11 Subprogram mutual calling method used in embedded system

Country Status (1)

Country Link
CN (1) CN101853181A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102708001A (en) * 2012-04-26 2012-10-03 深圳市九思泰达技术有限公司 Linux embedded equipment and switching method between user mode and engineering mode
CN103257960A (en) * 2012-02-15 2013-08-21 深圳市金蝶友商电子商务服务有限公司 Calling method and system
CN108732967A (en) * 2018-05-17 2018-11-02 广东美的制冷设备有限公司 Anti- electromagnetic interference method, anti-breaking photoelectric control box, air conditioner and medium
CN110046000A (en) * 2019-04-24 2019-07-23 上海连尚网络科技有限公司 Small routine operation method and device
CN112860333A (en) * 2019-11-27 2021-05-28 青岛海尔洗衣机有限公司 Program operation method and device of control device and clothes treatment equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1490722A (en) * 2003-09-19 2004-04-21 清华大学 Graded task switching method based on PowerPC processor structure
US20040078547A1 (en) * 2000-11-13 2004-04-22 Vincent David Security method making deterministic real time execution of multitask applications of control and command type with error confinement
CN101364208A (en) * 2008-09-12 2009-02-11 浪潮齐鲁软件产业有限公司 Method for implementing multiprogram switching by CPLD in embedded system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040078547A1 (en) * 2000-11-13 2004-04-22 Vincent David Security method making deterministic real time execution of multitask applications of control and command type with error confinement
CN1490722A (en) * 2003-09-19 2004-04-21 清华大学 Graded task switching method based on PowerPC processor structure
CN101364208A (en) * 2008-09-12 2009-02-11 浪潮齐鲁软件产业有限公司 Method for implementing multiprogram switching by CPLD in embedded system

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103257960A (en) * 2012-02-15 2013-08-21 深圳市金蝶友商电子商务服务有限公司 Calling method and system
CN102708001A (en) * 2012-04-26 2012-10-03 深圳市九思泰达技术有限公司 Linux embedded equipment and switching method between user mode and engineering mode
CN102708001B (en) * 2012-04-26 2016-01-06 深圳市九思泰达技术有限公司 The method that Linux embedded device and user model thereof and engineering mode switch
CN108732967A (en) * 2018-05-17 2018-11-02 广东美的制冷设备有限公司 Anti- electromagnetic interference method, anti-breaking photoelectric control box, air conditioner and medium
CN110046000A (en) * 2019-04-24 2019-07-23 上海连尚网络科技有限公司 Small routine operation method and device
CN110046000B (en) * 2019-04-24 2022-03-11 上海连尚网络科技有限公司 Applet running method and device
CN112860333A (en) * 2019-11-27 2021-05-28 青岛海尔洗衣机有限公司 Program operation method and device of control device and clothes treatment equipment

Similar Documents

Publication Publication Date Title
US9652221B2 (en) Runtime patching of an operating system (OS) without stopping execution
CN102236621B (en) Computer interface information configuration system and method
CN101853181A (en) Subprogram mutual calling method used in embedded system
JP6508851B2 (en) Avoid early enablement of non-maskable interrupts when returning from an exception
CN103207797A (en) Capsule type custom-made updating method based on unified extensible firmware interface firmware system
JP5734211B2 (en) Heterogeneous computer system
US9552039B2 (en) Constrained boot techniques in multi-core platforms
CN114879828A (en) Firmware interface with persistent memory storage
US10496149B2 (en) Method of operating CPU and method of operating system having the CPU
US9003174B2 (en) Method for boosting an electronic device with multiple processing units, and electronic device for implementing the same
US20190004818A1 (en) Method of UEFI Shell for Supporting Power Saving Mode and Computer System thereof
CN108874458A (en) A kind of the firmware starting method and multicore SoC device of multicore SoC
CN104298645A (en) Flexibly configured programmable system-on-chip chip and starting configuration method thereof
CN110045992B (en) Universal system and method suitable for multi-core board card
CN103019774A (en) Dynamic overloading method for DSP (Digital Signal Processor)
Costero et al. Energy efficiency optimization of task-parallel codes on asymmetric architectures
JP2016532183A (en) Method and system for assigning computational blocks of a software program to a core of a multiprocessor system
GB2593513A (en) Method and system for optimizing data transfer from one memory to another memory
WO2017102038A1 (en) Method and arrangement for utilization of a processing arrangement
US20150363227A1 (en) Data processing unit and method for operating a data processing unit
US20230161600A1 (en) Kernel reboot method
CN115145642B (en) Software starting method and system
US9280354B1 (en) Interval timer
Wen et al. Dspbooster: Offloading unmodified mobile applications to dsps for power-performance optimal execution
CN113505074A (en) Linux system debugging method and device and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20101006