It's possible allocate memory which will remain unchanged after deep sleep state?
At http://esp-idf.readthedocs.io/en/latest ... -stub.html is specified that strings must be declared array and RTC_RODATA_ATTR, but later, a sentence about the use of "rtc_wake_stub" as file prefix makes me doubt: "The second way is a better option if you need to use strings, or write other more complex code"
I checked with this small example to confirm the behaviour, but now I'm not sure if this is due to a bug when using "rtc_wake_stub" file prefix.
Code: Select all
char * test1 = NULL;
int wake_count = 0;
void RTC_IRAM_ATTR esp_wake_deep_sleep(void) {
esp_default_wake_deep_sleep();
wake_count++;
}
void app_main(void)
{
if (wake_count==0) {
test1 = (char *) pvPortMallocCaps(32, MALLOC_CAP_8BIT);
memset(test1,0,32);
memcpy(test1,"esp32",5);
ESP_LOGI(tagg,"First time! %d - %s",wake_count,test1);
} else {
ESP_LOGI(tagg,"Not First time! %d",wake_count);
ESP_LOGI(tagg,"String val: %s",test1);
}
ESP_LOGI(tagg,"Going to sleep");
esp_deep_sleep(5*1000000);
}
Best regards and sorry for the incovenience,
Dav