A method and system for entering a low power consumption mode of a microcontroller

Through task scheduling queue conversion and resource demand characteristic analysis, the microcontroller's low-power mode entry is optimized, which solves the problem of unfairness and accuracy of low-power mode entry in the existing technology and achieves more efficient power consumption management.

CN118331713BActive Publication Date: 2024-10-29江苏云途半导体有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410755429.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-10-29
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

The existing low-power mode entry method fails to combine the operating system level and task big data information, and fails to fully consider the resource sharing characteristics within the task group, resulting in unfair execution of different tasks when entering the low-power mode, and does not fully consider the resource sharing characteristics within the task group. Can perform quantitative calculations, affecting accuracy.

Method used

By obtaining the task scheduling queue, converting it into an initial task execution sequence, splitting and merging task groups, determining the microcontroller operating mode based on static and dynamic resource demand characteristics, and merging task sub-sequences to optimize low-power mode entry.

Benefits of technology

It improves the accuracy and efficiency of low-power mode entry, ensures fairness and dynamic adjustment of resource requirements, and reduces decision-making time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118331713B_ABST
    Figure CN118331713B_ABST
Patent Text Reader

Abstract

The present invention relates to a method and system for entering a low power consumption mode of a microcontroller, the method comprising: in the process of microcontroller operation, before the corresponding task subsequence in the task execution sequence is executed, obtaining the microcontroller operation mode / low power consumption mode corresponding to the task subsequence, and sending a mode entry instruction based on the operation mode to make the microcontroller enter the corresponding low power consumption mode. The present invention starts with the resource demand characteristics, guides the entry of the operation mode or low power consumption mode through quantitative analysis based on the combination of dynamic and static information, and improves the accuracy of entering the operation mode or low power consumption mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of low-power microcontrollers, and in particular relates to a method and system for entering a low-power mode of a microcontroller. Background Art

[0002] MCU is also called a single-chip microcomputer or single-chip microcomputer. ADC (Analog-to-Digital Converter) is one of the peripherals of MCU chip. In product application development, ADC has many application scenarios. At the same time, users have more and more demands for MCU chips in low-power mode. In the field of embedded application technology, microcontroller is its core component. Microcontroller chips are integrated with a certain capacity of memory, GPIO interface, PLL, RTC, timer, watchdog, ADC, DAC, SPI, serial port and other modules.

[0003] With the continuous development and progress of society and technology, security chips and smart card chips have been widely used in many fields, and have been popularized and promoted in the fields of banking, social security, ID cards, public transportation, and identity recognition. However, with the continuous changes in market demand, higher performance requirements are put forward for chips. As the main control unit, the microcontroller needs to provide more power saving to support better standby and real-time response speed.

[0004] The working state of a microcontroller can generally be divided into operating mode and low power mode. Of course, the low power mode can also be subdivided into some specific modes, such as low power mode and ultra-low power mode. In some applications where a microcontroller is used as the main control chip, especially in low-power applications, the power consumption of the main control chip is particularly important.

[0005] The following problems exist in the prior art: (1) The low-power entry method in the prior art cannot provide guidance at the software level based on the situation reflected at the operating system level, and combine soft and hard indicators to guide the entry into the low-power mode; therefore, it is even more impossible to use the big data information presented by the task to guide the entry into the low-power mode; (2) When performing task resource demand analysis, the impact of task competition and sharing on resources is often considered simultaneously, but the resource sharing characteristics between tasks in the task group are not considered, so that when controlling the entry into the low-power mode, fair indicator guidance is provided for the parallel execution of different tasks; (3) The guiding role of static task analysis is not fully considered, so the entry into the low-power mode can only be guided based on the real-time information temporarily obtained, and no time is left for sufficient quantitative calculation. Based on the above problems, the present invention starts from the resource demand characteristics, guides the entry into the operating mode or low-power mode through quantitative analysis based on the combination of dynamic and static information, and improves the accuracy of entering the operating mode or low-power mode. Summary of the invention

[0006] In order to solve the above problems in the prior art, the present invention proposes a method and system for entering a low power consumption mode of a microcontroller, the method comprising:

