I'm quite new to ESP32 and stumbled upon a problem that kept me up all day/night now: I try to get esp_tls library working and tried to followed the examples but found that something is messing wirth the memory:
I want to connect to a https server and used the example code like_
tls = esp_tls_conn_http_new(WEB_URL, &cfg);
But after that, the code crashed due to illegal addresses for the write/read callbacks. That made me to add some line to esp_tls.c like
Code: Select all
/* Connect to host */
if (esp_tls_conn_new_sync(&url[u.field_data[UF_HOST].off], u.field_data[UF_HOST].len,
get_port(url, &u), cfg, tls) == 1) {
printf( "DEEP UNDER 3. tls = %p, read = %p, write = %p\n", tls, tls->read, tls->write );
return tls;
}
return NULL;
Code: Select all
DEEP UNDER 3. tls = 0x3ffba908, read = 0x400d29f8, write = 0x400d2998
Code: Select all
A. tls struct. tls = 0x3ffba908, read = 0x0, write = 0x0
I added calls to heap_caps_check_integrity_all all over with no prevail. I've created the task with a lot of memory:
I then added a funtion to esp_tls.c/esp_tls.h to see if that would help clarif the issue, but it got worse:xTaskCreate(&wpa2, "wpa2", 4096*4, NULL, 5, NULL);
Added to esp_tls.c
Code: Select all
struct esp_tls * t1( struct esp_tls *tls )
{
printf( "t1 tls = %p, read = %p\n", tls, tls->read );
tls->read = 0xababab;
printf( "t1 tls = %p, read = %p\n", tls, tls->read );
return tls;
}
Code: Select all
struct esp_tls t_, *t;
memset( &t_, 0, sizeof(esp_tls_t));
t = &t_;
heap_caps_check_integrity_all( true );
t = t1( t );
heap_caps_check_integrity_all( true );
printf( "After t1 tls = %p\n", t );
printf( "After t1 tls = %p, read = %p\n", t, t->read );
Code: Select all
t1 tls = 0x3ffc9c50, read = 0x0
t1 tls = 0x3ffc9c50, read = 0xababab
After t1 tls = 0x3ffc9c50
After t1 tls = 0x3ffc9c50, [b]read = 0x0[/b]
Any ideas? I'm lost.
Thanks
Klaus