CN105807892A - Low power consumption mode switching method of embedded real time operating system - Google Patents

Low power consumption mode switching method of embedded real time operating system Download PDF

Info

Publication number
CN105807892A
CN105807892A CN201610136666.9A CN201610136666A CN105807892A CN 105807892 A CN105807892 A CN 105807892A CN 201610136666 A CN201610136666 A CN 201610136666A CN 105807892 A CN105807892 A CN 105807892A
Authority
CN
China
Prior art keywords
power consumption
low
consumption mode
idletask
task
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
CN201610136666.9A
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.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
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 Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN201610136666.9A priority Critical patent/CN105807892A/en
Publication of CN105807892A publication Critical patent/CN105807892A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3206Monitoring of events, devices or parameters that trigger a change in power modality
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/329Power saving characterised by the action undertaken by task scheduling

Abstract

The invention discloses a low power consumption mode switching method of an embedded real time operating system. According to the method, judgment logic is added in the built-in idle task body of the system. The judgment logic comprises following steps of automatically entering into a sleep mode if continuous operation time of entering into an idle task exceeds a specific value; trigging an interruption waking system by a timer according to a relatively long time interval; finishing a plurality of times of system tick all at once; and waking all timed triggering tasks in a time period all at once, thus realizing aligned waking. According to the method, the real time operating system is enabled to have the capability of automatically entering into and withdrawing from the low power consumption mode. Compared with a Tickless strategy, the aligned waking strategy has the advantages that the execution time of the tasks needing to be executed in a time period is combined in a scene without a strict timeliness demand, therefore the waking times can be reduced to a greater extent, and the energy consumption is reduced.

Description