[0007] Step S1: Obtain a task scheduling queue of a microcontroller, and convert the task scheduling queue into an initial task execution sequence according to the task parallelism of the microcontroller, the order of tasks in the task scheduling queue and their estimated execution time; wherein: the initial task execution sequence includes one or more task groups arranged in order of execution, and the task group includes one or more tasks executed in parallel; and the execution time length of the task group is set according to the estimated execution time of the tasks in the task group;

[0008] Step S2: According to the resource requirements of each task / task group in the initial task execution sequence, the initial task execution sequence is further divided and merged according to the resource requirements of the tasks / task groups during the execution process to obtain a task execution sequence; Step S2: Step S2 specifically includes the following steps:

[0009] Step S21: sequentially process each task group in the initial task execution sequence; perform static analysis on each task in the task group; if the task presents different resource requirements at different stages in the execution process, split the task into multiple subtasks according to the execution stage, and replace the position of the task in the task group with the multiple subtasks, and then split the task group according to the multiple subtasks, combine each different subtask with other tasks in the task group to obtain multiple task groups after splitting, and replace the position of the task group in the task execution sequence with the task groups obtained after splitting; repeat this step until all task groups are processed; update the execution time length attribute of each task group;

[0010] Step S22: sequentially process each task group in the initial task execution sequence after the task group splitting is completed; obtain historical resource demand data generated by the task group executing on the microcontroller; and set the resource demand characteristics of the task group based on the historical resource demand data of the task group on the current microcontroller;

[0011] Specifically: for each task group, if there is only one task in the task group, filter the historical resource demand data generated when the task is executed alone, calculate the average value and set the resource demand characteristics of the task group. ; When there are multiple tasks in a task group, filter the resource demand data presented when all tasks of the task group are executed in parallel in the historical resource demand data, and set its average value as the resource demand characteristic of the task group ;in: is the task number, is the task group number; is the kth resource requirement feature of the tth task; K is the total number of resource requirement features;

[0012] Step S23: determining the microcontroller operation mode / low power consumption mode corresponding to the task group based on the resource requirement characteristics of the task group; specifically: taking the microcontroller operation mode or low power consumption mode with the minimum power consumption that can meet various types of resource requirements of the task group as the microcontroller operation mode corresponding to the task group;

[0013] Step S24: merging the task groups in the initial task execution sequence according to the microcontroller operation mode / low power consumption mode; after merging, the task groups contain one or more continuous task subsequences; the task subsequence contains one or more task groups arranged in sequence; each task subsequence corresponds to a same microcontroller operation mode / low power consumption mode, which is called a task execution sequence after merging; specifically: in the initial state, each task group is regarded as a task subsequence containing a task group; the execution time length of each task subsequence is set to the execution time length of the task group it contains; the microcontroller operation mode / low power consumption mode of the task group is used as the microcontroller operation mode / low power consumption mode of the task subsequence; if the microcontroller operation modes / low power consumption modes corresponding to adjacent task subsequences are the same and the distance between adjacent task subsequences is less than the distance threshold, then the adjacent task subsequences are merged; the execution time length corresponding to each task subsequence is merged, and the same microcontroller operation mode / low power consumption mode is used to associate it with the task subsequence;

[0014] The distance between adjacent task subsequences is calculated using the following formulas (1)-(3): ;in: is the adjustment factor associated with the kth resource type; is the execution time length of task group tg; tgt is a temporary task group variable; is the execution time length of the temporary task group tgt, is the resource requirement characteristic of the kth resource type of task t; and is a contiguous subsequence of tasks; is a task subsequence Task Force The impact factor, is a task subsequence Task Force Impact factor;

[0015] ;

[0016] ;

[0017] ;

[0018] Step S3: During the operation of the microcontroller, before the corresponding task subsequence in the task execution sequence is executed, the microcontroller operation mode / low power consumption mode corresponding to the task subsequence is obtained, and a mode entry instruction is sent based on the operation mode / low power consumption mode to make the microcontroller enter the corresponding operation mode / low power consumption mode.

[0019] Furthermore, the tasks contained in adjacent task groups are not completely the same.

[0020] Furthermore, the task parallelism is equal to the number of cores in the microcontroller.

[0021] Furthermore, the distance threshold is a preset value.

[0022] Furthermore, the execution time lengths corresponding to different tasks, task groups, and task subsequences are the same or different.

[0023] Furthermore, the microcontroller is a vehicle-mounted microcontroller.

[0024] A microcontroller low power mode entry system is provided, and the microcontroller low power mode entry system is used to implement the above-mentioned microcontroller low power mode entry method.

[0025] A microcontroller low power mode entry control device is used to implement the microcontroller low power mode entry method.

[0026] A microcontroller low power mode entry control module is provided, and the microcontroller low power mode entry control module is used to implement the above-mentioned microcontroller low power mode entry method.

[0027] A microcontroller low power mode entry control circuit, characterized in that the microcontroller low power mode entry module is used to implement the above-mentioned microcontroller low power mode entry method.

[0028] The beneficial effects of the present invention include:

[0029] (1) Starting from the operating system level, the task scheduling queue is converted into a task execution queue that can support the parallelism of the microcontroller through task input and structure analysis. The task execution queue is split into task sub-sequences corresponding to different microcontroller operation modes by combining static resource demand conditions and historical resource demand data based on dynamic resource demand conditions. By pre-building microcontroller operation modes corresponding to different task sub-sequences, the decision time for entering the low-power mode is greatly reduced, thereby improving the mode entry efficiency.

[0030] (2) In terms of parallelism support, the current microcontroller resource configuration and the microcontroller resource configuration are used to determine the resource demand. When multiple tasks are executed in parallel in the task group and resource sharing and competition occur, the resource sharing characteristics between the tasks in the task group are brought into play, and resource competition caused by the same resource preference is avoided, thereby improving the fairness of the description of resource demand characteristics in different resource provision environments.

[0031] (3) The resource demand characteristics are used to continuously describe the dynamic demand of tasks, task groups, and task execution subsequences, thereby supporting the description of the resource demand status of tasks in competitive and shared environments, and further enabling the quantitative calculation of the task execution status corresponding to the task subsequence composed of the task group and its corresponding microcontroller low power mode, greatly improving the accuracy of dynamically adjusting the entry into the low power mode as the task is executed;

[0032] Furthermore, by using forward distance and backward distance for quantitative description, only less calculation is required to guide the optimal formation of task subsequences; by merging revocations, the accuracy of entering the low-power mode is further improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present application, but do not constitute an improper limitation of the present invention. In the drawings:

[0034] Figure 1 A schematic diagram of a method for entering a low power consumption mode of a microcontroller provided by the present invention. DETAILED DESCRIPTION

[0035] The present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments, wherein the illustrative embodiments and descriptions are only used to explain the present invention but are not intended to limit the present invention.

[0036] The present invention provides a method and system for entering a low power consumption mode of a microcontroller, as shown in the attached Figure 1 As shown, the method comprises the following steps:

[0037] Step S1: Obtain the task scheduling queue on the microcontroller, and convert the task scheduling queue into an initial task execution sequence; wherein: the initial task execution sequence includes one or more task groups arranged in order of execution, and the task group includes one or more tasks executed in parallel; set the execution time length attribute for each task group; specifically: obtain the tasks to be scheduled in the task scheduling queue and their estimated execution time; arrange the tasks according to the estimated execution time, the task parallelism of the microcontroller, and the order of tasks in the task scheduling queue to construct an initial task execution sequence, and set the execution time length of the task group according to the estimated execution time of the tasks in the task group; of course, it is assumed here that the tasks contained in adjacent task groups are not completely the same;

[0038] Since the microcontroller has task parallelism, the microcontroller can support the parallel execution of multiple tasks at the same time point, thus forming a task group. The tasks in the task group are executed simultaneously within the execution time length corresponding to the task group, thus forming a task execution queue. Of course, resource sharing and competition will occur when executing simultaneously; and the number of tasks contained in the task group is less than or equal to the task parallelism; the execution time length of each task in the task group is the same or nearly the same; for example: task execution sequence (A-> (B, C) -> (B, D) -> E) where: A~E are tasks, -> indicates the order of tasks, in this example, the parallelism is 2, so B and C are executed at the same time. After C is executed, B has not yet been executed. At this time, the next element in the sequence is (B, D). At this time, B and D are executed simultaneously until both are almost completed at the same time, and then the execution of task E begins;

