If it can help someone there, I have made some experiments with my oscilloscope:
ets_printf
does output to TX0 from the wake stub without requiring any further setup
- between the actual wake up, and the call to the wake stub, some processing is done by the ESP32 which takes 8.4ms. During that time some stuff is output to TX0 (I have no decoder so I can't say what it is, probably some diagnostic messages)
- the output of this text goes on during the stub execution for another ~ 6-7ms (I assume that the UART flushes the output generated by the ROM)
- the
ets_printf
output is generated at 115200 bps, the start bit is 0, the stop bit is 1, and there is no parity bit.
Below is a working example:
void RTC_IRAM_ATTR wake_stub_example(void) {
ets_delay_us(7000);
// this declaration is required to ensure that the data are in RTC RAM, otherwise it crashes:
static RTC_RODATA_ATTR const char fmt_str[] = "AB\n";
ets_printf(fmt_str);
esp_wake_stub_set_wakeup_time(1000);
esp_wake_stub_sleep(&wake_stub_example);
}
I have set the logs (both bootloader and log output) to "none" in sdkconfig.
I find it a bit disappointing that 8.4ms are spent before the wake stub is called, as it means that the battery will be used to power the chip during that time (in my case I only need 5ms in the wake stup, so it almost triple the energy required, to go from 5 to 13.4ms), but I guess this ROM initialization cannot be changed.