A kind of low-power consumption mode changing method of embedded real-time operating system
Technical field
The invention belongs to field of computer technology, be specifically related to the low-power consumption mode changing method of a kind of embedded real-time operating system.
Background technology
In the use of microcontroller, the mode of power managed is often used to reduce the energy consumption of chip.After introducing real time operating system on a microcontroller, power managed becomes complicated, the particularly existence of the real time operating system Tick interference to park mode.
System Tick is the interface between real-time clock and operating system, and it is the minimum time of day of operating system that the module of operating system and time correlation and API (application programming interface) are substantially based on Tick, Tick.In embedded real-time operating system, timer module adopts two-stage timer mechanism: enumerator Counter and intervalometer Alarm, when main purpose is to solve hardware timer resource-constrained, the demand of multiple application layer one hardware timer of intervalometer multiplexing, solves the problem that simple intervalometer is inefficient.
In the two-stage timing mechanism of embedded real-time operating system, first the tick interrupt of hardware timer is associated with Counter, hardware timer down trigger each time all can add 1 in the count value of Counter, then Counter and Alarm is associated, Counter can compare with related Alarm according to its current count value, it may be judged whether triggers upper strata Alarm.Therefore the hardware timer in embedded real-time operating system and Counter can be many-one relationships, Counter and Alarm can also be the relation of one-to-many, and can Alarm normally use, and depends on the triggered as normal of bottom hardware timer interruption and at different levels associating.The down trigger of this hardware timer is exactly system Tick, and it has lowest priority, is considered system break, does not include the management that user is interrupted in.
System Tick is triggered by timer interruption, and under default setting, every 1ms triggers once, is used for constantly updating system time, and microcontroller wakes up from dormant state, and what rely on is also interrupt.Interruption is the guarantee that system can timely respond to external event, is that system carries out, with extraneous, the important means that information is mutual.Interrupting also being a kind of hardware mechanisms, when external interrupt triggers, CPU can preserve the value of part or all of depositor, and according to address set in advance, jumping to and process in the function interrupted, this function is referred to as interrupt service subroutine (InterruptServiceRoutine, ISR).
But after microcontroller enters dormant state, interrupting and task even without other, system Tick also can make the every 1ms of microcontroller wake up once, disturbs normal sleep procedure, as shown in Figure 1.In order to solve this technical problem, the real time operating systems such as FreeRTOS and MQX use Tickless mode to reduce and wake the impact that interference brings up, namely when needs enter before dormant state, first calculate the last interval needing and waking up, intervalometer triggered interrupts after this time period is set, to avoid invalid waking up, as shown in Figure 1;But in the tactful scene not strict at requirement of real-time of this Tickless, scattered execution task in a period of time is still such that system needs often to be waken up.
Summary of the invention
Above-mentioned technical problem existing for prior art, the invention provides the low-power consumption mode changing method of a kind of embedded real-time operating system, wake strategy up by idle task being optimized and aliging, it is possible to reduce the wake-up times of system to a greater extent, reduce system energy consumption.
A kind of low-power consumption mode changing method of embedded real-time operating system, including:
When the continuous operating time of system entrance IdleTask (idle task) exceedes the time threshold of setting, make system automatically into park mode;
Adopt alignment to wake strategy up and periodically wake up system: for arbitrary cycle, all triggering tasks of system in this cycle are collected, and the initial time playing this cycle when system is waken up plays batch and performs these triggering tasks, after tasks carryings all in this cycle, system is made to enter IdleTask and and then proceed to park mode.
The present invention calls Hook Function before and after the switching of each task.
Further, the Hook Function called before each task switches inserts decision logic, is IdleTask when this logical judgment goes out the next task of system, then system is switched to low power operation pattern.
Further, the Hook Function called after each task switches inserts decision logic, is IdleTask when this logical judgment goes out a upper task of system, then system is switched to normal operation mode.
Further, the Task entity of each IdleTask inserts decision logic, enter the continuous operating time of IdleTask exceed the time threshold of setting when this logical judgment goes out system, then system is switched to park mode.
Further, the present invention employs counters to record system and enters the continuous operating time of IdleTask.
Preferably, the present invention adopts the LPTMR (Low-PowerTimer, low-power consumption intervalometer) in microcontroller KinetisKL02 to be timed to periodically wake up system;System clock work can be independent of, and the ability of overlength interval wake-up interrupts triggering is provided.
When system is waken up, described LPTMR batch performs all of system Tick in next cycle the timed task corresponding to these system Tick of disposable triggering.
The Advantageous Effects of the present invention is in that: make real time operating system possess the ability automatically passing in and out low-power consumption mode, its alignment adopted wakes strategy up compared with Tickless strategy, in the scene that requirement of real-time is not strict, alignment wakes strategy up will need the task execution time performed to merge in a period of time, wake-up times can be reduced to a greater extent, reduce energy consumption.
Accompanying drawing explanation
Fig. 1 is that corresponding strategy, Tickless strategy and the present invention of not processing aligns and wake the transition diagram of microcontroller operation/park mode under strategy up.
Detailed description of the invention
In order to more specifically describe the present invention, below in conjunction with the drawings and the specific embodiments, technical scheme is described in detail.
The present invention is for the embodiment on FreescaleKinetisKL02 microcontroller and CyborganOS real time operating system.Wherein, CyborganOS is the artificial organ operating system platform that a bio-electronic combines, and it has carried out field customization and Function Extension based on tradition embedded OS architecture.FreescaleKinetisKL02 microcontroller is that Freescale is released, and is specifically designed to the SoC of small control field.The SoC that KL02 is a highly integrated, volume is very small and exquisite, the chip of 16 pin package, only 3mm × 3mm × 0.65mm, can closely be fitted on flexible PCB.In so small and exquisite encapsulation, it is integrated with MCU, ADC, DAC, PWM, SPI, UART, I2The conventional module such as C, it is possible to meet general functional development demand.In computing capability, KL02, based on ARMCortex-M0+ framework, uses 32 bit instruction collection, and normal clock frequency is 48MHz.KL02 has low-power consumption ability, under extremely low power dissipation operational mode, runs power consumption and is low to moderate 36 μ A/MHz, and during normal use, power consumption is low to moderate 2 μ A, is especially suitable for the applicable situation that power consumption requirements is strict.In storage, the most high energy of KL02 has 4KBRAM and 32KBFlash, when not carrying out storage extension, can not store and perform large program.
As FreescaleKinetisL series SOC(system on a chip), KL02 inherits the low-power consumption ability of KinetisL family chip, has the mode of operation of 7 kinds of different power consumption characteristics, under extremely low power dissipation operational mode, running power consumption and be low to moderate 36 μ A/MHz, quiescent dissipation is low to moderate 2 μ A.KL02 provides system model control (SystemModeController, SMC) module, it is possible to different power consumption mode of operation is configured and switches.Additionally, the low-power consumption intervalometer (Low-PowerTimer, LPTMR) that KL02 provides can be independent of system clock work, and provide the ability of overlength interval wake-up interrupts triggering.
Present embodiment adopts the RUN pattern of KL02 as normal operation mode, the VLPW pattern of KL02 is as park mode, the VLPR pattern of KL02 is as low power operation pattern, achieve function PM_SetMode (uint8mode) and control the switching of operational mode, wherein mode is pattern mask, 0 is normal mode, and 1 is park mode, and 2 is low-power consumption mode.
The technical scheme that present embodiment adopts includes following two parts:
(1) in the idle task body that system carries, decision logic is added so that after processor entrance idle task (IdleTask) continuous operating time exceedes particular value, it is possible to automatically into park mode.
In embedded real-time operating system, task is activated and performs generally there are two kinds of reasons: event triggers and clocked flip.The trigger source of event trigger mechanism is often external interrupt, for instance communication module, input comparison module etc., and when there being down trigger, inter-related task is activated executions, until after completing all tasks, system enters in IdleTask, waits next event triggering.Clocked flip mechanism refers to and utilizes Alarm module, periodically activates some tasks carrying, and clocked flip mechanism is often used for performing some sensor information acquisition tasks, and when not having tasks carrying, operating system can enter into IdleTask hollow and run.No matter which kind of pattern, when the system is idle, all can run in IdleTask hollow.In general operation system, a variable can be done increment operator to Infinite Cyclic by IdleTask, does not in addition do any other operation, only serves the effect occupying the cpu clock cycle, be the Task that priority is minimum.
IdleTask is improved by present embodiment, whenever task scheduling enters into before IdleTask, resets enumerator, enters the time of constantly detection counter record after IdleTask, when the time of record more than predetermined threshold time, automatically switch and enter park mode.Implementing aspect, present embodiment enters the time of IdleTask by a counter records, and system call code is modified.OsPreTaskHook and OsPostTaskHook is the Hook Function called before and after meeting in each task switch logic, wherein, OsPreTaskHook calls before task switches, and OsPostTaskHook calls after task switches, and two functions all operate in critical zone.The present embodiment, in OsPreTaskHook function, inserts judgement: when next task is IdleTask, performs PM_SetMode (2) and is switched to low power operation pattern, and resets enumerator;In OsPostTaskHook function, insert judgement: when a upper task is IdleTask, perform PM_SetMode (0) and switch back into normal operation mode.In the Task entity of IdleTask, insert decision logic: when enumerator currency is more than, when setting threshold value, performing PM_SetMode (1) and enter park mode.
(2) intervalometer wakes system up with triggered interrupts longer interval time, and disposable completes several times system Tick, makes all clocked flip tasks in the time period complete in once waking up, accomplishes " alignment wakes up ".
Present embodiment adopts " alignment wakes up " strategy, will need to wake up the task of execution in a period of time, moves to unification at the same time and performs in bulk after waking up.As shown in Figure 1;When there is multiple proportion in the activation period of multiple Task, an interval can be selected, periodically wake up, after waking up every time, will triggering in the following cycle of task carries out batch trigger, after tasks carrying, operating system enters IdleTask, and and then proceeds to park mode.
For realizing " alignment wakes up " strategy, present embodiment have changed the triggering mode of system Tick.In original design, system Tick is triggered once by the every 1ms of intervalometer, has detected whether that Alarm expires, overdue Alarm object is performed operation.In present embodiment, use LPTMR to replace common hardware intervalometer, so can obtain longer timing cycle.User specifies the cycle of LPTMR periodic wakeup in configuration file, and when down trigger, LPTMR is the system Tick of batch number of times in ISR, triggers all Alarm objects satisfied condition.Such as, if user is 500 at configuration file middle finger fixed cycle wake-up period, then the every 500ms of LPTMR triggers and once interrupts, and system is waken up from resting state, and continuously performs 500 subsystem Tick, triggers overdue Alarm object successively.
The above-mentioned description to embodiment is to be understood that for ease of those skilled in the art and apply the present invention.Above-described embodiment obviously easily can be made various amendment by person skilled in the art, and General Principle described herein is applied in other embodiments without through performing creative labour.Therefore, the invention is not restricted to above-described embodiment, those skilled in the art's announcement according to the present invention, the improvement made for the present invention and amendment all should within protection scope of the present invention.

