Enabling this setting adds approximately 1KB to the app's IRAM usage.
+config ESP_ERR_TO_NAME_LOOKUP
+ bool "Enable lookup of error code strings"
+ default "y"
+ help
+ Functions esp_err_to_name() and esp_err_to_name_r() return string
+ representations of error codes from a pre-generated lookup table.
+ This option can be used to turn off the use of the look-up table in
+ order to save memory but this comes at the price of sacrificing
+ distinguishable (meaningful) output string representations.
+
endmenu # ESP32-Specific
menu Wi-Fi
#include "tcpip_adapter.h"
#endif
+#ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
#define ERR_TBL_IT(err) {err, #err}
typedef struct {
ERR_TBL_IT(ESP_ERR_FLASH_OP_TIMEOUT), /* 65554 0x10012 */
# endif
};
+#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
-static const char esp_unknown_msg[] = "UNKNOWN ERROR";
+static const char esp_unknown_msg[] =
+#ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
+ "ERROR";
+#else
+ "UNKNOWN ERROR";
+#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
const char *esp_err_to_name(esp_err_t code)
{
+#ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
int i;
for (i = 0; i < sizeof(esp_err_msg_table)/sizeof(esp_err_msg_table[0]); ++i) {
return esp_err_msg_table[i].msg;
}
}
+#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
return esp_unknown_msg;
}
const char *esp_err_to_name_r(esp_err_t code, char *buf, size_t buflen)
{
+#ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
int i;
for (i = 0; i < sizeof(esp_err_msg_table)/sizeof(esp_err_msg_table[0]); ++i) {
return buf;
}
}
+#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
if (strerror_r(code, buf, buflen) == 0) {
return buf;
#endif
@HEADERS@
+#ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
#define ERR_TBL_IT(err) {err, #err}
typedef struct {
static const esp_err_msg_t esp_err_msg_table[] = {
@ERROR_ITEMS@
};
+#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
-static const char esp_unknown_msg[] = "UNKNOWN ERROR";
+static const char esp_unknown_msg[] =
+#ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
+ "ERROR";
+#else
+ "UNKNOWN ERROR";
+#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
const char *esp_err_to_name(esp_err_t code)
{
+#ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
int i;
for (i = 0; i < sizeof(esp_err_msg_table)/sizeof(esp_err_msg_table[0]); ++i) {
return esp_err_msg_table[i].msg;
}
}
+#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
return esp_unknown_msg;
}
const char *esp_err_to_name_r(esp_err_t code, char *buf, size_t buflen)
{
+#ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
int i;
for (i = 0; i < sizeof(esp_err_msg_table)/sizeof(esp_err_msg_table[0]); ++i) {
return buf;
}
}
+#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
if (strerror_r(code, buf, buflen) == 0) {
return buf;