[0039] Preferably: the execution time is estimated in advance according to the input data value of the task, the input data set and the execution process of the included executable body;

[0040] Preferably: the task provider estimates the task execution time in advance according to the dynamic execution performance of the task; for example: the task execution time length can be obtained by simulation or testing;

[0041] Preferably: the task parallelism is equal to the number of cores in the microcontroller; for a microcontroller with simultaneous multithreading, its task parallelism needs to be multiplied by the number of simultaneous multithreading;

[0042] Preferably: when constructing the initial task execution sequence, the order of the tasks in the initial task execution sequence is adjusted taking into account the real-time nature of the tasks, so that the latest completion time of the real-time tasks in the initial task execution sequence is guaranteed;

[0043] Step S2: According to the resource demand of each task / task group in the initial task execution sequence, the initial task execution sequence is further divided and merged according to the resource demand of the task / task group during the execution process to obtain a task execution sequence, and the resource demand of each element (task subsequence) in the divided task execution sequence remains stable or the same and is different from the resource demand of adjacent elements (task subsequences); wherein: the task execution sequence contains one or more task groups arranged in order of execution, and the task group contains one or more tasks; the stability here can be understood as being close to the same or close (limited by a threshold), or there is no large fluctuation in the resource demand of the element within the corresponding execution time length;

[0044] Step S2: Step S2 specifically includes the following steps:

[0045] Step S21: sequentially process each task group in the initial task execution sequence; perform static analysis on any task in the task group; if the task presents different resource requirements in different stages of the execution process, split the task into multiple subtasks according to the different execution stages, and replace the position of the task in the task group with the multiple subtasks, and then split the task group according to the multiple subtasks, combine each different subtask with other tasks in the task group to obtain multiple task groups after splitting, and replace the position of the task group in the task execution sequence with the task groups obtained after splitting; repeat this step until all task groups are processed; finally, set the execution time length attribute for each task group;

[0046] For example, for a task group (A, B), task A is split into A1, A2, A3, and the result is (A1, B) -> (A2, B) -> (A3, B); or because B has distinguishable program bodies at different stages, B is split at the same time, and the result is (A1, B1) -> (A2, B2) -> (A3, B3); Since the execution time of the task is actually taken into consideration during the splitting process, the execution time of the task group is equal to the execution time of any task / subtask or the longest task / subtask.

[0047] Preferably: the static analysis of the task is an analysis of various types of task execution bodies, input data values, and input data sets;

[0048] Preferably: obtaining static resource demand data of each task in the initial task execution sequence, and obtaining different resource demand conditions in different stages of the task execution process by analyzing the static resource demand conditions;

[0049] The different resource demand situations are presented, specifically: each resource type is divided into multiple value intervals in turn, and when the static resource demand data of the task in different stages falls into different intervals, it is determined that it presents different resource demand situations; of course, the interval division of resources can be carried out based on the historical resource demand data based on the actual historical data, so that the division is more meaningful; in addition, the determination of falling into different stages also needs to exclude overly detailed stage divisions, which will produce overly accurate stage glitches, thereby causing subsequent mode switching oscillations, which are not within the scope of this key discussion; in summary, it can be understood as dividing the resource demand space composed of K resource types into K-dimensional spaces to obtain multiple K-dimensional subspace intervals. When the static resource demand data falls into different K-dimensional subspaces, it indicates that its resource demand situation has changed; that is, different resource demand situations are presented; of course, this subspace division needs to conform to the physical meaning of the actual resource demand;

[0050] Step S22: sequentially process each task group in the initial task execution sequence after the task group splitting is completed; obtain the historical resource demand data generated by the task group executing on the microcontroller; set the resource demand characteristics of the task group based on the historical resource demand data of the task group on the current microcontroller; specifically: for each task group, if there is only one task in the task group, filter the historical resource demand data generated when the task is executed alone, calculate the average value and set the resource demand characteristics of the task group ; When there are multiple tasks in a task group, filter the resource demand data of all tasks of the task group in the historical resource demand data when they are executed in parallel, and set the average value as the resource demand characteristic of the task group ;in: is the task number, is the task group number; is the kth resource requirement feature of the tth task; K is the total number of resource requirement features;

