CN110489089B - Embedded system low-power consumption control method and system based on interrupt management framework - Google Patents
Embedded system low-power consumption control method and system based on interrupt management framework Download PDFInfo
- Publication number
- CN110489089B CN110489089B CN201910754454.0A CN201910754454A CN110489089B CN 110489089 B CN110489089 B CN 110489089B CN 201910754454 A CN201910754454 A CN 201910754454A CN 110489089 B CN110489089 B CN 110489089B
- Authority
- CN
- China
- Prior art keywords
- interrupt
- low
- scheduling
- processing program
- low power
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/20—Software design
- G06F8/22—Procedural
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4812—Task transfer initiation or dispatching by interrupt, e.g. masked
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Power Sources (AREA)
Abstract
The invention provides a low-power consumption control method and system of an embedded system based on an interrupt management framework. The method comprises the following steps: when the system is initialized, the microprocessor calls and executes a callback function to generate a global structure array, wherein the global structure array comprises an interrupt serial number and an authority identifier, and the authority identifier is used for indicating whether an interrupt processing program enters a scheduling kernel or system software or not in a low-power-consumption mode; in the low-power-consumption mode, when a new interrupt processing program is generated, after the microprocessor executes the current interrupt processing program, traversing the global structure array, judging whether to enter a scheduling kernel or system software when exiting the current interrupt processing program according to the authority identifier, if not, directly returning to a breakpoint, and continuing to execute background logic in the low-power-consumption mode; when the system exits the low power mode, the microprocessor then executes the entire software based on the scheduling mechanism that schedules the kernel or system software. By the interrupt filtering, the aim of defining low power consumption of the system can be achieved.
Description
Technical Field
The invention relates to the technical field of embedded systems, in particular to a low-power-consumption control method and system of an embedded system based on an interrupt management framework.
Background
With the large-scale popularization of the internet of things and unmanned systems, people have higher and higher requirements on low power consumption performance of embedded systems, especially on battery-powered equipment. Because low power consumption means a longer life cycle of the device and fewer maintenance (e.g., battery replacement) times, for embedded devices deployed in large quantities (e.g., terminals of the internet of things), reducing the maintenance times can significantly reduce the operation cost.
The low-power design of the embedded system is a comprehensive problem, a 'combined punch' needs to be made, a 'short board' cannot be provided, and the low-power design of hardware (such as a microprocessor) cannot be relied on; low power design of software, especially system software, and cooperation of system software and application layer software, is very important. Wangqi et al (Wangqi, xuwen tough, tang Ke. Embedded system software low power technology implementation strategy [ J ] Ship electronic engineering, 2013 (3): 74-76.) according to the embedded system software composition structure, the software low power technology is divided into three levels for classification description, and the problems, main solutions and application situations of the low power technology on each level are clarified. However, in this paper, it is only mentioned briefly that the cycle/interrupt style should be converted into the call return style, and how to solve the power consumption problem caused by the interrupt is not mentioned.
After the embedded system enters a low power consumption mode, according to a pre-designed working model, only various interrupts need to be responded, and most system software or application software can be out of work, so that the operation of logic codes is reduced as much as possible on the premise of ensuring the design requirement of the system function, and the purpose of reducing the power consumption is achieved.
Therefore, for an embedded System using an embedded Real-Time Operating System (RTOS) or not using the embedded Real-Time Operating System, triggering of System software or application layer software due to an interrupt should be reduced as much as possible, so that the upper layer software is in a "sleep" state as much as possible.
Disclosure of Invention
In order to reduce the running of system software or application layer software triggered by interrupt as much as possible and enable the upper layer software to be in a 'sleep' state as much as possible, the invention provides an embedded system low-power consumption control method and an embedded real-time operating system which are realized based on an interrupt management framework.
On one hand, the embedded system low power consumption control method based on the interrupt management framework provided by the invention comprises the following steps:
when a system is initialized, a microprocessor calls and executes a callback function to generate a global structure array, wherein the global structure array comprises an interrupt serial number and an authority identifier, and the authority identifier is used for indicating whether an interrupt processing program enters a scheduling kernel or system software or not in a low power consumption mode;
in the low-power-consumption mode, when a new interrupt processing program is generated, after the microprocessor executes the current interrupt processing program, traversing the global structure array, judging whether to enter a scheduling kernel or system software when exiting the current interrupt processing program according to the authority identifier, if not, directly returning to the interrupted point, and continuing to execute background logic in the low-power-consumption mode;
when the system exits the low power consumption mode, the microprocessor continues to execute the whole software based on the original scheduling mode of the scheduling kernel or the system software.
Further, before the microprocessor calls and executes the callback function, the method further comprises the following steps: the method comprises the steps of receiving and storing a callback function written by a user through a configuration interface, wherein the callback function is provided with an interrupt type that a system does not need to enter a scheduling kernel or system software in a low power consumption mode.
In another aspect, the present invention provides an embedded real-time operating system, including: an interrupt management module;
the interrupt management module is used for executing an interrupt processing program based on the embedded system low-power-consumption control method.
Further, the embedded real-time operating system further includes: the system comprises a task management module, a message transmission module, an event module, a resource module and a time module;
the task management module, the message transmission module and the event module are all configured with a first API used for being called in an interrupt processing program and a second API which is called in a task and corresponds to the first API;
the time module is configured with a third API that is called by the application layer to obtain relevant information that does not enter the scheduling kernel on demand.
Further, the embedded real-time operating system is also configured with a fourth API for entering a low power mode and a fifth API for exiting the low power mode.
The invention has the beneficial effects that:
the invention provides a low power consumption control method of an embedded system based on an interrupt management framework, which comprises the steps of firstly providing a configuration interface for programmers based on a designed and realized interrupt management framework, filtering interrupts according to callback logic written by the programmers, and entering a scheduling kernel (when using an RTOS) or system software (when not using the RTOS) if necessary, or not entering, thereby achieving the purpose of defining (configuring) low power consumption. The embedded real-time operating system provided by the invention is a mixed preemptive real-time operating system, can obtain reasonable compromise between preemptive scheduling and non-preemptive scheduling, and improves the schedulability of a task set by reducing unnecessary task switching; meanwhile, the memory consumption is reduced, and the method can be widely applied to deep embedding environments with limited memory resources and high cost pressure, for example: the system comprises the Internet of things, intelligent hardware, an unmanned system and the like.
Drawings
FIG. 1 is a diagram of an interrupt management framework supporting a low power mechanism according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an embedded real-time operating system according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic diagram of an interrupt management framework supporting a low power consumption mechanism according to an embodiment of the present invention. With reference to fig. 1, a method for controlling an interrupt handler according to an embodiment of the present invention includes the following steps:
s101, when a system is initialized, a microprocessor calls and executes a callback function to generate a global structure array, wherein the global structure array comprises an interrupt serial number and an authority identifier, and the authority identifier is used for indicating whether an interrupt processing program enters a scheduling kernel or system software or not in a low power consumption mode;
s102, in a low-power-consumption mode, when a new interrupt processing program is generated, after the microprocessor executes the current interrupt processing program, traversing the global structure array, judging whether to enter a scheduling kernel or system software when exiting the current interrupt processing program according to the authority identifier, if not, directly returning to a breakpoint, and continuing to execute background logic in the low-power-consumption mode;
s103, when the system exits the low power consumption mode, the microprocessor continues to execute the whole software based on the original scheduling mechanism of the scheduling kernel or the system software.
For example, if the original scheduling mechanism of the scheduling kernel or system software is: and (3) executing the ready task with the highest priority when the system exits the low power consumption mode based on the preemptive scheduling mechanism of the priority.
On the basis of the above embodiment, before the microprocessor calls the execution callback function, the method further includes: s100, a callback function written by a user is received and stored through a configuration interface, and the callback function is provided with an interrupt type that the system does not need to enter a scheduling kernel or system software in a low power consumption mode.
Specifically, in an embedded system using an RTOS, the operation of the interrupt management framework is as follows, but is not limited to this operation:
(1) The method comprises the steps that the interrupt type which can not enter a scheduling kernel in a low power consumption mode is configured in a callback function written by a programmer, the callback function is called and executed when a system is initialized, a global structure array is generated, and the structure array comprises an interrupt serial number and an identifier for judging whether to enter the scheduling kernel in the low power consumption mode. The array of structures is used by the logic code of the interrupt management framework.
(2) In the low power consumption mode, after an interrupt is generated, the microprocessor executes an interrupt processing program which is registered in advance, a system code is called at the end of the program, the logic of an interrupt management framework is entered, whether the scheduling kernel needs to be entered when the interrupt processing program exits is judged by traversing the structure array, if not, the scheduling kernel directly returns to the interrupted point, and the background logic in the low power consumption mode is continuously executed. That is, the scheduling kernel of the RTOS is not entered, and even if the interrupt handlers have already made several tasks ready, the microprocessor should select an appropriate task from among the several tasks according to the original scheduling mechanism of the scheduling kernel, and the microprocessor will not execute a task by performing a field switch.
(3) When the system exits the low power mode, the original scheduling mechanism of the scheduling kernel or system software only starts to play a role. (e.g., if preemptive scheduling based on priority, then the highest priority ready task is executed).
Because only external data need to be received and stored in the low power mode, the logic can be completed in the interrupt handler without executing system level or application level logic that processes the data. Thus, the interrupt management framework is reasonable and efficient.
The embedded system low power consumption control method based on the interrupt management framework provided by the embodiment of the invention provides a configuration interface for programmers by designing and realizing the interrupt management framework, can filter interrupts according to callback logic written by the programmers, and enters a scheduling kernel (when using RTOS) or system software (when not using RTOS) if necessary, or does not enter, thereby achieving the purpose of defining (configuring) low power consumption.
Fig. 2 is a schematic structural diagram of an embedded real-time operating system according to an embodiment of the present invention. As shown in fig. 2, the embedded real-time operating system includes: an interrupt management module 21, a task management module 22, a messaging module 23, an event module 24, a resource module 25, and a time module 26; wherein: the interrupt management module 21 is configured to execute an interrupt handler based on the interrupt handler control method.
Specifically, the interrupt management module 21 is also called an interrupt management framework. Interrupts are important opportunities to cause live handoffs, and most of the trigger points for preemptive scheduling are also present in the interrupt handler. Thus, the interrupt management framework is the core logic of the embedded RTOS.
The interrupt management framework of the embedded real-time operating system is an interface of the outside world and system software, and a change in the situation triggers an interrupt, so that an interrupt handler is executed, and an API provided by the operating system may be called in the interrupt handler, for example: setting events, sending messages, activating APIs for tasks, thereby making certain tasks ready. In the non-low power mode, these ready tasks may participate in the scheduling process of the scheduling core and may be scheduled for execution after the interrupt handler exits. However, in the low power consumption mode, because the interrupt processing program does not enter the scheduling kernel when exiting, the ready tasks do not participate in scheduling until exiting the low power consumption mode, which is called as "hysteresis scheduling" in the invention, and the situation is reasonably handled.
It should be noted that, unlike similar modules of a conventional embedded real-time operating system, modules for task management, message delivery, events, time, and the like included in the embedded real-time operating system provided in the embodiment of the present invention are embedded with logic codes that support the low power consumption mechanism, and include:
(1) In the modules of task management, message transmission, event, etc., the API (including activating task, sending message, setting event, etc.) that can be called in the interrupt handler is added with the logic code that can record the information that the corresponding task is ready but will not enter the scheduling kernel, etc. in the low power consumption mode, and in the structure body of task control block, message control block, event control block, etc., the corresponding field is added to store the information, including: ready time, whether a scheduling kernel is entered, triggering times and the like.
(2) In the modules of task management, message transmission, event and the like, the API (including reading task control block data, receiving messages, waiting for events and the like) which can be called in the task and corresponds to the API called in the interrupt handler is added with a logic code which can read the information in the low power consumption mode, and the information can be upwards transmitted to an application layer for being used by an application program, so that corresponding adjustment is made on the control logic or the data processing logic in the low power consumption mode or when the low power consumption mode is exited.
(3) The bottom layer of the time module 26 is an interrupt handler of the microprocessor hardware timer, which also reduces the number of times the dispatch kernel is entered in the low power mode. For example: in the normal mode, a timer with a period of 10 milliseconds interrupts, and enters a scheduling kernel after an interrupt handler is executed each time; in the low power consumption mode, the scheduling kernel is entered in a longer period according to the configuration of a user. Therefore, a callback function is added in the interrupt handler for receiving the configuration parameters of the user. Meanwhile, logic codes are added for recording relevant information which does not enter a scheduling core in a low power consumption mode, and the method comprises the following steps: current period value, interrupt times, whether to enter a scheduling kernel, etc. And correspondingly, fields are added in the structure body of the time control block to store the information. The time module 26 also adds an API for this purpose, which is called by the application layer to obtain relevant information as needed, as a basis for making corresponding adjustments to the various application layer control or data processing logic in the task.
(4) Compared with the traditional embedded real-time operating system, the embedded real-time operating system increases a scheduling opportunity, namely, when exiting from the low power consumption mode, the embedded real-time operating system enters a scheduling kernel once to perform uniform scheduling once on various delayed scheduling ready tasks, and the scheduling can be preemptive scheduling based on priority or other non-preemptive scheduling. It should be noted that: before entering the scheduling kernel, the scheduling kernel may have entered several times, and all the late scheduled ready tasks before the entering are processed; because the scheduled core is not completely prohibited from entering in the low power mode, the number of times the scheduled core is entered is reduced.
Therefore, the embedded real-time operating system in the embodiment of the invention is additionally provided with an API for entering the low power consumption mode and an API for exiting the low power consumption mode.
From the above, the embedded real-time operating system provided by the invention has the characteristics of simplicity, easiness in use, real-time high efficiency and the like, is suitable for the wide application fields of deep-embedded internet-of-things terminal equipment, wearable equipment, intelligent hardware, unmanned systems, automotive electronics, industrial control, communication equipment and other medium-high-end embedded systems, and has the advantages that the embedded real-time operating system has typical RTOS functional modules and is also suitable for the interrupt management framework.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, and not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (4)
1. The embedded system low-power consumption control method based on the interrupt management framework is characterized by comprising the following steps:
when a system is initialized, a callback function compiled by a user is received and stored through a configuration interface, and the callback function is internally provided with an interrupt type that the system does not need to enter a scheduling kernel or system software in a low power consumption mode; the microprocessor calls and executes a callback function to generate a global structure array, wherein the global structure array comprises an interrupt serial number and an authority identifier, and the authority identifier is used for indicating whether an interrupt processing program enters a scheduling kernel or system software or not in a low-power-consumption mode;
in the low-power-consumption mode, when a new interrupt processing program is generated, after the microprocessor executes the current interrupt processing program, traversing the global structure array, judging whether to enter a scheduling kernel or system software when exiting the current interrupt processing program according to the authority identifier, if not, directly returning to a breakpoint, and continuing to execute background logic in the low-power-consumption mode;
when the system exits the low power mode, the microprocessor continues to execute the whole software based on the original scheduling mechanism of the scheduling kernel or the system software.
2. An embedded real-time operating system, comprising: an interrupt management module;
the interrupt management module is configured to execute an interrupt handler based on the low power consumption control method of claim 1.
3. The embedded real-time operating system of claim 2, further comprising: the system comprises a task management module, a message transmission module, an event module, a resource module and a time module;
the task management module, the message transmission module and the event module are all provided with a first API (application program interface) used for being called in an interrupt processing program and a second API (application program interface) called in a task and corresponding to the first API;
the time module is configured with a third API that is called by the application layer to obtain relevant information that does not enter the scheduling kernel on demand.
4. The embedded real-time operating system of claim 3, further configured with a fourth API for entering a low power mode, and a fifth API for exiting a low power mode.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910754454.0A CN110489089B (en) | 2019-08-15 | 2019-08-15 | Embedded system low-power consumption control method and system based on interrupt management framework |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910754454.0A CN110489089B (en) | 2019-08-15 | 2019-08-15 | Embedded system low-power consumption control method and system based on interrupt management framework |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110489089A CN110489089A (en) | 2019-11-22 |
CN110489089B true CN110489089B (en) | 2022-12-30 |
Family
ID=68551325
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910754454.0A Active CN110489089B (en) | 2019-08-15 | 2019-08-15 | Embedded system low-power consumption control method and system based on interrupt management framework |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110489089B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5754869A (en) * | 1994-10-04 | 1998-05-19 | Intel Corporation | Method and apparatus for managing power consumption of the CPU and on-board system devices of personal computers |
WO2001016679A1 (en) * | 1999-08-31 | 2001-03-08 | Intel Corporation | Operating vehicular processor-based systems |
CN102135906A (en) * | 2011-03-18 | 2011-07-27 | 深圳市民德电子科技有限公司 | Power consumption control method and system orienting to embedded real-time operating system |
CN103620521A (en) * | 2011-06-24 | 2014-03-05 | 英特尔公司 | Techniques for controlling power consumption of a system |
WO2015143594A1 (en) * | 2014-03-24 | 2015-10-01 | Intel Corporation | Syncronization of interrupt processing to reduce power consumption |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7197654B2 (en) * | 2002-04-11 | 2007-03-27 | International Business Machines Corporation | Method and apparatus for managing low power processor states |
-
2019
- 2019-08-15 CN CN201910754454.0A patent/CN110489089B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5754869A (en) * | 1994-10-04 | 1998-05-19 | Intel Corporation | Method and apparatus for managing power consumption of the CPU and on-board system devices of personal computers |
WO2001016679A1 (en) * | 1999-08-31 | 2001-03-08 | Intel Corporation | Operating vehicular processor-based systems |
CN102135906A (en) * | 2011-03-18 | 2011-07-27 | 深圳市民德电子科技有限公司 | Power consumption control method and system orienting to embedded real-time operating system |
CN103620521A (en) * | 2011-06-24 | 2014-03-05 | 英特尔公司 | Techniques for controlling power consumption of a system |
WO2015143594A1 (en) * | 2014-03-24 | 2015-10-01 | Intel Corporation | Syncronization of interrupt processing to reduce power consumption |
Non-Patent Citations (2)
Title |
---|
TI-RTOS 2.20Power Management:MSP432,CC13xx/CC26xx,and CC3200 SimpleLink MCUs;佚名;《TEXAS INSTRUMENTS》;20160630;全文 * |
μC/O-SII内核扩展接口的低功耗模式;佚名;《http://news.eeworld.com.cn/qrs/xsjk/200604/5.html》;20060429;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN110489089A (en) | 2019-11-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7120911B1 (en) | Processor power-saving control method, storage medium, and processor power-saving control device | |
KR101522081B1 (en) | System and method of executing threads at a processor | |
CN101194231B (en) | Techniques for setting events in a multi-threaded system | |
CN105373207B (en) | A kind of idle method of wireless communication terminal | |
CN102455940B (en) | Processing method and system of timers and asynchronous events | |
CN102455933B (en) | Method for increasing multi-tasking efficiency through thread management | |
KR101551321B1 (en) | Method and system for scheduling requests in a portable computing device | |
TWI441083B (en) | Apparatus for performing timer management and associated method | |
CN103064736B (en) | Device and method for task processing | |
CN109343960A (en) | A kind of method for scheduling task of linux system, system and relevant apparatus | |
CN111475312B (en) | Message driving method and device based on real-time operating system | |
KR20000060827A (en) | method for implementation of transferring event in real-time operating system kernel | |
CN111580949A (en) | Automatic network packet receiving mode adjusting method | |
CN110489089B (en) | Embedded system low-power consumption control method and system based on interrupt management framework | |
CN116974728B (en) | Singlechip task scheduling method, singlechip product and storage medium | |
CN101349975B (en) | Method for implementing interrupt bottom semi-section mechanism in embedded operation system | |
CA2767782C (en) | Suspendable interrupts for processor idle management | |
CN111813531B (en) | Clock scheduling method and system for operating system | |
CN110794759A (en) | PLC task scheduling method and device | |
Kopják et al. | Event-driven control program models running on embedded systems | |
CN114035926A (en) | Application thread scheduling method and device, storage medium and electronic equipment | |
US7269677B2 (en) | Power consumption reduction and quicker interruption response in an information processing device utilizing a first timer and a second timer wherein the second timer is only conditionally activated | |
CN112597413A (en) | Novel embedded system frame and equipment | |
CN102096604B (en) | Reader and RO (Read Only) rule scheduling method thereof | |
CN117407053A (en) | Quick transplanting method for open source hong Mongolian operating system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |