Cannot get wake handler to run

chris1seto
Posts: 20
Joined: Tue Jun 12, 2018 5:05 pm

Cannot get wake handler to run

Postby chris1seto » Mon Apr 22, 2019 9:53 pm

I have a project which puts the ESP32 into deep sleep. The ESP32 is woken up by a GPIO.

The code to get the ESP32 into deep sleep works correctly, and the ESP32 wakes up on GPIO, but no matter what I do, I cannot get the deep sleep handler to run.

My wake handler file is rtc_wake_stub.c, and in it I have a function with signature`void esp_wake_deep_sleep(void)` defined.

This function never runs on wakeup. The ESP boots directly to the application code with `rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)`

Any ideas?

chris1seto
Posts: 20
Joined: Tue Jun 12, 2018 5:05 pm

Re: Cannot get wake handler to run

Postby chris1seto » Tue Apr 23, 2019 4:48 pm

Alright, so after some debugging, I did find that if the wake handler is defined in a file (either rtc_wake_stub.c or something else) that as no other linkage to the project, the handler never runs. Presumably this means that the function is getting optimized out, though I'm surprised that the build system is configured to omit files as opposed to the individual function sections.

Who is online

Users browsing this forum: leschge and 139 guests