[0051] Alternative: Merge the resource requirement characteristics of each task to obtain the resource requirement characteristics of the task group ;

[0052] The acquisition of historical resource demand data generated by the execution of the task group on the microcontroller is specifically as follows: when there is only one task in the task group, the historical resource demand data is historical data collected when it is executed on a microcontroller with the same or similar resource configuration as the current microcontroller; when the number of tasks in the task group exceeds one, the historical resource demand data is historical data collected when it is executed on a rich microcontroller; the resource configuration of the rich microcontroller is different from that of the current microcontroller, and the number of various types of resources on the rich microcontroller is greater than or equal to the number of corresponding types of resources on the first microcontroller; so that when multiple tasks are executed in parallel in the task group and resource sharing and competition occur, each task can use the required resources as much as possible, give play to the resource sharing characteristics between the tasks in the task group, and avoid resource competition caused by the same resource preference (for example: repeated oscillation and replacement of storage space), so that the characteristics can be set according to the actual resource demand of the task group;

[0053] Alternatively: obtaining the above historical resource demand data by simulation;

[0054] Preferably: a corresponding resource demand feature is set for each type of resource demand, and the resource demand feature is one or more;

[0055] Preferably: the historical resource demand data is dynamic resource demand data that changes with the task execution stage;

[0056] Preferably: the resource types or resource requirement types are corresponding, and are one or more, including: computing resources, register resources, cache resources, memory resources, communication resources, and / or IO, etc.;

[0057] Step S23: determining the microcontroller operation mode or low power consumption mode corresponding to the task group based on the resource requirement characteristics of the task group; specifically: taking the microcontroller operation mode or low power consumption mode with the minimum power consumption that can meet various types of resource requirements of the task group as the microcontroller operation mode corresponding to the task group;

[0058] Preferably: selecting a microcontroller operation mode or a low power consumption mode with the minimum power consumption and the number of various resources being greater than or equal to each resource requirement characteristic of the task group as the microcontroller operation mode corresponding to the task group;

[0059] Preferably: the execution time lengths corresponding to different tasks, task groups, and task subsequences are the same or different;

[0060] Step S24: merging the task groups in the initial task execution sequence according to the microcontroller operation mode or the low power consumption mode; making the merged task execution sequence contain one or more continuous task subsequences; the task subsequence contains one or more task groups arranged in sequence; each task subsequence corresponds to the same microcontroller operation mode / low power consumption mode, and after the merging is completed, a task execution sequence is obtained; specifically: in the initial state, each task group is regarded as a task subsequence containing one task group; the execution time length of each task subsequence is set to the execution time length of the task group it contains; the microcontroller operation mode or low power consumption mode of the task group is used as the microcontroller operation mode or low power consumption mode of the task subsequence; if the microcontroller operation mode / low power consumption mode corresponding to adjacent task subsequences is the same and the distance between adjacent task subsequences is less than the distance threshold, then the adjacent task subsequences are merged; the execution time length corresponding to each task subsequence is merged, and the same microcontroller operation mode or low power consumption mode is used to associate it;

[0061] The distance between adjacent task subsequences is calculated using the following formulas (1)-(3): ;in: is the adjustment factor associated with the kth resource type; is the execution time length of task group tg; tgt is a temporary task group variable; is the execution time length of the temporary task group tgt, is the resource requirement characteristic of the kth resource type of task t; and is an adjacent task subsequence, specifically: sq is a task subsequence, sqn is the previous or next adjacent task subsequence of sq; It is the impact factor, specifically, is a task subsequence Task Force The impact factor, is a task subsequence Task Force Impact factor;

[0062] ;

[0063] ;

[0064] ;

[0065] Preferably: the distance threshold is a preset value;

