[solved] sprintf() Guru Meditation Error (maximum Task Size?)
Posted: Mon Jun 01, 2020 10:55 am
Hello Together,
I have some problems while building a Webserver on the ESP32.
I think that it is a problem with the task stack size for exporting my configuration to the webserver with the sprintf() function.
I get the following Error:
I think it is an overflow with the sprintf() command. In my code it looks like this:
And the sprintf function is here (The list is shortened).
This problem does not happen if the html file is a little bit smaller.
Where can I enlarge the sprintf size?
I have some problems while building a Webserver on the ESP32.
I think that it is a problem with the task stack size for exporting my configuration to the webserver with the sprintf() function.
I get the following Error:
Code: Select all
<Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x400014dc PS : 0x00060730 A0 : 0x80164948 A1 : 0x3ffccdd0
A2 : 0x000022b3 A3 : 0x000022af A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000000 A9 : 0x3ffdcf71
A10 : 0x3ffdcf70 A11 : 0x3ffccf70 A12 : 0x00000001 A13 : 0x00060023
A14 : 0x00000001 A15 : 0x00000001 SAR : 0x00000004 EXCCAUSE: 0x0000001c
EXCVADDR: 0x000022b3 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffff9
Backtrace:0x400014d9:0x3ffccdd0 0x40164945:0x3ffccde0 0x40161a1d:0x3ffcd0f0 0x400d6daf:0x3ffcd1b0 0x400d808a:0x3ffcd370 0x40111ddb:0x3ffcd3b0 0x40110bf2:0x3ffcd3f0 0x40110c89:0x3ffcd480 0x401112c6:0x3ffcd4a0 0x4010f1b5:0x3ffcd4c0 0x4010f28b :0x3ffcd500 0x40087f89:0x3ffcd520
0x40164945: _svfprintf_r at /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/lib c/stdio/vfprintf.c:1528
0x40161a1d: sprintf at /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/std io/sprintf.c:618
0x400d6daf: export_aio_conf at c:\git\iotdevelopment\software\software.c\build/../components/AIO/src/AIO_Conf.c:106
0x400d808a: server_handler_get at c:\git\iotdevelopment\software\software.c\build/../components/AIO/src/AIO_Netw.c:135 ( discriminator 6)
0x40111ddb: httpd_uri at C:/git/esp-idf/components/esp_http_server/src/httpd_uri.c:332
0x40110bf2: httpd_parse_req at C:/git/esp-idf/components/esp_http_server/src/httpd_parse.c:667 (discriminator 6)
0x40110c89: httpd_req_new at C:/git/esp-idf/components/esp_http_server/src/httpd_parse.c:788
0x401112c6: httpd_sess_process at C:/git/esp-idf/components/esp_http_server/src/httpd_sess.c:304 (discriminator 6)
0x4010f1b5: httpd_server at C:/git/esp-idf/components/esp_http_server/src/httpd_main.c:197 (discriminator 6)
0x4010f28b: httpd_thread at C:/git/esp-idf/components/esp_http_server/src/httpd_main.c:227
0x40087f89: vPortTaskWrapper at C:/git/esp-idf/components/freertos/xtensa/port.c:143
Code: Select all
char* HTML = (char*)malloc(8500);
if (HTML != NULL)
{
ESP_LOGD(TAG,"Fill HTML file");
export_aio_conf(conf, HTML, html_request);
}
ESP_LOGD(TAG,"Send Response");
httpd_resp_send(req, (const char*)HTML, strlen(HTML));
free(HTML);
Code: Select all
esp_err_t export_aio_conf(aio_conf_t* conf, char* str, const char* reg_str)
{
ESP_LOGD(TAG, "starting to Export config");
printf("string:\n %s ", reg_str);
int ret = sprintf(str, reg_str,
(conf->wifi_ap_ssid[0] != '\0') ? (conf->wifi_ap_ssid) : "\0",
(conf->wifi_ap_pass[0] != '\0') ? (conf->wifi_ap_pass) : "\0",
(conf->wifi_sta_ssid[0] != '\0') ? (conf->wifi_sta_ssid) : "\0",
(conf->wifi_sta_pass[0] != '\0') ? (conf->wifi_sta_pass) : "\0",
(conf->mqtt_encrypt == 0) ? "selected" : "\0");
ESP_LOGD(TAG, "ret = %d", ret);
if (ret < 0)
return ESP_ERR_NOT_FOUND;
return ESP_OK;
}
Where can I enlarge the sprintf size?