Suspend protection method, device and vehicle chip
By setting a wake-up source and controlling restart operations in the vehicle chip, the memory resource tightness caused by excessive STR times is solved, and the user experience is improved.
Patent Information
- Application Number
- CN202410334049.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-22
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2044-03-22
AI Technical Summary
Executing the STR function over a number of times may cause the memory resource allocation of the A core 101 to be tight, affecting the stability of the memory, and thus affecting the normal operation of the application and user experience.
By obtaining the count value of the number of suspend or wake-up times of the target core, when the count value is greater than the threshold, a wake-up source is set. For example, a wake-up source based on the real-time clock, control the target core to perform wake-up, restart and STR operations in turn.
By setting the wake-up source and controlling the restart operation, the memory resource shortage caused by excessive STR times is solved, and the user experience is improved.
Smart Images

Figure CN118152021B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to STR (Suspend to Ram) technology, and in particular to a suspend protection method, device and vehicle chip. Background Art
[0002] The STR (Suspend to Ram) function means that all the working state data before the system enters STR is stored in the memory. In the STR state, the power supply continues to supply power to the most necessary devices such as the memory to ensure that data is not lost, while other devices are turned off. At this time, the system power consumption is extremely low. Once the system is awakened, it immediately reads data from the memory and restores to the working state before STR. The read and write speed of the memory is extremely fast, so we feel that the time spent entering and leaving the STR state is only a few seconds.
[0003] With the development of intelligent and electrified vehicles, STR functions are gradually being applied to real vehicles, for example, in products such as HPC (High Performance Computer) in vehicles. Among them, HPC can be implemented as various domain controllers in vehicles, such as central gateways. HPC products are generally developed and designed based on SOC (System on Chip, also known as system-on-chip).
[0004] like Figure 1 As shown, it is a schematic diagram of the structure of a vehicle chip. The vehicle chip can be a heterogeneous SOC and includes: two cores, namely A core 101 and M core 102. When the vehicle chip is dormant, the M core 102 first sends an instruction to suspend to memory to the A core 101, and the A core 101 performs the STR function based on the instruction of the M core 102 to work in a suspended state. Then, after the A core 101 completes the STR function, the M core 102 executes the power-off process, such as turning off the power supply of related modules and only retaining the power supply of necessary modules. In addition, when the vehicle chip is powered on again, the M core 102 wakes up first, and then sends a restore / wake-up instruction to the A core to restore the A core from the suspended state to the awakened state.
[0005] However, the inventors of the present application have found in actual applications that executing the STR function too many times may lead to tight memory resource allocation of core A 101, affecting memory stability, and further affecting the normal operation and stability of the application, thereby causing a poor user experience. Summary of the invention
[0006] The embodiments of the present invention provide a suspension protection method, device and vehicle chip, which can improve user experience.
[0007] A suspension protection method according to an embodiment of the present invention includes: controlling a target core to execute a suspend to memory STR operation to switch from a running state to a suspended state, and controlling the target core to execute a wake-up operation to restore from the suspended state to the running state; obtaining a count value, wherein the count value represents the cumulative number of suspensions or wake-ups of the target core; when the count value is greater than a threshold, setting a wake-up source; and when detecting that the target core is successfully awakened by the wake-up source, controlling the target core to execute wake-up, restart and STR operations in sequence.
[0008] During sleep, it is determined whether the count value is greater than a threshold.
[0009] Wherein, setting a wake-up source includes: setting a wake-up source based on a real-time clock.
[0010] The setting of a wake-up source based on a real-time clock includes: setting the real-time clock to perform a wake-up operation at a preset time point; or setting the real-time clock to perform a wake-up operation after a delay time.
[0011] The method further includes: when in sleep mode, obtaining the current time; when the current time is outside a preset time interval, executing the step of setting the real-time clock to perform a wake-up operation at a preset time point; when the current time is within a preset time interval, executing the step of setting the real-time clock to perform a wake-up operation after a delay time.
[0012] Among them, the method also includes: detecting whether the preset conditions are met, and if so, it is considered that the real-time clock is successfully awakened; wherein, the preset conditions include: marking a preset mark, and the preset mark is used to indicate that the real-time clock is set; detecting that the real-time clock has executed an alarm event, and the real-time clock executes the alarm event when the wake-up time arrives; and the count value saved during sleep is equal to the current latest count value, the count value saved before sleep represents the cumulative number of suspensions or wake-ups of the target core during sleep, and the current latest count value represents the latest cumulative number of wake-ups of the target core.
[0013] The method further includes: updating the count value when controlling the target core to perform a wake-up operation; and reading the count value during sleep and storing it in a non-volatile memory.
[0014] Among them, when the count value is greater than a threshold, setting a wake-up source includes: when the count value is greater than a first threshold, setting a wake-up source to perform a wake-up operation at a preset time point or after a preset delay time; when the count value is greater than a second threshold, setting a wake-up source to perform a wake-up operation immediately after hibernation; wherein, the second threshold is greater than the first threshold.
[0015] Among them, the method is used in a vehicle chip, the vehicle chip is a heterogeneous SOC, and the target core is the A core in the heterogeneous SOC, and the method is used for the M core in the heterogeneous SOC.
[0016] A suspension protection device according to an embodiment of the present invention comprises: a control module, used to control a target core to execute a suspend to memory STR operation to switch from a running state to a suspended state, and to control the target core to execute a wake-up operation to recover from the suspended state to the running state; an acquisition module, used to acquire a count value, wherein the count value represents the cumulative number of suspensions or wake-ups of the target core; a setting module, used to set a wake-up source when the count value is greater than a threshold; and a processing module, used to control the target core to execute wake-up, restart and STR operations in sequence when detecting that the target core is successfully awakened by the wake-up source.
[0017] A vehicle chip according to an embodiment of the present invention comprises: a first core and a second core, wherein the second core is controlled by the first core; the first core comprises: a power main controller, used to control the second core to perform a suspend to memory STR operation to switch from a running state to a suspended state, and to control the second core to perform a wake-up operation to restore from the suspended state to the running state; the power main controller is also used to update a count value when controlling the target core to perform a wake-up operation, and the count value is used to record the cumulative number of wake-ups of the second core; an application module is used to read the count value when the first core is in sleep mode, and to set a wake-up source based on a real-time clock when the count value is greater than a threshold; the application module is also used to instruct the power main controller to restart the second core when the second core is successfully awakened by the set real-time clock.
[0018] Among them, the first core also includes: a first memory and a second memory; the power main controller is used to save the count value in the first memory during operation; the application module is also used to: set a preset mark, the preset mark is used to indicate that the real-time clock is set; when in sleep mode, read the count value from the first memory and store it in the second memory; and when running, detect whether the preset conditions are met, if met, it is considered that the real-time clock is successfully awakened; wherein the preset conditions include: marking a preset mark; detecting that the real-time clock has executed an alarm event, and the real-time clock executes the alarm event when the wake-up time arrives; and the count value read from the first memory is equal to the count value read from the second memory.
[0019] A computer device according to an embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method according to the embodiment of the present invention.
[0020] A computer-readable storage medium according to an embodiment of the present invention stores a computer program / instruction thereon, wherein the computer program / instruction, when executed by a processor, implements the steps of the method described in the embodiment of the present invention.
[0021] A computer program product according to an embodiment of the present invention includes a computer program / instruction. When the computer program / instruction is executed by a processor, the steps of the method according to the embodiment of the present invention are implemented.
[0022] Beneficial effects of the embodiments of the present invention:
[0023] When the number of STRs is too high, a wake-up source is set to control the target core to perform operations such as restarting, thereby solving problems such as tight memory resources caused by too many STRs, and ensuring a good user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Other details and advantages of the present invention will become apparent from the detailed description provided below. It should be understood that the following drawings are merely illustrative and thus cannot be considered as limiting the present invention, and the following will be described in detail with reference to the drawings, wherein:
[0025] Figure 1 is a schematic structural diagram of an embodiment of a vehicle chip of the present invention;
[0026] Figure 2 is a schematic structural diagram of another embodiment of a vehicle chip of the present invention;
[0027] Figure 3 yes Figure 2A schematic structural diagram of an embodiment of the first core 20;
[0028] Figure 4 is a flow chart of an embodiment of a suspension protection method of the present invention;
[0029] Figure 5 It is a structural schematic diagram of an embodiment of a hanging protection device of the present invention. DETAILED DESCRIPTION
[0030] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention clearer and more understandable, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining the present invention and are not intended to limit the present invention.
[0031] In the description of the present invention, it is to be understood that the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. Moreover, the terms "first", "second", etc. are applicable to distinguishing similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.
[0032] like Figure 2 FIG. 1 is a schematic diagram of the structure of an embodiment of a vehicle chip of the present invention. The vehicle chip may be, for example, a SOC or an ECU (Electronic Control Unit).
[0033] In the following description, the vehicle chip is taken as an example, and the specific application scenario of the vehicle is taken as an example to describe the solution of the embodiment of the present invention in detail. However, this does not mean that all or part of the solution of the embodiment of the present invention cannot be applied to other products or application scenarios. In other words, as long as these products or scenarios support the application of the STR (suspend to memory) function, all or part of the technical features of the solution of the embodiment of the present invention may be applicable.
[0034] exist Figure 2 In the embodiment, the vehicle chip 10 includes at least two cores, for example, a first core 20 and a second core 30. The first core 20 and the second core 30 may be respectively Figure 1In some embodiments, the first core 20 and the second core 30 may be different partitions in the same core. In other embodiments, the first core 20 and the second core 30 may be developed and designed based on different Autosar (Automotive Open System Architecture) platforms. In other embodiments, the first core 20 and the second core 30 may be based on different OS (Operating System, operating system).
[0035] like Figure 2 As shown, the first core 20 and the second core 30 may exchange data via an IPCF (Inter-Processor Communication Framework) 40. For example, data exchange may be performed based on a shared memory.
[0036] The first core 20 includes: PM (Power Master) 201. The second core 30 includes: SPMC (slave power manager client) 301, SM (State Machine Manager) 302, EM (Execution Manager) 303 and other modules 304. The other modules 304 may include, for example, an operating system kernel, various APP (application) modules running on the second core 30, etc.
[0037] Among them, PM201 is the main device of SPMC301, which is used to control SPMC301 to perform power-related management functions. SM302 is responsible for setting the state of the second core 30 to control the second core 30 to switch between different states. Among them, the state of the second core 30 may include, for example: suspend state (Suspend) and running (Running, also known as "wake-up") state, etc. EM303 is responsible for performing related operations based on the state set by SM302 so that the second core 30 can correctly enter the corresponding state. For example, EM303 can control the components in other modules 304 to stop working, restart, save operating data to memory, etc.
[0038] In some embodiments, when the STR function is implemented, PM201 sends the suspended instruction to SPMC301 through IPCF40. SPMC301 controls SM302 to switch the state to the suspended state based on the received instruction, and EM303 performs STR-related operations based on the state of SM302. When the process of recovering from the suspended state to the running state is similar, PM201 sends the wake-up (recovery) instruction to SPMC301, SPMC301 sets SM302 based on the received instruction, and EM303 controls the recovery from the suspended state to the running state based on the state of SM302.
[0039] In practice, as the vehicle is constantly used, the second core 30 may have the problem of executing the STR function too many times in total, for example, up to dozens of times or even more. Too many STRs may lead to tight memory resource allocation for the second core 30, affecting memory stability, resulting in a poor user experience. For example, when the memory resources of the second core 30 become tight, some applications on the second core 30 may not be able to apply for sufficient memory resources, which may cause these applications to have problems such as anomalies (such as freezes). In addition, if the second core 30 carries some applications related to vehicle functional safety, it is even more important to avoid anomalies in these applications.
[0040] Therefore, in the embodiment of the present invention, when the STR times of the second core 30 reach a certain level, a wake-up source (such as a wake-up source based on a real-time clock) is set to restart the second core 30 to solve the above problem. Figure 3 The detailed technical solutions for solving the above problems according to the embodiments of the present invention are specifically described.
[0041] like Figure 3 As shown, it shows the specific structure of an embodiment of the first core 20. Figure 3 In the example, the first core 20 includes: a PM 201 and an application (APP) module 202 .
[0042] Among them, PM201 is responsible for controlling the second core 30 to perform STR operations and wake-up operations, and counting the number of suspend / wake-up times.
[0043] Specifically, when the suspension condition is met, for example, when there is no network communication requirement, PM201 controls the second core 30 to perform the STR operation to switch from the running state to the suspended state. For the specific suspension process, please refer to Figure 2Embodiments are not described here. In addition, when the wake-up condition is met, PM201 controls the second core to perform a wake-up operation to restore from a suspended state to a running state. Among them, PM201 can, for example, control the second core to perform a wake-up operation when there is a wake-up source. The wake-up source can be, for example, a CAN network. When waking up, the first core 20 generally wakes up before the second core, and PM201 in the first core 20 generally wakes up before other modules.
[0044] Each time PM201 wakes up the second core, that is, when the second core is restored from the suspended state to the running state, the number of wake-up times is accumulated and stored in the first memory 203. The first memory 203 is generally a volatile memory. When the first core 20 is powered off, the data in the first memory 203 is lost. Therefore, when PM201 controls the first core 20 to power off, PM201 can set a saving mechanism to save the accumulated number of wake-up times in PM201. After the first core 20 is powered on again, PM201 can write the wake-up times back to the first memory 203. In addition, after the second core is restarted, the above-mentioned accumulated number of wake-up times is cleared.
[0045] The accumulated wake-up times of the second core can be recorded through PM 201 and the first memory 203. The accumulated wake-up times can be read by the application to support certain specific application functions or shared with the second core.
[0046] The application module 202 is responsible for the logical judgment of whether to restart the second core.
[0047] Specifically, the application module 202 obtains the accumulated wake-up times by reading the first memory 203, and determines whether the accumulated wake-up times obtained are greater than a preset threshold to determine whether the restart logic of the second core needs to be set.
[0048] In some embodiments, the application module 202 reads the first memory 203 to obtain the accumulated wake-up times when in sleep mode, and executes the related logic based on the wake-up times before entering the sleep mode. When the wake-up times are less than a preset threshold, a normal sleep process is executed. When the wake-up times are greater than or equal to the preset threshold, the restart logic of the second core is set, and then the sleep process is executed.
[0049] Among them, setting the restart logic of the second core can be, for example: setting a wake-up source, and when successfully awakened by the wake-up source, controlling the second core through PM201 to perform wake-up (i.e., recovering from suspend to running state), restart and STR (i.e., switching from running state to suspended state) operations in sequence.
[0050] In some embodiments, the wakeup source can wake up the first core 20 at a set time. For example, the first core 20 can be woken up in the early morning, because the probability of users using the vehicle in the early morning is extremely low, and executing the logic of restarting the second core in the early morning is not likely to affect the user's normal vehicle use behavior. In addition, the wakeup source can wake up the first core after a delay time (for example, 30 minutes or 1 hour).
[0051] In some embodiments, the wakeup source may be a wakeup source based on an RTC (real time clock), such as Figure 3 RTC4 in.
[0052] RTC-based wakeup can minimize the impact on the vehicle. On the one hand, RTC-based wakeup will not activate the vehicle network, nor will it wake up other ECUs in the vehicle. On the other hand, after RTC wakes up the first core 20, if the application module 202 does not notify PM201 to restart the second core within a few seconds, the first core 20 will go into sleep again. If the application module 202 notifies PM201 to restart the second core, PM201 will go into sleep after restarting the second core and suspending it again. This process can generally be completed within 1 minute. Therefore, the use of RTC-based wakeup can control the wakeup object and time within a limited range, minimizing the impact on the user's use of the vehicle.
[0053] When wake-up is performed based on RTC, the application module 202 can set RTC4 to perform the wake-up operation at a preset time point (e.g., 1:00, 1:30, or 2:00 in the morning). RTC4 can also be set to perform the wake-up operation after a delay time (e.g., after a delay of 20 minutes or 30 minutes).
[0054] In some embodiments, the application module 202 can set the RTC4 based on the current time. For example, when the application module 202 is in sleep mode, it reads the current time from the RTC4 and the accumulated wake-up times from the first memory 203. Then, the RTC4 is set based on the current time and the accumulated wake-up times.
[0055] Specifically, when the accumulated number of wake-up times is less than a preset threshold (eg, 25 times, 30 times, or 35 times, etc.), the application module 202 does not set a wake-up source based on RTC4.
[0056] When the accumulated number of wake-up times is greater than or equal to a preset threshold, if the current time is outside a preset time interval (e.g., 00:00 to 05:00 in the morning), RTC4 is set to perform a wake-up operation at a preset time point (e.g., 01:00 in the morning). For example, if the current time is 13:00, RTC4 can be set to perform a wake-up operation at 01:00 in the morning.
[0057] When the accumulated number of wake-up times is greater than or equal to a preset threshold, if the current time is within a preset time interval, the real-time clock is set to perform a wake-up operation after a delay time. For example, assuming that the current time is 00:00 in the morning, which is within the preset time interval (i.e., 00:00 to 05:00 in the morning), RTC4 can be set to perform a wake-up operation half an hour later, i.e., 00:30.
[0058] In addition, there may be multiple preset thresholds, for example, 2, to distinguish the severity, thereby executing different restart strategies. For example, the threshold based on the above scheme may be a first threshold, whose value may be set to 30, for example. On this basis, a second threshold is set, whose value may be 40, for example.
[0059] When the accumulated number of wake-up times is greater than the second threshold, the RTC4 is directly set to perform a wake-up operation immediately after the first core 20 goes into sleep. Generally, a timer can be set on the RTC4, and the timing time of the timer is the current time plus a few seconds or tens of seconds, so as to achieve the purpose of waking up the first core 20 immediately after the first core 20 goes into sleep.
[0060] After RTC4 is set, RTC4 performs a wake-up operation when the wake-up time arrives. The wake-up operation includes, for example: generating an alarm event and triggering a preset pin of the first core 20. The alarm event generated in RTC4 can be queried by the application module 202, that is, the application module 202 can query whether RTC4 has performed a wake-up operation. When the preset pin of the first core 20 is triggered, if the first core 20 is in a dormant state, the first core 20 will be powered on and then enter a running state. If the first core 20 is in a running state when the preset pin is triggered, the trigger will be ignored, that is, there will be no response.
[0061] When RTC4 performs the wake-up operation, the first core 20 may be in a dormant state or a running state. When the first core 20 is in a running state, it is obvious that the first core 20 is not successfully awakened by RTC4, that is, RTC4 wake-up fails, and the second core 20 will not be restarted at this time. In some embodiments, the application module 202 can use the following mechanism to determine whether it is successfully awakened by RTC4.
[0062] First, when the application module 202 is in sleep mode, while setting RTC4, a preset mark is set to indicate that RTC4 is set. The application module 202 can write a specific value into the second memory 204 as the preset mark. The second memory 204 can be a non-volatile memory, that is, the data will not be lost when the power is off. In addition, the application module 202 reads the accumulated wake-up times from the first memory 203 at the same time and stores it in the second memory 204.
[0063] Next, when the application module 202 is running, it can determine whether there is a preset mark. If it exists, it means that the RTC is set. Then the application module 202 continues to query RTC4 to determine whether RTC4 has executed the alarm event. If it is found that the alarm event has been executed, the application module 202 reads the cumulative number of wake-ups stored in the sleep state from the second memory 204, and reads the current latest cumulative number of wake-ups from the first memory 203. If the two are the same, it can be said that the first core 20 is successfully awakened by RTC4, thereby executing the operation of restarting the second core. If the two are different, it means that the first core 20 is not awakened by RTC4, and the operation of restarting the second core is not executed. By comparing the number of wake-ups recorded during sleep with the latest cumulative number of wake-ups, it is possible to identify whether it is successfully awakened by RTC4.
[0064] The following lists actual application scenarios to illustrate the embodiments of the present invention.
[0065] In the following scenario, based on the actual use of the vehicle, PM201 repeatedly performs S2R operations and wake-up operations on the second core, and PM201 writes the accumulated number of wake-up times (resume counter) into the first memory 203. In addition, the first threshold is set to 30, the second threshold is set to 40, and the preset time interval is 01:00 to 05:00 in the morning.
[0066] Scenario 1: The vehicle is out of use at 22:00 and the cumulative number of wake-up calls is 25.
[0067] In this scenario, when the application module 202 is in sleep mode, it reads the accumulated wake-up times in the first memory 203 and determines whether the accumulated wake-up times is greater than or equal to 30. Since 25<30, the application module 202 directly enters sleep mode without executing other processes.
[0068] Scenario 2: The vehicle is no longer in use at 22:00, the cumulative number of wake-up calls is 30, and the vehicle is not used before 07:00 the next day.
[0069] In this scenario, when the application module 202 is in sleep mode, RTC4 is set to perform a wake-up operation at 01:00, and a flag is set and saved in the second memory 204. At the same time, the accumulated wake-up times are read from the first memory 203 and saved in the second memory 204, and then the application module 202 goes into sleep mode.
[0070] When 01:00 arrives, an alarm event is generated in RTC4 and a preset pin in the first core 20 is triggered. Since the preset pin in the first core 20 is triggered, the first core 20 is awakened, PM201 first recovers to the running state, and writes the accumulated awakening times into the first memory 203.
[0071] In this scenario, since the wakeup is triggered by RTC, the second core will not be awakened, so PM201 will not control the second core to resume from the suspended state. Therefore, the cumulative wakeup times written by PM201 to the first memory 203 are the cumulative wakeup times saved during hibernation. The application module 202 will be awakened later than PM201. After the application module 202 is awakened, it reads the preset mark from the second memory 204, and then queries that RTC4 has generated an alarm event. Then, the cumulative wakeup times stored in the second memory 204 are compared with the cumulative wakeup times in the first memory 203. The two are the same, so the application module 202 instructs PM201 to restart the second core 201. Based on the instruction of the application module 202, PM201 controls the second core to perform wakeup first, then restart, and finally execute STR to restore to the suspended state. Then, the first core 20 will enter the hibernation state again.
[0072] Scenario 3: The vehicle goes into sleep mode at 22:00 and has been woken up 30 times. The vehicle is woken up by other reasons at 00:00 and is used until 02:00.
[0073] In this scenario, when the application module 202 is in sleep mode, it sets the RTC4 to perform a wake-up operation at 01:00, sets a flag, and stores it in the second memory 204, and stores the value of the accumulated wake-up times in the second memory 204, and then goes into sleep mode.
[0074] At 00:00, the vehicle is awakened, and the first core 20 and the second core are awakened. At this time, PM201 controls the first core to resume from the suspended state to the running state, and updates the accumulated wake-up times, that is, the accumulated wake-up times are increased by 1 and become 31. The accumulated wake-up times 31 are stored in the first memory 203.
[0075] Before 01:00, the application module 202 can only query the preset mark, but cannot query the alarm event from RTC4, so the second core will not be restarted. At 01:00, RTC4 generates an alarm event and triggers the preset pin of the first core 20. However, since the first core 20 is already in operation, the first core 20 will ignore the event that the preset pin is triggered and will not perform the corresponding operation. During the period from 01:00 to 02:00, although the application module 202 can query the alarm event from RTC4, the value stored in the second memory 204 is 30, and the value in the first memory 203 is 31, which are not equal, so the application module 202 still will not restart the second core.
[0076] At 02:00, the application module 202 obtains the current time and the cumulative number of wake-up times in the first memory 203 when it is in sleep mode. Since the current time falls within the range of 01:00 to 05:00 and the cumulative number of wake-up times is greater than 30, the application module 202 sets RTC4 to execute a wake-up event after 30 minutes, sets a mark accordingly, and stores the latest cumulative number of wake-up times in the second memory 204.
[0077] Scenario 4: The vehicle goes into sleep mode at 22:00 and has been woken up 40 times.
[0078] When the application module 202 is in hibernation, it is determined that the cumulative number of wake-up times is equal to the second threshold, so the RTC4 is set to perform a wake-up operation after a few seconds or tens of seconds, and a mark is set, and the cumulative number of wake-up times is stored in the second memory 204. In this way, when the first core 20 enters hibernation, the RTC4 will immediately perform the wake-up operation, thereby waking up the first core 20, and achieving the purpose of immediately restarting the second core.
[0079] Through the above embodiments, the suspension protection scheme of the embodiment of the present invention is described in detail. In the above embodiments, RTC is used as the wake-up source, so other ECUs (electronic control units) in the vehicle are not activated, and only the target object needs to be woken up briefly. And by restarting the second core regularly, the function of the second core can be made more stable and reliable, improving the user experience.
[0080] The following combination Figure 4 , the suspension protection scheme of the present invention is described. It should be noted that many details of the above method have been described in the above embodiments, and will not be repeated here for the sake of brevity.
[0081] like Figure 4 FIG. 1 is a flow chart of an embodiment of a suspension protection method of the present invention. The method comprises:
[0082] Step S40: controlling the target core to perform a suspend-to-memory STR operation to switch from a running state to a suspended state, and controlling the target core to perform a wake-up operation to recover from the suspended state to the running state;
[0083] Step S42: Obtain a count value, where the count value represents the cumulative number of suspension or wake-up times of the target core.
[0084] Specifically, during sleep, it is determined whether the count value is greater than the threshold value. If it is greater than or equal to the threshold value, step S44 is executed.
[0085] Step S44: when the count value is greater than a threshold, setting a wake-up source.
[0086] Specifically, the wake-up source may be a wake-up source based on a real-time clock. For example, the real-time clock may be set to perform a wake-up operation at a preset time point; or, the real-time clock may be set to perform a wake-up operation after a delay time. For example, the real-time clock may be set to perform a wake-up operation at a preset time point or after a delay time based on the current time.
[0087] Step S46: when detecting that the target core is successfully awakened by the wake-up source, controlling the target core to perform awakening, restarting and STR operations in sequence.
[0088] Wherein, whether the set wake-up source is successfully awakened is detected by detecting whether the preset conditions are met. The preset conditions may include, for example: detecting a preset mark, the preset mark is used to indicate that the real-time clock is set; detecting that the real-time clock has executed an alarm event, the real-time clock executes the alarm event when the wake-up time arrives; and the count value saved during sleep is equal to the current latest count value, the count value saved before sleep represents the cumulative number of suspensions or wake-ups of the target core during sleep, and the current latest count value represents the latest cumulative number of wake-ups of the target core.
[0089] like Figure 5 The figure shows a schematic diagram of the structure of an embodiment of the suspension protection device of the present invention. The suspension protection device 5 includes: a control module 50, which is used to control the target core to perform a suspension to memory STR operation to switch from a running state to a suspended state, and to control the target core to perform a wake-up operation to restore from the suspended state to the running state. An acquisition module 52 is used to obtain a count value, and the count value represents the cumulative number of suspensions or wake-ups of the target core. A setting module 54 is used to set a wake-up source when the count value is greater than a threshold. A processing module 56 is used to control the target core to perform wake-up, restart and STR operations in sequence when it is detected that it is successfully awakened by the wake-up source.
[0090] In addition, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps in the method of the embodiment of the present invention.
[0091] In addition, an embodiment of the present invention provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the method described in the embodiment of the present invention are implemented.
[0092] In addition, an embodiment of the present invention provides a computer program product, including a computer program / instruction, which implements the steps of the method described in the embodiment of the present invention when executed by a processor.
[0093] The description of the above device, storage medium and program product embodiments is similar to the description of the above method or device embodiments, and has similar beneficial effects as the method or device embodiments. For technical details not disclosed in the device, storage medium and program product embodiments of this application, please refer to the description of the method or device embodiments of this application for understanding.
[0094] The processor may be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, a microprocessor, etc. It is understandable that the electronic device that implements the function of the processor may also be other, and the embodiments of the present application are not specifically limited.
[0095] The above-mentioned computer storage medium / memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM) and the like; it can also be various terminals including one or any combination of the above-mentioned memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.
[0096] It should be noted that the above description is only for example and not for limitation of the present invention. In other embodiments of the present invention, the method may have more, fewer or different steps, and the order, inclusion and function of each step may be different from that described and illustrated. For example, generally multiple steps can be combined into a single step, and a single step can also be divided into multiple steps. For those of ordinary skill in the art, without paying creative work, the sequential changes of each step are also within the scope of protection of the present invention.
[0097] The technical solution of the present invention, in essence or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor or a microcontroller to perform all or part of the steps of the method described in each embodiment of the present invention.
[0098] Those skilled in the art will appreciate that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed.
[0099] Although the present invention has been disclosed as above with preferred embodiments, the present invention is not limited thereto. Any changes and modifications made by any person skilled in the art without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention, and therefore the protection scope of the present invention should be subject to the scope defined by the claims.
Claims
1. A suspension protection method, characterized in that: include: Controlling the target core to perform a suspend-to-memory STR operation to switch from a running state to a suspended state, and controlling the target core to perform a wake-up operation to restore from the suspended state to the running state; Obtaining a count value, wherein the count value represents the cumulative number of suspension or wake-up times of the target core; When the count value is greater than a threshold, setting a wake-up source based on a real-time clock; When detecting that the target core is successfully awakened by the wake-up source, controlling the target core to perform wake-up, restart and STR operations in sequence; The method further comprises: detecting whether a preset condition is satisfied, and if satisfied, considering that the real-time clock is successfully awakened; The preset conditions include: detecting a preset mark, wherein the preset mark is used to indicate that the real-time clock is set; detecting that the real-time clock has executed an alarm event, and the real-time clock executes the alarm event when the wake-up time arrives; and The count value saved during sleep is equal to the latest count value, the count value saved during sleep represents the cumulative number of suspensions or wake-ups of the target core during sleep, and the latest count value represents the latest cumulative number of wake-ups of the target core.
2. The suspension protection method according to claim 1, characterized in that: During sleep, it is determined whether the count value is greater than a threshold.
3. The suspension protection method according to claim 1, characterized in that: The step of setting a wake-up source based on a real-time clock comprises: Setting the real-time clock to perform a wake-up operation at a preset time point; or, The real-time clock is set to perform a wake-up operation after a delay time.
4. The suspension protection method according to claim 3, characterized in that: The method further comprises: while in sleep mode, obtaining the current time; When the current time is outside the preset time interval, executing the step of setting the real-time clock to perform a wake-up operation at a preset time point; When the current time is within a preset time interval, the step of setting the real-time clock to perform a wake-up operation after a delay time is performed.
5. The suspension protection method according to claim 1, characterized in that: The method further comprises: When controlling the target core to perform a wake-up operation, updating the count value; and During sleep mode, the count value is read and stored in a non-volatile memory.
6. The suspension protection method according to claim 1, characterized in that: When the count value is greater than a threshold, setting a wake-up source based on a real-time clock comprises: When the count value is greater than a first threshold, setting the real-time clock-based wake-up source to perform a wake-up operation at a preset time point or after a preset delay time; When the count value is greater than a second threshold, setting the real-time clock-based wake-up source to perform a wake-up operation immediately after hibernation; The second threshold is greater than the first threshold.
7. The suspension protection method according to claim 1, characterized in that: The method is used in a vehicle chip, the vehicle chip is a heterogeneous SOC, and the target core is an A core in the heterogeneous SOC, and the method is used for an M core in the heterogeneous SOC.
8. A hanging protection device, characterized in that: include: A control module, used for controlling the target core to execute a suspend-to-memory STR operation to switch from a running state to a suspended state, and controlling the target core to execute a wake-up operation to recover from the suspended state to the running state; An acquisition module, used for acquiring a count value, wherein the count value represents the cumulative number of suspension or wake-up times of the target core; A setting module, used for setting a wake-up source based on a real-time clock when the count value is greater than a threshold; A processing module, configured to control the target core to perform wake-up, restart and STR operations in sequence when detecting that the target core is successfully awakened by the wake-up source; The device further comprises: detecting whether a preset condition is satisfied, and if satisfied, considering that the real-time clock is successfully awakened; The preset conditions include: detecting a preset mark, wherein the preset mark is used to indicate that the real-time clock is set; detecting that the real-time clock has executed an alarm event, and the real-time clock executes the alarm event when the wake-up time arrives; and The count value saved during sleep is equal to the latest count value, the count value saved during sleep represents the cumulative number of suspensions or wake-ups of the target core during sleep, and the latest count value represents the latest cumulative number of wake-ups of the target core.
9. A vehicle chip, characterized in that: include: a first core and a second core, the second core being controlled by the first core; The first core includes: a power main controller, configured to control the second core to perform a suspend-to-memory STR operation to switch from a running state to a suspended state, and to control the second core to perform a wake-up operation to recover from the suspended state to the running state; The power main controller is further used to update a count value when controlling the second core to perform a wake-up operation, and the count value is used to record the accumulated wake-up times of the second core; an application module, configured to read the count value when the first core is in sleep mode, and to set a wake-up source based on a real-time clock when the count value is greater than a threshold; The application module is further configured to instruct the power main controller to restart the second core when being successfully awakened by the set real-time clock; The first core also includes: a first memory and a second memory; The power main controller is used to store the count value in the first memory during operation; The application module is also used for: Setting a preset mark, wherein the preset mark is used to indicate that the real-time clock is set; When in sleep mode, reading the count value from the first memory and storing it in the second memory; and During operation, detecting whether a preset condition is met, if so, it is considered that the real-time clock is successfully awakened; The preset conditions include: Mapping to preset markers; detecting that the real-time clock has executed an alarm event, and the real-time clock executes the alarm event when the wake-up time arrives; and The count value read from the first memory is equal to the count value read from the second memory.
10. A computer device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.
11. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
12. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Standby method and device of smart television, smart television and computer medium
CN115242991A
Wake-up method and electronic equipment
CN116320147A