[0066] Alternatively, if the microcontroller operating modes / low power consumption modes corresponding to adjacent task subsequences are the same and the distance between adjacent task subsequences is less than a distance threshold, the adjacent task subsequences are merged, specifically: if the microcontroller operating modes / low power consumption modes corresponding to adjacent task subsequences are the same, the adjacent task subsequences are merged; specifically comprising the following steps: the task subsequences adjacent to the current task subsequence include the previous adjacent task subsequence and the next adjacent task subsequence; if the microcontroller operating modes or low power consumption modes corresponding to the previous adjacent task subsequence and the next adjacent task subsequence are the same as the microcontroller operating mode or low power consumption mode corresponding to the current task subsequence, then calculating the forward distance between the previous adjacent task subsequence of the current task subsequence, and calculating the forward distance between the previous adjacent task subsequence and the current task subsequence. The backward distance between the adjacent task subsequences after the task subsequence is selected, and the task subsequence corresponding to the smaller of the forward distance and the backward distance is selected as the merging object for merging; the microcontroller operation mode / low power mode of the merged task subsequence is updated; if the microcontroller operation mode / low power mode of the merged task subsequence changes, the merging operation is canceled for the first time; the task subsequence corresponding to the larger of the forward distance and the backward distance is tried as the merging object for merging; the microcontroller operation mode of the merged task subsequence is updated, and if the microcontroller operation mode or the low power mode of the merged task subsequence changes again, the merging operation is canceled again (at this time, the adjacent combination is abandoned); the above steps are repeated until there is no mergible task subsequence and / or all task subsequences have been tried to be merged;

[0067] The forward distance DB between the current task subsequence sq and the previous adjacent task subsequence sq-1 is calculated by using the following formulas (4) to (6); wherein: is the adjustment factor associated with the kth resource type; is the execution time length of task group tg; tgt is a temporary task group variable; is the resource requirement characteristic of the kth resource type of task t; is a task subsequence Task Force Impact factor;

[0068] ;

[0069] ;

[0070] ;

[0071] The backward distance DA between the current task subsequence sq and the next adjacent task subsequence sq+1 is calculated by using the following formula (5), (7), (8); wherein: is the adjustment coefficient associated with the kth hardware resource; is a task subsequence Task Force Impact factor;

[0072] ;

[0073] ;

[0074] Preferably: the adjustment factor is a preset value related to the resource availability of resource type k; when the microcontroller resource type k is a critical and scarce resource, set A larger value is set, otherwise, a smaller value is set;

[0075] The updating of the microcontroller operation mode / low power consumption mode of the merged task subsequence is specifically: setting the microcontroller operation mode of the merged task subsequence to the same microcontroller operation mode / low power consumption mode;

[0076] Alternatively: the updating of the microcontroller operation mode / low power consumption mode of the merged task group is specifically: merging the resource requirement characteristics of the task groups in the task subsequence based on the execution time of the task groups, and using the merged resource requirement characteristics as the resource requirement characteristics of the task subsequence , where: sq is the task subsequence number; the microcontroller operation mode of the task subsequence is determined based on the resource requirement characteristics of the task subsequence; further, the resource requirement characteristics are combined based on the following formula (9) and the above formula (5);

[0077] ;

[0078] Alternatively, the resource demand characteristics are merged based on the following equations (10) and (11);

[0079] ;

[0080] ;

[0081] The determining of the microcontroller operation mode / low power consumption mode of the task subsequence based on the resource requirement characteristics of the task subsequence is specifically: taking the microcontroller operation mode / low power consumption mode with the minimum power consumption that can meet various types of resource requirements of the task subsequence as the microcontroller operation mode / low power consumption mode corresponding to the task subsequence;

[0082] Preferably: selecting the microcontroller operation mode / low power consumption mode with the lowest power consumption of each resource requirement characteristic of the task subsequence in which the number of various resources is greater than or equal to that of each resource demand characteristic of the task subsequence as the microcontroller operation mode / low power consumption mode corresponding to the task subsequence;

[0083] Preferably: the task execution sequence also includes a trigger condition of the task subsequence; that is, when the trigger condition is met, it is determined whether to enter the microcontroller operation mode / low power consumption mode, that is, to switch the mode;

[0084] Preferably: the trigger condition is the execution time length of the task subsequence; the execution time is a static estimated value;

