# Resuming scheduler after restart

**URL:** <https://forums.freertos.org/t/resuming-scheduler-after-restart/6916>\
**Category:** Kernel\
**Created:** [December 6, 2017, 9:23pm UTC](https://forums.freertos.org/t/resuming-scheduler-after-restart/6916 "2017-12-06T21:23:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 6, 2017, 9:23pm UTC](https://forums.freertos.org/t/resuming-scheduler-after-restart/6916/1 "2017-12-06T21:23:48Z")

</div>

**[evgeny-erlihman](https://sourceforge.net/u/evgeny-erlihman/)** wrote on [Wednesday, December 06, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/4762757f/#a1ef):

I am working with stm32h7 MCU, one of its features is BAM (batch acquisition mode). In this mode the MCU goes into a low power mode to gather data. To wake up from this mode, the MCU resets, but the clock configuration is not changed as well as the memory content. So theoretically, if there was a way to make the system continue runing from the same place it left of, which is PreSleepProcessing, the system state can be retained.  
Is there a way to resume the FreRTOS scheduler instead of restarting it? Because all tasks and current state is still in the memory. And we know when we are about to reset, so we can save memory, regs etc before…

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [December 6, 2017, 11:31pm UTC](https://forums.freertos.org/t/resuming-scheduler-after-restart/6916/2 "2017-12-06T23:31:57Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Wednesday, December 06, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/4762757f/#a1ef/0f41):

Sorry I don’t fully understand your question. If everything is still in  
memory what is being reset? Is it just the program counter that gets  
set back to the reset vector? If so you could potentially use the  
pre-sleep configPRE\_SLEEP\_PROCESSING()  
([https://www.freertos.org/low-power-ARM-cortex-rtos.html](https://www.freertos.org/low-power-ARM-cortex-rtos.html)) macro to save  
the state of the program counter too then have the reset code check to  
see why the CPU was reset and take appropriate action on wake - but this  
is not really something FreeRTOS can do for you.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 7, 2017, 2:44pm UTC](https://forums.freertos.org/t/resuming-scheduler-after-restart/6916/3 "2017-12-07T14:44:19Z")

</div>

**[evgeny-erlihman](https://sourceforge.net/u/evgeny-erlihman/)** wrote on [Thursday, December 07, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/4762757f/#a1ef/0f41/ba82):

Sure, i figured out that i would have to save the call stack and PC before i put the system in low power mode, inside configPRE\_SLEEP\_PROCESSING, and restore it once i land in main() after reset. Was hoping that there is already an infrastructure inplace for this functionlality. Would try it out later, if ST hasn’t provided its costumers with the port by then…