Claims (8)

1. the low-power consumption mode changing method of an embedded real-time operating system, it is characterised in that:
When the continuous operating time of system entrance IdleTask exceedes the time threshold of setting, make system automatically into park mode;
Adopt alignment to wake strategy up and periodically wake up system: for arbitrary cycle, all triggering tasks of system in this cycle are collected, and the initial time playing this cycle when system is waken up plays batch and performs these triggering tasks, after tasks carryings all in this cycle, system is made to enter IdleTask and and then proceed to park mode.
2. low-power consumption mode changing method according to claim 1, it is characterised in that: before and after the switching of each task, call Hook Function.
3. low-power consumption mode changing method according to claim 2, it is characterized in that: the Hook Function called before each task switches inserts decision logic, it is IdleTask when this logical judgment goes out the next task of system, then system is switched to low power operation pattern.
4. low-power consumption mode changing method according to claim 2, it is characterized in that: the Hook Function called after each task switches inserts decision logic, it is IdleTask when this logical judgment goes out a upper task of system, then system is switched to normal operation mode.
5. low-power consumption mode changing method according to claim 2, it is characterized in that: in the Task entity of each IdleTask, insert decision logic, enter the continuous operating time of IdleTask exceed the time threshold of setting when this logical judgment goes out system, then system is switched to park mode.
6. low-power consumption mode changing method according to claim 1 or 5, it is characterised in that: employ counters to record system and enter the continuous operating time of IdleTask.
7. low-power consumption mode changing method according to claim 1, it is characterised in that: adopt the LPTMR in microcontroller KinetisKL02 to be timed to periodically wake up system.
8. low-power consumption mode changing method according to claim 7, it is characterised in that: when system is waken up, described LPTMR batch performs all of system Tick in next cycle the timed task corresponding to these system Tick of disposable triggering.
CN201610136666.9A 2016-03-10 2016-03-10 Low power consumption mode switching method of embedded real time operating system Pending CN105807892A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610136666.9A CN105807892A (en) 2016-03-10 2016-03-10 Low power consumption mode switching method of embedded real time operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610136666.9A CN105807892A (en) 2016-03-10 2016-03-10 Low power consumption mode switching method of embedded real time operating system