[0085] Step S3: During the operation of the microcontroller, before the corresponding task subsequence in the task execution sequence is executed, obtaining the microcontroller operation mode or low power consumption mode corresponding to the task subsequence, and sending a mode entry instruction to the microcontroller based on the operation mode or low power consumption mode, so that the microcontroller enters the corresponding operation mode or low power consumption mode;

[0086] Preferably: the microcontroller operation mode includes a working mode and one or more low power consumption modes;

[0087] Preferably: before sending the mode entry instruction based on the operation mode, first determine whether mode switching is required; if determined, send the mode entry instruction;

[0088] The determination of whether mode switching is required is specifically as follows: performing prediction confirmation: when the task group in the task subsequence is actually called, determining whether mode switching is required; that is, preparation for entering the running mode can be made first, and when the predicted situation actually occurs, the corresponding mode entry instruction is issued;

[0089] The determining whether mode switching is required is specifically as follows: performing overhead confirmation: determining the execution time length of the task subsequence in the task execution sequence, obtaining the mode switching overhead and its corresponding shortest entry time, and determining that mode switching is required when the execution time length is greater than the shortest entry time; otherwise, maintaining the current microcontroller operation mode;

[0090] The switching cost is the time cost required to enter the next operating mode from the current operating mode; the shortest entry time is obtained by multiplying the time cost by the switching loss coefficient;

[0091] Preferably: the switching loss coefficient is a preset value; the switching loss coefficient is greater than 1;

[0092] The determining whether mode switching is required is specifically: performing prediction confirmation and overhead confirmation at the same time;

[0093] Based on the same inventive concept, the present invention also provides a microcontroller low power mode entry system, wherein the system is arranged in the microcontroller;

[0094] Preferably: the system is arranged in the kernel space of the operating system on the upper layer of the microcontroller;

[0095] Preferably: by setting an interrupt in the operating system, when entering the low power consumption mode, a corresponding mode switching instruction is sent to the chip to shut down the energy supply of some hardware resources;

[0096] Preferably: the low power consumption mode includes a low power consumption mode and an ultra low power consumption mode;

[0097] Preferably: the microcontroller is a vehicle-mounted microcontroller;

[0098] A computer program (also referred to as a program, software, software application, script, or code) can be written in any form of a programming language, including an assembled or interpreted language, a declarative or procedural language, and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, object, or other unit suitable for use in a computing environment. A computer program may, but need not, correspond to a file in a file system. A program can be stored in a portion of a file that holds other programs or data (e.g., one or more scripts stored in a markup language document), in a single file dedicated to the program, or in multiple collaborative files (e.g., files storing one or more modules, subroutines, or code portions). A computer program can be deployed to execute on one computer or on multiple computers located at one site or distributed across multiple sites and interconnected by a communication network.

