CPU low power standby method and medium
By configuring the CPUIDLE module in the CPU standby state to turn off the CPU power, the problem of high static power consumption of the CPU is solved, low-power standby is achieved, and platform performance is significantly optimized.
Patent Information
- Application Number
- CN202110694023.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-22
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-06-22
AI Technical Summary
When the system is standby, the CPU cannot be turned off, resulting in large static power consumption, affecting the user experience. The prior art has limited power saving effect by reducing the clock frequency and has an impact on system performance.
By configuring the CPUIDLE module before the CPU lowers the system clock, turning off the CPU power, and restoring the CPU power when the wake-up source arrives, and executing recovery codes, the CPU low-power standby state of the CPU is achieved.
It greatly reduces the static power consumption of the CPU and truly realizes low-power standby. Especially on platforms with large static power consumption of the CPU, it has significant effects and optimizes platform performance.
Smart Images

Figure CN113467597B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a low-power power supply control method, and in particular to a CPU low-power standby method and medium. Background Art
[0002] System standby has always been a very important function for user experience. For most low-cost chips, the CPU is still powered on when the system is in standby mode, and there is still some energy consumption, which affects the user experience. For some chips, due to wake-up source restrictions, wake-up source filtering requirements, and MCUs without power management, the CPU power still needs to be turned on when in standby mode.
[0003] The common practice in the industry is to shut down as many modules as possible in software and reduce the CPU clock frequency. The usual SOC standby process: After the CPU completes the execution of the low-power program, it lowers its own clock and enters the low-power WFI standby state. At this time, the CPU is powered on and still has a large static power consumption. When an external interrupt occurs, the CPU's standby state is interrupted and the CPU continues to execute the next instruction of WFI. Since the CPU cannot be turned off, the only way to save power is to reduce the CPU clock frequency to save static power consumption, but this has limited effect and has a certain impact on system performance when the clock is too low. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a CPU low-power standby method, which can further reduce the power consumption of the CPU during standby through a CPUIDLE module.
[0005] The present invention also provides a computer-readable storage medium for implementing the above method.
[0006] According to the first aspect of the present invention, the method for low-power standby of a CPU includes: before the CPU reduces the system clock and enters the WFI state, configuring a CPUIDLE module; when in standby mode, the CPUIDLE module turns off the CPU power according to the configuration; when a wake-up source arrives, the CPUIDLE module powers on the CPU; after the CPUIDLE module turns on the CPU power, the CPU executes an SRAM recovery code.
[0007] According to some embodiments of the present invention, the method further comprises: writing the recovery code path into an entry register of the CPU; and according to the recovery code path, the CPU executes the recovery code.
[0008] According to some embodiments of the present invention, the method further includes: when a wake-up source arrives, the CPUIDLE module resumes the CPU to the assembly code cpu_resume.
[0009] According to some embodiments of the present invention, the method further includes: presetting a wake-up source, and judging whether the incoming wake-up source meets the requirement according to the preset wake-up source.
[0010] According to some embodiments of the present invention, the method further includes: when the wake-up source does not meet the requirement, continuing the standby state, and using the CPUIDLE module to turn off the CPU power supply.
[0011] According to some embodiments of the present invention, the method further includes: S101, peripherals enter low power consumption mode; S102, transfer sleep code to SRAM; S103, DRAM enters self-refresh; S104, CPU reduces system bus clock; S105, configures CPUIDLE module; S106, CPU enters WFI state; S107, determines the core shutdown flag and the WFI state of CPU; S108, turns off the CPU power and clears the core shutdown flag. The core shutdown flag is used to control the shutdown of the CPU core.
[0012] According to some embodiments of the present invention, the method also includes: S201, setting the gic irq state; S202, determining that the CPU has been powered off; S203, turning on the CPU power; S204, the CPU executes the recovery code in the SRAM; S205, filtering the wake-up source; S206, the CPU restores the system bus clock; S208, DRAM exits self-refresh; S209, executing the DRAM recovery code; S210, the peripheral exits the low power mode.
[0013] According to the computer-readable storage medium of the second aspect embodiment of the present invention, the computer storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer storage medium is located is controlled to execute a method as described in any one of the embodiments of the first aspect of the present invention.
[0014] The embodiments of the present invention have at least the following beneficial effects: the embodiments of the present invention shut down the CPU through the CPUIDLE module, greatly reducing energy consumption and truly achieving green environmental protection; it has an optimization effect on platforms with CPUIDLE, and the greater the CPU static power consumption, the more obvious the effect.
[0015] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0017] Figure 1FIG. 1 is a flowchart of a common SOC standby method.
[0018] Figure 2 The figure is a flowchart of a method according to an embodiment of the present invention.
[0019] Figure 3 FIG. 4 is a flow chart of a method according to another embodiment of the present invention. DETAILED DESCRIPTION
[0020] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0021] In the description of the present invention, the step numbers are merely identifications made for the convenience of description or reference, and should not be understood as a limitation on the operating sequence of the steps.
[0022] Reference Figure 1 , usually the SOC standby process is as follows Figure 1 As shown. After the CPU completes the execution of the low-power program, it lowers its own clock and enters the low-power WFI standby state. At this time, the CPU is powered on and still has a large static power consumption. When an external interrupt occurs, the CPU's standby state is interrupted and the CPU continues to execute the next instruction of WFI.
[0023] Reference Figure 2 , the method of the embodiment of the present invention includes: S101, the peripheral enters the low power mode; S102, the sleep code is moved to SRAM; S103, the DRAM enters the self-refresh; S104, the CPU reduces the system bus clock; S105, configures the CPUIDLE module; S106, the CPU enters the WFI state; S107, determines the core shutdown flag and the WFI state of the CPU; S108, turns off the CPU power and clears the core shutdown flag. S201, the gic irq state is set; S202, determines that the CPU has been powered off; S203, turns on the CPU power; S204, the CPU executes the recovery code in the SRAM; S205, filters the wake-up source; S206, the CPU restores the system bus clock; S208, the DRAM exits the self-refresh; S209, executes the DRAM recovery code; S210, the peripheral exits the low power mode.
[0024] In this embodiment, the CPUIDLE hardware module is used to turn off the CPU power switch during standby mode to further save CPU static power consumption. As shown in sequence number 1, before the CPU reduces the system clock and enters the WFI standby state, the CPUIDLE module is configured to turn off the power switch during standby mode, and the CPU cache, etc. will also be turned off. The box contains the CPUIDLE hardware behavior, which is implemented as a state machine inside the CPUIDLE hardware. After using the CPUIDLE function, the hardware will turn off the CPU power switch when the CPU enters the WFI state. Since the CPU will be powered off by the CPUIDLE hardware, when a wake-up source arrives, the CPU needs to re-establish the C execution environment. Figure 2 The sequence number 2 shows the first process executed after the CPU is powered on by the CPUIDLE module.
[0025] Further references Figure 3 When the corresponding wake-up source arrives, the CPUIDLE hardware restores the CPU to the assembly code cpu_resume, and simply restores the CPU's C language execution environment. After that, the get_wakeup_source function is executed. When the wake-up source does not meet the requirements, the do_idle function continues to use the CPUIDLE hardware to turn off the CPU power switch to save power.
[0026] The present invention has an optimization effect on a platform with CPUIDLE, and the greater the CPU static power consumption, the more obvious the effect.
[0027] Although specific embodiments are described herein, those of ordinary skill in the art will recognize that many other modifications or alternative embodiments are also within the scope of the present disclosure. For example, any of the functions and / or processing capabilities described in conjunction with a particular device or component may be performed by any other device or component. In addition, although various exemplary implementations and architectures have been described according to embodiments of the present disclosure, those of ordinary skill in the art will recognize that many other modifications to the exemplary implementations and architectures described herein are also within the scope of the present disclosure.
[0028] Some aspects of the present disclosure are described above with reference to the block diagram and flow chart of the system, method, system and / or computer program product according to exemplary embodiments.It should be understood that the combination of one or more blocks in the block diagram and flow chart and the blocks in the block diagram and flow chart can be realized by executing computer executable program instructions respectively.Equally, according to some embodiments, some blocks in the block diagram and flow chart may not need to be executed in the order shown, or may not need to be executed in full.In addition, additional components and / or operations beyond those components and / or operations shown in the blocks in the block diagram and flow chart may be present in certain embodiments.
[0029] Therefore, the blocks in the block diagrams and flow charts support the combination of devices for performing the specified functions, the combination of elements or steps for performing the specified functions, and the program instruction devices for performing the specified functions. It should also be understood that each block in the block diagrams and flow charts and the combination of blocks in the block diagrams and flow charts can be implemented by a special-purpose hardware computer system or a combination of special-purpose hardware and computer instructions that performs a specific function, element or step.
[0030] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present invention.
Claims
1. A method for low-power standby of CPU, It is characterized in that include: The CPU reduces the system clock so that the CPU enters a low-power WFI standby state, and before the CPU enters the WFI state, a CPUIDLE module is configured; When in standby mode, the CPUIDLE module turns off the CPU power supply according to the configuration; When the wake-up source arrives, the CPUIDLE module powers on the CPU and restores the CPU to the assembly code to restore the C language execution environment of the CPU; After the CPUIDLE module turns on the CPU power, the CPU executes the SRAM recovery code and confirms whether the wake-up source meets the execution requirement of the CPU. When the wake-up source does not meet the execution requirement, the CPUIDLE module continues to turn off the CPU power.
2. The CPU low power standby method according to claim 1, It is characterized in that The method further comprises: Write the recovery code path into the CPU entry register; According to the recovery code path, the CPU executes the recovery code.
3. The CPU low power standby method according to claim 1, It is characterized in that The method further includes: when a wake-up source arrives, the CPUIDLE module restores the CPU to the assembly code cpu_resume.
4. The CPU low power standby method according to claim 1, It is characterized in that The method further includes: presetting a wake-up source, and judging whether the incoming wake-up source meets the requirement according to the preset wake-up source.
5. The CPU low power standby method according to claim 4, It is characterized in that The method further comprises: when the wake-up source does not meet the requirement, continuing the standby state, and using the CPUIDLE module to turn off the CPU power supply.
6. The CPU low power standby method according to claim 1, It is characterized in that The method further comprises: S101, peripherals enter low power consumption mode; S102, moving the sleep code to SRAM; S103, DRAM enters self-refresh; S104, the CPU reduces the system bus clock; S105, configure CPUIDLE module; S106, CPU enters WFI state; S107, the CPUIDLE module hardware determines the core shutdown flag and the CPU WFI status; S108, turn off the CPU power and clear the shutdown flag.
7. The CPU low power standby method according to claim 6, It is characterized in that The method further comprises: S201, gic irq state is set; S202, determining that the CPU has been powered off; S203, turn on the CPU power; S204, the CPU executes the recovery code in the SRAM; S205, filtering the wake-up source; S206, the CPU restores the system bus clock; S208, DRAM exits self-refresh; S209, executing DRAM recovery code; S210, the peripheral device exits the low power consumption mode.
8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium comprises a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method for reducing CPU power consumption and CPU
CN101581962A
Method for reducing CPU power consumption in embedded system
CN101727171A
Circuit and method for managing SOC chip by low-power consumption mode based on clock off
CN102799260A
Method for reducing power dissipation of ucos-ii system
CN104375620A
Electronic circuit system and power consumption reducing method thereof
CN105487638A