Publications (1)

Publication Number Publication Date
CN105807892A true CN105807892A (en) 2016-07-27

Family

ID=56467169

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610136666.9A Pending CN105807892A (en) 2016-03-10 2016-03-10 Low power consumption mode switching method of embedded real time operating system

Country Status (1)

Country Link
CN (1) CN105807892A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107656802A (en) * 2017-09-22 2018-02-02 中国科学技术大学苏州研究院 Time trigger instruction collection, coprocessor and device
WO2019001331A1 (en) * 2017-06-27 2019-01-03 阿里巴巴集团控股有限公司 Clock tick interrupt configuration method and device
CN109976501A (en) * 2017-12-28 2019-07-05 中移物联网有限公司 A kind of Low-power-consumptiocontrol control method, device, system and storage medium
CN110457120A (en) * 2019-07-22 2019-11-15 浙江大学 Aperiodic timer based on OSEK embedded real-time operating system is resident mechanism
CN111465087A (en) * 2020-03-31 2020-07-28 上海庆科信息技术有限公司 Task scheduling processing method, device, storage medium, processor and system
CN111679730A (en) * 2020-06-01 2020-09-18 深圳移航通信技术有限公司 Processor state control method and device based on FreeRTOS
WO2023273890A1 (en) * 2021-06-28 2023-01-05 中兴通讯股份有限公司 Energy-saving method, energy-saving device, electronic device, and computer-readable storage medium
CN115993996A (en) * 2023-03-22 2023-04-21 南京芯驰半导体科技有限公司 Method and system for realizing sleep mode based on RTOS

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100271176A1 (en) * 2009-04-28 2010-10-28 Samsung Electronics Co., Ltd. Method and apparatus for reducing power consumption in mobile terminal
CN103345415A (en) * 2013-07-30 2013-10-09 广东欧珀移动通信有限公司 Terminal energy-saving method and device for management timer
CN104239132A (en) * 2014-09-16 2014-12-24 深圳市中兴移动通信有限公司 Wakeup synchronization method, device and terminal

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100271176A1 (en) * 2009-04-28 2010-10-28 Samsung Electronics Co., Ltd. Method and apparatus for reducing power consumption in mobile terminal
CN103345415A (en) * 2013-07-30 2013-10-09 广东欧珀移动通信有限公司 Terminal energy-saving method and device for management timer
CN104239132A (en) * 2014-09-16 2014-12-24 深圳市中兴移动通信有限公司 Wakeup synchronization method, device and terminal

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019001331A1 (en) * 2017-06-27 2019-01-03 阿里巴巴集团控股有限公司 Clock tick interrupt configuration method and device
US11216023B2 (en) 2017-06-27 2022-01-04 Alibaba Group Holding Limited Clock tick interrupt configuration method and apparatus
CN107656802A (en) * 2017-09-22 2018-02-02 中国科学技术大学苏州研究院 Time trigger instruction collection, coprocessor and device
CN109976501A (en) * 2017-12-28 2019-07-05 中移物联网有限公司 A kind of Low-power-consumptiocontrol control method, device, system and storage medium
CN110457120A (en) * 2019-07-22 2019-11-15 浙江大学 Aperiodic timer based on OSEK embedded real-time operating system is resident mechanism
CN111465087A (en) * 2020-03-31 2020-07-28 上海庆科信息技术有限公司 Task scheduling processing method, device, storage medium, processor and system
CN111679730A (en) * 2020-06-01 2020-09-18 深圳移航通信技术有限公司 Processor state control method and device based on FreeRTOS
CN111679730B (en) * 2020-06-01 2022-06-07 深圳移航通信技术有限公司 Processor state control method and device based on FreeRTOS
WO2023273890A1 (en) * 2021-06-28 2023-01-05 中兴通讯股份有限公司 Energy-saving method, energy-saving device, electronic device, and computer-readable storage medium
CN115993996A (en) * 2023-03-22 2023-04-21 南京芯驰半导体科技有限公司 Method and system for realizing sleep mode based on RTOS