[0099] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0100] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0101] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0102] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0103] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for entering a low power consumption mode of a microcontroller, characterized in that: The method comprises: Step S1: Obtain a task scheduling queue of a microcontroller, and convert the task scheduling queue into an initial task execution sequence according to the task parallelism of the microcontroller, the order of tasks in the task scheduling queue and their estimated execution time; wherein: the initial task execution sequence includes one or more task groups arranged in order of execution, and the task group includes one or more tasks executed in parallel; and the execution time length of the task group is set according to the estimated execution time of the tasks in the task group; Step S2: According to the resource requirements of each task / task group in the initial task execution sequence, the initial task execution sequence is further divided and merged according to the resource requirements of the tasks / task groups during the execution process to obtain a task execution sequence; Step S2: Step S2 specifically includes the following steps: Step S21: process each task group in the initial task execution sequence in turn; perform static analysis on each task in the task group; if the task presents different resource requirements at different stages in the execution process, split the task into multiple subtasks according to different execution stages, and replace the position of the task in the task group with the multiple subtasks split; then split the task group according to the multiple subtasks, combine each different subtask with other tasks in the task group to obtain multiple task groups after splitting, and replace the position of the task group in the task execution sequence with the task groups obtained after splitting; repeat this step until all task groups are processed; update the execution time length attribute of each task group; Step S22: sequentially process each task group in the initial task execution sequence after the task group splitting is completed; obtain historical resource demand data generated by the task group executing on the microcontroller; and set the resource demand characteristics of the task group based on the historical resource demand data of the task group on the current microcontroller; Specifically, for each task group, if there is only one task t in the task group, filter the historical resource demand data generated when the task is executed alone, calculate the average value and set the resource demand characteristics of the task group tg ; When there are multiple tasks in a task group, filter the resource demand data presented when all tasks of the task group are executed in parallel in the historical resource demand data, and set its average value as the resource demand characteristic of the task group ;in: is the task number, is the task group number; is the kth resource requirement feature of the tth task; K is the total number of resource requirement features; Step S23: determining the microcontroller operation mode / low power consumption mode corresponding to the task group based on the resource requirement characteristics of the task group; specifically: taking the microcontroller operation mode or low power consumption mode with the minimum power consumption that can meet various types of resource requirements of the task group as the microcontroller operation mode corresponding to the task group; Step S24: merging the task groups in the initial task execution sequence according to the microcontroller operation mode / low power consumption mode; after merging, the task groups contain one or more continuous task subsequences; the task subsequence contains one or more task groups arranged in sequence; each task subsequence corresponds to a same microcontroller operation mode / low power consumption mode, which is called a task execution sequence after merging; specifically: in the initial state, each task group is regarded as a task subsequence containing a task group; the execution time length of each task subsequence is set to the execution time length of the task group it contains; the microcontroller operation mode / low power consumption mode of the task group is used as the microcontroller operation mode / low power consumption mode of the task subsequence; if the microcontroller operation modes / low power consumption modes corresponding to adjacent task subsequences are the same and the distance between adjacent task subsequences is less than the distance threshold, then the adjacent task subsequences are merged; the execution time length corresponding to each task subsequence is merged, and the same microcontroller operation mode / low power consumption mode is used to associate it with the task subsequence; The distance between adjacent task subsequences is calculated using the following formulas (1)-(3): ;in: is the adjustment factor associated with the kth resource type; is the execution time length of task group tg; tgt is a temporary task group variable; is the execution time length of the temporary task group tgt, is the resource requirement characteristic of the kth resource type of task t; and is a contiguous subsequence of tasks; is a task subsequence Task Force The impact factor, is a task subsequence Task Force Impact factor; ; ; ; Step S3: During the operation of the microcontroller, before the corresponding task subsequence in the task execution sequence is executed, the microcontroller operation mode / low power consumption mode corresponding to the task subsequence is obtained, and a mode entry instruction is sent based on the operation mode / low power consumption mode to make the microcontroller enter the corresponding operation mode / low power consumption mode.

2. The method for entering a microcontroller low power mode according to claim 1, characterized in that: The tasks contained in adjacent task groups are not exactly the same.

3. The method for entering a microcontroller low power consumption mode according to claim 2, characterized in that: The task parallelism is equal to the number of cores in the microcontroller.

4. The method for entering a microcontroller low power mode according to claim 3, characterized in that: The distance threshold is a preset value.

5. The method for entering a microcontroller low power mode according to claim 4, characterized in that: The execution time lengths corresponding to different tasks, task groups, and task subsequences are the same or different.

6. The method for entering a microcontroller low power mode according to claim 5, characterized in that: The microcontroller is an on-board microcontroller.

7. A microcontroller low power mode entry system, characterized in that: The microcontroller low power mode entry system is used to implement the microcontroller low power mode entry method described in any one of claims 1 to 6.

8. A microcontroller low power mode entry control device, characterized in that: The microcontroller low power mode entry control device is used to implement the microcontroller low power mode entry method described in any one of claims 1 to 6.

9. A microcontroller low power mode entry control module, characterized in that: The microcontroller low power mode entry control module is used to implement the microcontroller low power mode entry method described in any one of claims 1 to 6.

10. A microcontroller low power mode entry control circuit, characterized in that: The microcontroller low power mode entry module is used to implement the microcontroller low power mode entry method described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Small AUV (Autonomous Underwater Vehicle) low-power-consumption controller based on reconfigurable strategy and control method

    CN108021055A

  • Method and device for performing distributed computing in wireless local area network

    CN108834163A