Similar Documents

Publication Publication Date Title
CN105807892A (en) Low power consumption mode switching method of embedded real time operating system
US9152199B2 (en) Power state dependent wake-up alarm
US10564705B2 (en) Platform power consumption reduction via power state switching
KR101629989B1 (en) Method for the deterministic execution and synchronisation of an information processing system comprising a plurality of processing cores executing system tasks
CN109918141B (en) Thread execution method, thread execution device, terminal and storage medium
CN102918474B (en) Power management lock optimizes
CN102163072B (en) Software-based thread remapping for power savings
CN102385531B (en) Apparatus for performing timer management and associated method
CN112530056B (en) Method for reducing power consumption of intelligent door lock, intelligent door lock and storage medium
CN107479816B (en) Recognition methods, device, storage medium and the mobile terminal of blank screen gesture
CN103765409A (en) Power efficient processor architecture
TWI578152B (en) Apparatus, article and controller for entering a low power state
CN104798039A (en) Techniques for platform duty cycling
JP2002202893A (en) Method for controlling execution of multiplex task and processing circuit
CN106502687A (en) A kind of method and terminal for entering resting state
CN101171563A (en) Sleep watchdog circuit for asynchronous digital circuits
CN104111850A (en) Method and system for reducing power consumption of MCU (Micro-Control Unit)
CN109324879A (en) The method and terminal device of Admin Trigger
CN104969190B (en) The processing of multi-core Binary Conversion task
CN106681472A (en) Heterogeneous multi-core processor power consumption control device and method
CN111225434A (en) Application response method, system, storage medium and communication module
CN105242770B (en) A kind of method and system of Android device folding lid
US20160091949A1 (en) Performance management for a multiple-cpu platform
CN109992314A (en) Data reporting method, device, terminal and storage medium
CN116825013A (en) Control device, control method and related equipment of display screen

Legal Events

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

Application publication date: 20160727