Compare commits

...

11 Commits

Author SHA1 Message Date
Tobias Schramm
0446d77c3e bootloader: ensure security eFuses are always burnt
Previously security eFuses were only burnt if the flash was not encrypted
yet.
To enhance robustness of the security eFuse settings their correct setup
should be verified on each bootup. Else it would be possible for an
already encrypted ESP to be reflashed with firmware containing updated,
more restrictive eFuse settings without them ever being applied.
Additionally this change enables easy, secure use of ESPs with host sidee
flash preencryption. Flash preencryption by the host computer performing
the programming procedure can speed up the programming process by a great
deal since the flash no longer needs to be read, erased and written again
by the bootloader self-encryption routines. Additionally it avoids
bricking of ESPs through interruption of the self-ecnryption procedure.
Without this change the host would have to set up all fuses in the ESP
correctly by itself, duplicating the fuse configuration code already
present in the bootloader and creating additional maintenance burden for
the host software if anything about the fuse setup logic changes.
This commit changes the security eFuse configuration logic to always burn
any configured security eFuses on bootup, regardless of current flash
encryption status.
2022-07-19 12:42:55 +02:00
dc0b72f273 No more noreturn on asserts 2022-07-11 15:07:23 +02:00
fca498262f Add esp_tls option to skip server verification 2022-07-11 15:07:16 +02:00
8c27cbfa13 Return EAGAIN in http client perform 2022-05-24 11:48:32 +02:00
b8147adbfb log format improvements after rebase 2022-05-24 11:48:32 +02:00
c3ee0811cf Fix random crash with Plex mdns queries on my network 2022-05-24 11:48:32 +02:00
23e9d15d19 Fixed crash in coredump handler, when using printf arguments 2022-05-24 11:48:32 +02:00
fdd9bcff7c Reduced error log when calling esp_efuse_mac_get_custom() 2022-05-24 11:48:32 +02:00
38538babac Fixed coredump logging 2022-05-24 11:48:32 +02:00
83f91ceea8 Add support for X-WWW-Authenticate header 2022-05-24 11:48:32 +02:00
07984ad576 Added filename, line number and method name to log output 2022-05-24 11:48:31 +02:00
33 changed files with 147 additions and 88 deletions

View File

@@ -174,7 +174,7 @@ void esp_apptrace_log_unlock(void);
#define ESP_APPTRACE_LOG_LEV( _L_, level, format, ... ) \
do { \
if (LOG_LOCAL_LEVEL >= level) { \
ESP_APPTRACE_LOG(LOG_FORMAT(_L_, format), esp_log_early_timestamp(), TAG, ##__VA_ARGS__); \
ESP_APPTRACE_LOG(LOG_EARLY_FORMAT(_L_, format, TAG), ##__VA_ARGS__); \
} \
} while(0)

View File

@@ -54,7 +54,7 @@ const static char *TAG = "esp_apptrace_test";
#define ESP_APPTRACE_TEST_LOG_LEVEL( _L_, level, format, ... ) \
do { \
if (LOG_LOCAL_LEVEL >= level) { \
ESP_APPTRACE_TEST_LOG(LOG_FORMAT(_L_, format), esp_log_early_timestamp(), TAG, ##__VA_ARGS__); \
ESP_APPTRACE_TEST_LOG(LOG_EARLY_FORMAT(_L_, format, TAG), ##__VA_ARGS__); \
} \
} while(0)

View File

@@ -54,12 +54,31 @@ esp_err_t esp_flash_encrypt_check_and_update(void)
ESP_LOGV(TAG, "CRYPT_CNT %d, write protection %d", flash_crypt_cnt, flash_crypt_wr_dis);
if (flash_crypt_cnt % 2 == 1) {
esp_err_t err;
/* Flash is already encrypted */
int left = (CRYPT_CNT[0]->bit_count - flash_crypt_cnt) / 2;
if (flash_crypt_wr_dis) {
left = 0; /* can't update FLASH_CRYPT_CNT, no more flashes */
}
ESP_LOGI(TAG, "flash encryption is enabled (%d plaintext flashes left)", left);
/* Ensure security eFuses are burnt */
esp_efuse_batch_write_begin();
err = esp_flash_encryption_enable_secure_features();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Error setting security eFuses (err=0x%x).", err);
esp_efuse_batch_write_cancel();
return err;
}
err = esp_efuse_batch_write_commit();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Error programming security eFuses (err=0x%x).", err);
return err;
}
ESP_LOGI(TAG, "Security eFuses are burnt");
return ESP_OK;
} else {
#ifndef CONFIG_SECURE_FLASH_REQUIRE_ALREADY_ENABLED

View File

@@ -93,11 +93,11 @@
#define BT_LOG_LEVEL_CHECK(LAYER, LEVEL) (MAX(LAYER##_INITIAL_TRACE_LEVEL, LOG_LOCAL_LEVEL_MAPPING) >= BT_TRACE_LEVEL_##LEVEL)
#define BT_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BT_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BT_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BT_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BT_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BT_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format, tag), ##__VA_ARGS__); }
#define BT_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format, tag), ##__VA_ARGS__); }
#define BT_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format, tag), ##__VA_ARGS__); }
#define BT_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format, tag), ##__VA_ARGS__); }
#define BT_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format, tag), ##__VA_ARGS__); }
#if !UC_BT_STACK_NO_LOG

View File

@@ -61,11 +61,11 @@ extern "C" {
#define BLE_MESH_LOG_LEVEL_CHECK(LAYER, LEVEL) (MAX(LAYER##_LOG_LEVEL, BLE_MESH_LOG_LOCAL_LEVEL_MAPPING) >= BLE_MESH_LOG_LEVEL_##LEVEL)
#define BLE_MESH_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BLE_MESH_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BLE_MESH_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BLE_MESH_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BLE_MESH_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define BLE_MESH_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format, tag), ##__VA_ARGS__); }
#define BLE_MESH_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format, tag), ##__VA_ARGS__); }
#define BLE_MESH_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format, tag), ##__VA_ARGS__); }
#define BLE_MESH_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format, tag), ##__VA_ARGS__); }
#define BLE_MESH_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format, tag), ##__VA_ARGS__); }
#define printk esp_rom_printf

View File

@@ -209,11 +209,11 @@ static inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t l
// btla-specific --
#if !UC_BT_STACK_NO_LOG
#define LOG_ERROR(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) esp_log_write(ESP_LOG_ERROR, "BT_LOG", LOG_FORMAT(E, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
#define LOG_WARN(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) esp_log_write(ESP_LOG_WARN, "BT_LOG", LOG_FORMAT(W, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
#define LOG_INFO(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) esp_log_write(ESP_LOG_INFO, "BT_LOG", LOG_FORMAT(I, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
#define LOG_DEBUG(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) esp_log_write(ESP_LOG_DEBUG, "BT_LOG", LOG_FORMAT(D, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
#define LOG_VERBOSE(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_VERBOSE) esp_log_write(ESP_LOG_VERBOSE, "BT_LOG", LOG_FORMAT(V, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
#define LOG_ERROR(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) esp_log_write(ESP_LOG_ERROR, "BT_LOG", LOG_FORMAT(E, format, "BT_LOG"), ##__VA_ARGS__); }
#define LOG_WARN(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) esp_log_write(ESP_LOG_WARN, "BT_LOG", LOG_FORMAT(W, format, "BT_LOG"), ##__VA_ARGS__); }
#define LOG_INFO(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) esp_log_write(ESP_LOG_INFO, "BT_LOG", LOG_FORMAT(I, format, "BT_LOG"), ##__VA_ARGS__); }
#define LOG_DEBUG(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) esp_log_write(ESP_LOG_DEBUG, "BT_LOG", LOG_FORMAT(D, format, "BT_LOG"), ##__VA_ARGS__); }
#define LOG_VERBOSE(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_VERBOSE) esp_log_write(ESP_LOG_VERBOSE, "BT_LOG", LOG_FORMAT(V, format, "BT_LOG"), ##__VA_ARGS__); }
/* Define tracing for BTM
*/

View File

@@ -151,6 +151,10 @@ typedef struct esp_tls_cfg {
bool use_global_ca_store; /*!< Use a global ca_store for all the connections in which
this bool is set. */
bool skip_server_verification; /*!< Don't try to verificate the server's certificate in any
way. Should never be used in production and only help to debug
a faulty connection. */
const char *common_name; /*!< If non-NULL, server certificate CN must match this name.
If NULL, server certificate CN must match hostname. */

View File

@@ -660,6 +660,9 @@ esp_err_t set_client_config(const char *hostname, size_t hostlen, esp_tls_cfg_t
if (esp_ret != ESP_OK) {
return esp_ret;
}
} else if (cfg->skip_server_verification == true) {
mbedtls_ssl_conf_authmode(&tls->conf, MBEDTLS_SSL_VERIFY_NONE);
ESP_LOGE(TAG, "insecure connection without server verification, USE ONLY FOR DEBUGGING!");
} else if (cfg->cacert_buf != NULL) {
esp_err_t esp_ret = set_ca_cert(tls, cfg->cacert_buf, cfg->cacert_bytes);
if (esp_ret != ESP_OK) {

View File

@@ -203,6 +203,9 @@ static esp_err_t set_client_config(const char *hostname, size_t hostlen, esp_tls
return ESP_ERR_WOLFSSL_CERT_VERIFY_SETUP_FAILED;
}
wolfSSL_CTX_set_verify( (WOLFSSL_CTX *)tls->priv_ctx, WOLFSSL_VERIFY_PEER, NULL);
} else if (cfg->use_global_ca_store == true) {
wolfSSL_CTX_set_verify( (WOLFSSL_CTX *)tls->priv_ctx, WOLFSSL_VERIFY_NONE, NULL);
ESP_LOGE(TAG, "insecure connection without server verification, USE ONLY FOR DEBUGGING!");
} else if (cfg->cacert_buf != NULL) {
if ((esp_load_wolfssl_verify_buffer(tls, cfg->cacert_buf, cfg->cacert_bytes, FILE_TYPE_CA_CERT, &ret)) != ESP_OK) {
int err = wolfSSL_get_error( (WOLFSSL *)tls->priv_ssl, ret);

View File

@@ -238,7 +238,8 @@ static int http_on_header_value(http_parser *parser, const char *at, size_t leng
} else if (strcasecmp(client->current_header_key, "Transfer-Encoding") == 0
&& memcmp(at, "chunked", length) == 0) {
client->response->is_chunked = true;
} else if (strcasecmp(client->current_header_key, "WWW-Authenticate") == 0) {
} else if (strcasecmp(client->current_header_key, "WWW-Authenticate") == 0 ||
strcasecmp(client->current_header_key, "X-WWW-Authenticate") == 0) {
http_utils_append_string(&client->auth_header, at, length);
}
http_utils_append_string(&client->current_header_value, at, length);
@@ -639,6 +640,8 @@ esp_http_client_handle_t esp_http_client_init(const esp_http_client_config_t *co
#endif
} else if (config->use_global_ca_store == true) {
esp_transport_ssl_enable_global_ca_store(ssl);
} else if (config->skip_server_verification == true) {
esp_transport_ssl_skip_server_verification(ssl);
} else if (config->cert_pem) {
if (!config->cert_len) {
esp_transport_ssl_set_cert_data(ssl, config->cert_pem, strlen(config->cert_pem));
@@ -1102,7 +1105,7 @@ int esp_http_client_read(esp_http_client_handle_t client, char *buffer, int len)
esp_err_t esp_http_client_perform(esp_http_client_handle_t client)
{
esp_err_t err;
do {
//do {
if (client->process_again) {
esp_http_client_prepare(client);
}
@@ -1202,8 +1205,9 @@ esp_err_t esp_http_client_perform(esp_http_client_handle_t client)
default:
break;
}
} while (client->process_again);
return ESP_OK;
//} while (client->process_again);
//return ESP_OK;
return client->process_again ? EAGAIN : ESP_OK;
}
int64_t esp_http_client_fetch_headers(esp_http_client_handle_t client)

View File

@@ -130,6 +130,7 @@ typedef struct {
bool is_async; /*!< Set asynchronous mode, only supported with HTTPS for now */
bool use_global_ca_store; /*!< Use a global ca_store for all the connections in which this bool is set. */
bool skip_cert_common_name_check; /*!< Skip any validation of server certificate CN field */
bool skip_server_verification; /*!< Skip server verification completely. Should only be used for debugging */
esp_err_t (*crt_bundle_attach)(void *conf); /*!< Function pointer to esp_crt_bundle_attach. Enables the use of certification
bundle for server verification, must be enabled in menuconfig */
bool keep_alive_enable; /*!< Enable keep-alive timeout */

View File

@@ -86,7 +86,8 @@ esp_err_t esp_efuse_mac_get_custom(uint8_t *mac)
uint8_t version;
esp_efuse_read_field_blob(ESP_EFUSE_MAC_CUSTOM_VER, &version, 8);
if (version != 1) {
ESP_LOGE(TAG, "Base MAC address from BLK3 of EFUSE version error, version = %d", version);
// version 0 means has not been setup
ESP_LOG_LEVEL_LOCAL((version == 0 ? ESP_LOG_DEBUG : ESP_LOG_ERROR), TAG, "Base MAC address from BLK3 of EFUSE version error, version = %d", version);
return ESP_ERR_INVALID_VERSION;
}

View File

@@ -69,7 +69,7 @@ struct syscall_stub_table
void (*_retarget_lock_release_recursive)(_LOCK_T lock);
int (*_printf_float)(struct _reent *data, void *pdata, FILE * fp, int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list * ap);
int (*_scanf_float) (struct _reent *rptr, void *pdata, FILE *fp, va_list *ap);
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((noreturn));
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr);
void (*__sinit) (struct _reent *r);
void (*_cleanup_r) (struct _reent* r);
};

View File

@@ -77,7 +77,7 @@ struct syscall_stub_table
void (*_retarget_lock_release_recursive)(_LOCK_T lock);
int (*_printf_float)(struct _reent *data, void *pdata, FILE * fp, int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list * ap);
int (*_scanf_float) (struct _reent *rptr, void *pdata, FILE *fp, va_list *ap);
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((noreturn));
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr);
void (*__sinit) (struct _reent *r);
void (*_cleanup_r) (struct _reent* r);
};

View File

@@ -90,7 +90,7 @@ struct syscall_stub_table
#endif
int (*_printf_float)(struct _reent *data, void *pdata, FILE * fp, int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list * ap);
int (*_scanf_float) (struct _reent *rptr, void *pdata, FILE *fp, va_list *ap);
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((noreturn));
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr);
void (*__sinit) (struct _reent *r);
void (*_cleanup_r) (struct _reent* r);
};

View File

@@ -78,7 +78,7 @@ struct syscall_stub_table
void (*_retarget_lock_release_recursive)(_LOCK_T lock);
int (*_printf_float)(struct _reent *data, void *pdata, FILE * fp, int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list * ap);
int (*_scanf_float) (struct _reent *rptr, void *pdata, FILE *fp, va_list *ap);
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((noreturn));
void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr);
void (*__sinit) (struct _reent *r);
void (*_cleanup_r) (struct _reent* r);
};

View File

@@ -130,7 +130,7 @@ const char *esp_get_idf_version(void)
return IDF_VER;
}
void __attribute__((noreturn)) esp_system_abort(const char *details)
void esp_system_abort(const char *details)
{
panic_abort(details);
}

View File

@@ -76,7 +76,7 @@ void panic_print_hex(int h);
#define panic_print_hex(h)
#endif
void __attribute__((noreturn)) panic_abort(const char *details);
void panic_abort(const char *details);
void panic_arch_fill_info(void *frame, panic_info_t *info);

View File

@@ -112,7 +112,7 @@ uint32_t esp_get_minimum_free_heap_size( void );
*
* @param details Details that will be displayed during panic handling.
*/
void __attribute__((noreturn)) esp_system_abort(const char* details);
void esp_system_abort(const char* details);
#ifdef __cplusplus
}

View File

@@ -392,7 +392,7 @@ void esp_panic_handler(panic_info_t *info)
}
void IRAM_ATTR __attribute__((noreturn, no_sanitize_undefined)) panic_abort(const char *details)
void IRAM_ATTR __attribute__((no_sanitize_undefined)) panic_abort(const char *details)
{
g_panic_abort = true;
s_panic_abort_details = (char *) details;

View File

@@ -221,7 +221,7 @@ void IRAM_ATTR xt_unhandled_exception(void *frame)
panic_handler(frame, false);
}
void __attribute__((noreturn)) panic_restart(void)
void panic_restart(void)
{
bool digital_reset_needed = false;
#ifdef CONFIG_IDF_TARGET_ESP32

View File

@@ -111,7 +111,7 @@ struct invalid_builtin_data {
};
static void __ubsan_default_handler(struct source_location *loc, const char *func) __attribute__((noreturn));
static void __ubsan_default_handler(struct source_location *loc, const char *func);
/*
* When compiling with -fsanitize=undefined the compiler expects functions

View File

@@ -26,12 +26,13 @@ extern "C" {
#include "esp_private/panic_internal.h"
#include "core_dump_checksum.h"
#define ESP_COREDUMP_LOG( level, format, ... ) if (LOG_LOCAL_LEVEL >= level) { esp_rom_printf(DRAM_STR(format), esp_log_early_timestamp(), (const char *)TAG, ##__VA_ARGS__); }
#define ESP_COREDUMP_LOGE( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_ERROR, LOG_FORMAT(E, format), ##__VA_ARGS__)
#define ESP_COREDUMP_LOGW( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_WARN, LOG_FORMAT(W, format), ##__VA_ARGS__)
#define ESP_COREDUMP_LOGI( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_INFO, LOG_FORMAT(I, format), ##__VA_ARGS__)
#define ESP_COREDUMP_LOGD( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_DEBUG, LOG_FORMAT(D, format), ##__VA_ARGS__)
#define ESP_COREDUMP_LOGV( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_VERBOSE, LOG_FORMAT(V, format), ##__VA_ARGS__)
#define ESP_COREDUMP_TAG "COREDUMP"
#define ESP_COREDUMP_LOG( level, format, ... ) if (LOG_LOCAL_LEVEL >= level) { esp_rom_printf(format, ##__VA_ARGS__); }
#define ESP_COREDUMP_LOGE( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_ERROR, LOG_FORMAT_DRAM(E, format, ESP_COREDUMP_TAG), ##__VA_ARGS__)
#define ESP_COREDUMP_LOGW( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_WARN, LOG_FORMAT_DRAM(W, format, ESP_COREDUMP_TAG), ##__VA_ARGS__)
#define ESP_COREDUMP_LOGI( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_INFO, LOG_FORMAT_DRAM(I, format, ESP_COREDUMP_TAG), ##__VA_ARGS__)
#define ESP_COREDUMP_LOGD( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_DEBUG, LOG_FORMAT_DRAM(D, format, ESP_COREDUMP_TAG), ##__VA_ARGS__)
#define ESP_COREDUMP_LOGV( format, ... ) ESP_COREDUMP_LOG(ESP_LOG_VERBOSE, LOG_FORMAT_DRAM(V, format, ESP_COREDUMP_TAG), ##__VA_ARGS__)
/**
* @brief Assertion to be verified in a release context. Cannot be muted.

View File

@@ -172,7 +172,7 @@ static void esp_core_dump_switch_task_stack_to_isr(core_dump_task_header_t *task
}
task->stack_start = (uint32_t) s_exc_frame;
task->stack_end = esp_core_dump_get_isr_stack_end();
ESP_COREDUMP_LOG_PROCESS("Switched task %x to ISR stack [%x...%x]", task->tcb_addr,
ESP_COREDUMP_LOG_PROCESS("Switched task %p to ISR stack [%x...%x]", task->tcb_addr,
task->stack_start,
task->stack_end);
}
@@ -207,11 +207,11 @@ bool esp_core_dump_get_task_snapshot(void *handle, core_dump_task_header_t *task
task->stack_start = (uint32_t) s_exc_frame;
}
if (!esp_core_dump_check_task(task)) {
ESP_COREDUMP_LOG_PROCESS("Task %x is broken!", handle);
ESP_COREDUMP_LOG_PROCESS("Task %p is broken!", handle);
return false;
}
if (handle == esp_core_dump_get_current_task_handle()) {
ESP_COREDUMP_LOG_PROCESS("Crashed task %x", handle);
ESP_COREDUMP_LOG_PROCESS("Crashed task %p", handle);
esp_core_dump_port_set_crashed_tcb((uint32_t)handle);
if (xPortInterruptedFromISRContext()) {
esp_core_dump_switch_task_stack_to_isr(task, interrupted_stack);

View File

@@ -257,7 +257,7 @@ static int elf_add_regs(core_dump_elf_t *self, core_dump_task_header_t *task)
uint32_t len = esp_core_dump_get_task_regs_dump(task, &reg_dump);
if (len == 0) {
ESP_COREDUMP_LOGE("Zero size register dump for task 0x%x!", task->tcb_addr);
ESP_COREDUMP_LOGE("Zero size register dump for task 0x%p!", task->tcb_addr);
return ELF_PROC_ERR_OTHER;
}
@@ -276,7 +276,7 @@ static int elf_add_stack(core_dump_elf_t *self, core_dump_task_header_t *task)
ELF_CHECK_ERR((task), ELF_PROC_ERR_OTHER, "Invalid task pointer.");
stack_len = esp_core_dump_get_stack(task, &stack_vaddr, &stack_paddr);
ESP_COREDUMP_LOG_PROCESS("Add stack for task 0x%x: addr 0x%x, sz %u",
ESP_COREDUMP_LOG_PROCESS("Add stack for task 0x%p: addr 0x%x, sz %u",
task->tcb_addr, stack_vaddr, stack_len);
int ret = elf_add_segment(self, PT_LOAD,
(uint32_t)stack_vaddr,
@@ -289,7 +289,7 @@ static int elf_add_tcb(core_dump_elf_t *self, core_dump_task_header_t *task)
{
ELF_CHECK_ERR((task), ELF_PROC_ERR_OTHER, "Invalid task pointer.");
// add task tcb data into program segment of ELF
ESP_COREDUMP_LOG_PROCESS("Add TCB for task 0x%x: addr 0x%x, sz %u",
ESP_COREDUMP_LOG_PROCESS("Add TCB for task 0x%p: addr 0x%p, sz %u",
task->tcb_addr, task->tcb_addr,
esp_core_dump_get_tcb_len());
int ret = elf_add_segment(self, PT_LOAD,
@@ -308,7 +308,7 @@ static int elf_process_task_tcb(core_dump_elf_t *self, core_dump_task_header_t *
// save tcb of the task as is and apply segment size
ret = elf_add_tcb(self, task);
if (ret <= 0) {
ESP_COREDUMP_LOGE("Task (TCB:%x) processing failure = %d",
ESP_COREDUMP_LOGE("Task (TCB:%p) processing failure = %d",
task->tcb_addr,
ret);
}
@@ -323,7 +323,7 @@ static int elf_process_task_stack(core_dump_elf_t *self, core_dump_task_header_t
ret = elf_add_stack(self, task);
if (ret <= 0) {
ESP_COREDUMP_LOGE("Task (TCB:%x), (Stack:%x), stack processing failure = %d.",
ESP_COREDUMP_LOGE("Task (TCB:%p), (Stack:%x), stack processing failure = %d.",
task->tcb_addr,
task->stack_start,
ret);
@@ -374,9 +374,9 @@ static int elf_process_tasks_regs(core_dump_elf_t *self)
ret = elf_add_regs(self, &task_hdr);
if (self->elf_stage == ELF_STAGE_PLACE_HEADERS) {
// when writing segments headers this function writes nothing
ELF_CHECK_ERR((ret >= 0), ret, "Task %x, PR_STATUS write failed, return (%d).", task, ret);
ELF_CHECK_ERR((ret >= 0), ret, "Task %p, PR_STATUS write failed, return (%d).", task, ret);
} else {
ELF_CHECK_ERR((ret > 0), ret, "Task %x, PR_STATUS write failed, return (%d).", task, ret);
ELF_CHECK_ERR((ret > 0), ret, "Task %p, PR_STATUS write failed, return (%d).", task, ret);
}
len += ret;
}
@@ -392,9 +392,9 @@ static int elf_process_tasks_regs(core_dump_elf_t *self)
ret = elf_add_regs(self, &task_hdr);
if (self->elf_stage == ELF_STAGE_PLACE_HEADERS) {
// when writing segments headers this function writes nothing
ELF_CHECK_ERR((ret >= 0), ret, "Task %x, PR_STATUS write failed, return (%d).", task, ret);
ELF_CHECK_ERR((ret >= 0), ret, "Task %p, PR_STATUS write failed, return (%d).", task, ret);
} else {
ELF_CHECK_ERR((ret > 0), ret, "Task %x, PR_STATUS write failed, return (%d).", task, ret);
ELF_CHECK_ERR((ret > 0), ret, "Task %p, PR_STATUS write failed, return (%d).", task, ret);
}
len += ret;
}
@@ -411,11 +411,11 @@ static int elf_save_task(core_dump_elf_t *self, core_dump_task_header_t *task)
int ret = elf_process_task_tcb(self, task);
ELF_CHECK_ERR((ret > 0), ret,
"Task %x, TCB write failed, return (%d).", task->tcb_addr, ret);
"Task %p, TCB write failed, return (%d).", task->tcb_addr, ret);
elf_len += ret;
ret = elf_process_task_stack(self, task);
ELF_CHECK_ERR((ret != ELF_PROC_ERR_WRITE_FAIL), ELF_PROC_ERR_WRITE_FAIL,
"Task %x, stack write failed, return (%d).", task->tcb_addr, ret);
"Task %p, stack write failed, return (%d).", task->tcb_addr, ret);
elf_len += ret;
return elf_len;
}
@@ -448,10 +448,10 @@ static int elf_write_tasks_data(core_dump_elf_t *self)
}
ret = elf_save_task(self, &task_hdr);
ELF_CHECK_ERR((ret > 0), ret,
"Task %x, TCB write failed, return (%d).", task, ret);
"Task %p, TCB write failed, return (%d).", task, ret);
elf_len += ret;
if (interrupted_stack.size > 0) {
ESP_COREDUMP_LOG_PROCESS("Add interrupted task stack %lu bytes @ %x",
ESP_COREDUMP_LOG_PROCESS("Add interrupted task stack %u bytes @ %x",
interrupted_stack.size, interrupted_stack.start);
ret = elf_add_segment(self, PT_LOAD,
(uint32_t)interrupted_stack.start,
@@ -576,7 +576,7 @@ esp_err_t esp_core_dump_write_elf(core_dump_write_config_t *write_cfg)
int ret = esp_core_dump_do_write_elf_pass(&self);
if (ret < 0) return ret;
tot_len += ret;
ESP_COREDUMP_LOG_PROCESS("Core dump tot_len=%lu", tot_len);
ESP_COREDUMP_LOG_PROCESS("Core dump tot_len=%i", tot_len);
ESP_COREDUMP_LOG_PROCESS("============== Data size = %d bytes ============", tot_len);
// Prepare write elf

View File

@@ -91,6 +91,9 @@ void esp_core_dump_flash_init(void)
ESP_COREDUMP_LOGE("No core dump partition found!");
return;
}
ESP_COREDUMP_LOGI("Found partition '%s'", "test");
ESP_COREDUMP_LOGI("Found partition '%p'", core_part);
ESP_COREDUMP_LOGI("Found partition '%p'", core_part->label);
ESP_COREDUMP_LOGI("Found partition '%s' @ %x %d bytes", core_part->label, core_part->address, core_part->size);
s_core_flash_config.partition.start = core_part->address;
s_core_flash_config.partition.size = core_part->size;

View File

@@ -370,20 +370,20 @@ bool esp_core_dump_check_task(core_dump_task_header_t *task)
bool stack_is_valid = false;
if (!esp_core_dump_tcb_addr_is_sane((uint32_t)task->tcb_addr)) {
ESP_COREDUMP_LOG_PROCESS("Bad TCB addr=%x!", task->tcb_addr);
ESP_COREDUMP_LOG_PROCESS("Bad TCB addr=%p!", task->tcb_addr);
return false;
}
stack_is_valid = esp_core_dump_check_stack(task);
if (!stack_is_valid) {
// Skip saving of invalid task if stack corrupted
ESP_COREDUMP_LOG_PROCESS("Task (TCB:%x), stack is corrupted (%x, %x)",
ESP_COREDUMP_LOG_PROCESS("Task (TCB:%p), stack is corrupted (%x, %x)",
task->tcb_addr,
task->stack_start,
task->stack_end);
task->stack_start = (uint32_t)esp_core_dump_get_fake_stack(&stk_size);
task->stack_end = (uint32_t)(task->stack_start + stk_size);
ESP_COREDUMP_LOG_PROCESS("Task (TCB:%x), use start, end (%x, %x)",
ESP_COREDUMP_LOG_PROCESS("Task (TCB:%p), use start, end (%x, %x)",
task->tcb_addr,
task->stack_start,
task->stack_end);
@@ -392,7 +392,7 @@ bool esp_core_dump_check_task(core_dump_task_header_t *task)
* would point to a fake address. */
XtSolFrame *sol_frame = (XtSolFrame *)task->stack_start;
if (sol_frame->exit == 0) {
ESP_COREDUMP_LOG_PROCESS("Task (TCB:%x), EXIT/PC/PS/A0/SP %x %x %x %x %x",
ESP_COREDUMP_LOG_PROCESS("Task (TCB:%p), EXIT/PC/PS/A0/SP %lx %lx %lx %lx %lx",
task->tcb_addr,
sol_frame->exit,
sol_frame->pc,
@@ -403,7 +403,7 @@ bool esp_core_dump_check_task(core_dump_task_header_t *task)
// to avoid warning that 'exc_frame' is unused when ESP_COREDUMP_LOG_PROCESS does nothing
#if CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH
XtExcFrame *exc_frame = (XtExcFrame *)task->stack_start;
ESP_COREDUMP_LOG_PROCESS("Task (TCB:%x) EXIT/PC/PS/A0/SP %x %x %x %x %x",
ESP_COREDUMP_LOG_PROCESS("Task (TCB:%p) EXIT/PC/PS/A0/SP %lx %lx %lx %lx %lx",
task->tcb_addr,
exc_frame->exit,
exc_frame->pc,
@@ -432,7 +432,7 @@ uint32_t esp_core_dump_get_task_regs_dump(core_dump_task_header_t *task, void **
stack_len = esp_core_dump_get_stack(task, &stack_vaddr, &stack_paddr);
ESP_COREDUMP_LOG_PROCESS("Add regs for task 0x%x", task->tcb_addr);
ESP_COREDUMP_LOG_PROCESS("Add regs for task 0x%p", task->tcb_addr);
// initialize program status for the task
s_reg_dump.pr_status.pr_cursig = 0;

View File

@@ -278,8 +278,12 @@ void esp_log_writev(esp_log_level_t level, const char* tag, const char* format,
#define LOG_RESET_COLOR
#endif //CONFIG_LOG_COLORS
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%u) %s: " format LOG_RESET_COLOR "\n"
#define LOG_SYSTEM_TIME_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%s) %s: " format LOG_RESET_COLOR "\n"
#define LOG_FORMAT(letter, format, tag) LOG_COLOR_ ## letter #letter " (%u) %s %s:%d %s(): " format LOG_RESET_COLOR "\n", esp_log_timestamp(), tag, (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__
#define LOG_SYSTEM_TIME_FORMAT(letter, format, tag) LOG_COLOR_ ## letter #letter " (%s) %s %s:%d %s(): " format LOG_RESET_COLOR "\n", esp_log_system_timestamp(), tag, (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__
// the following format helper is used in espcoredump
#define LOG_FORMAT_DRAM(letter, format, tag) DRAM_STR(LOG_COLOR_ ## letter #letter " (%u) %s %s:%d %s(): " format LOG_RESET_COLOR "\n"), esp_log_timestamp(), tag, (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__
// the following format helper is used in app_trace
#define LOG_EARLY_FORMAT(letter, format, tag) LOG_COLOR_ ## letter #letter " (%u) %s %s:%d %s(): " format LOG_RESET_COLOR "\n", esp_log_early_timestamp(), tag, (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__
/** @endcond */
@@ -325,7 +329,7 @@ void esp_log_writev(esp_log_level_t level, const char* tag, const char* format,
#define ESP_LOG_EARLY_IMPL(tag, format, log_level, log_tag_letter, ...) do { \
if (_ESP_LOG_EARLY_ENABLED(log_level)) { \
esp_rom_printf(LOG_FORMAT(log_tag_letter, format), esp_log_timestamp(), tag, ##__VA_ARGS__); \
esp_rom_printf(LOG_FORMAT(log_tag_letter, format, tag), ##__VA_ARGS__); \
}} while(0)
#ifndef BOOTLOADER_BUILD
@@ -388,37 +392,37 @@ void esp_log_writev(esp_log_level_t level, const char* tag, const char* format,
#if defined(__cplusplus) && (__cplusplus > 201703L)
#if CONFIG_LOG_TIMESTAMP_SOURCE_RTOS
#define ESP_LOG_LEVEL(level, tag, format, ...) do { \
if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
else { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format, tag) __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format, tag) __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format, tag) __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format, tag) __VA_OPT__(,) __VA_ARGS__); } \
else { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format, tag) __VA_OPT__(,) __VA_ARGS__); } \
} while(0)
#elif CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM
#define ESP_LOG_LEVEL(level, tag, format, ...) do { \
if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_SYSTEM_TIME_FORMAT(E, format), esp_log_system_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_SYSTEM_TIME_FORMAT(W, format), esp_log_system_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_SYSTEM_TIME_FORMAT(D, format), esp_log_system_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_SYSTEM_TIME_FORMAT(V, format), esp_log_system_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
else { esp_log_write(ESP_LOG_INFO, tag, LOG_SYSTEM_TIME_FORMAT(I, format), esp_log_system_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_SYSTEM_TIME_FORMAT(E, format, tag) __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_SYSTEM_TIME_FORMAT(W, format, tag) __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_SYSTEM_TIME_FORMAT(D, format, tag) __VA_OPT__(,) __VA_ARGS__); } \
else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_SYSTEM_TIME_FORMAT(V, format, tag) __VA_OPT__(,) __VA_ARGS__); } \
else { esp_log_write(ESP_LOG_INFO, tag, LOG_SYSTEM_TIME_FORMAT(I, format, tag) __VA_OPT__(,) __VA_ARGS__); } \
} while(0)
#endif //CONFIG_LOG_TIMESTAMP_SOURCE_xxx
#else // !(defined(__cplusplus) && (__cplusplus > 201703L))
#if CONFIG_LOG_TIMESTAMP_SOURCE_RTOS
#define ESP_LOG_LEVEL(level, tag, format, ...) do { \
if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \
else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \
else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \
else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \
else { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \
if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format, tag), ##__VA_ARGS__); } \
else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format, tag), ##__VA_ARGS__); } \
else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format, tag), ##__VA_ARGS__); } \
else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format, tag), ##__VA_ARGS__); } \
else { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format, tag), ##__VA_ARGS__); } \
} while(0)
#elif CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM
#define ESP_LOG_LEVEL(level, tag, format, ...) do { \
if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_SYSTEM_TIME_FORMAT(E, format), esp_log_system_timestamp(), tag, ##__VA_ARGS__); } \
else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_SYSTEM_TIME_FORMAT(W, format), esp_log_system_timestamp(), tag, ##__VA_ARGS__); } \
else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_SYSTEM_TIME_FORMAT(D, format), esp_log_system_timestamp(), tag, ##__VA_ARGS__); } \
else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_SYSTEM_TIME_FORMAT(V, format), esp_log_system_timestamp(), tag, ##__VA_ARGS__); } \
else { esp_log_write(ESP_LOG_INFO, tag, LOG_SYSTEM_TIME_FORMAT(I, format), esp_log_system_timestamp(), tag, ##__VA_ARGS__); } \
if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_SYSTEM_TIME_FORMAT(E, format, tag), ##__VA_ARGS__); } \
else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_SYSTEM_TIME_FORMAT(W, format, tag), ##__VA_ARGS__); } \
else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_SYSTEM_TIME_FORMAT(D, format, tag), ##__VA_ARGS__); } \
else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_SYSTEM_TIME_FORMAT(V, format, tag), ##__VA_ARGS__); } \
else { esp_log_write(ESP_LOG_INFO, tag, LOG_SYSTEM_TIME_FORMAT(I, format, tag), ##__VA_ARGS__); } \
} while(0)
#endif //CONFIG_LOG_TIMESTAMP_SOURCE_xxx
#endif // !(defined(__cplusplus) && (__cplusplus > 201703L))

View File

@@ -1658,6 +1658,8 @@ static bool _mdns_service_match_ptr_question(const mdns_service_t *service, cons
}
return false;
}
if (question->host && !service->instance)
return false;
if (question->host) {
if (strcasecmp(_mdns_get_service_instance_name(service), question->host) != 0) {
return false;

View File

@@ -19,7 +19,7 @@
#include "soc/soc_caps.h"
#include "hal/cpu_hal.h"
void __attribute__((noreturn)) abort(void)
void abort(void)
{
#define ERR_STR1 "abort() was called at PC 0x"
#define ERR_STR2 " on core "

View File

@@ -37,7 +37,7 @@ static inline void ra_to_str(char *addr)
/* Overriding assert function so that whenever assert is called from critical section,
* it does not lead to a crash of its own.
*/
void __attribute__((noreturn)) __assert_func(const char *file, int line, const char *func, const char *expr)
void __assert_func(const char *file, int line, const char *func, const char *expr)
{
#if CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
char buff[sizeof(ASSERT_STR) + 11 + 1] = ASSERT_STR;
@@ -84,9 +84,9 @@ void __attribute__((noreturn)) __assert_func(const char *file, int line, const c
buff[off] = '\0';
esp_system_abort(buff);
#endif /* CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT */
}
}
void __attribute__((noreturn)) __assert(const char *file, int line, const char *failedexpr)
void __assert(const char *file, int line, const char *failedexpr)
{
__assert_func(file, line, NULL, failedexpr);
}

View File

@@ -69,6 +69,14 @@ void esp_transport_ssl_crt_bundle_attach(esp_transport_handle_t t, esp_err_t ((*
*/
void esp_transport_ssl_enable_global_ca_store(esp_transport_handle_t t);
/**
* @brief Disable server verification. Should never be used in production
* and only help to debug a faulty connection.
*
* @param t ssl transport
*/
void esp_transport_ssl_skip_server_verification(esp_transport_handle_t t);
/**
* @brief Set SSL client certificate data for mutual authentication (as PEM format).
* Note that, this function stores the pointer to data, rather than making a copy.

View File

@@ -330,6 +330,12 @@ void esp_transport_ssl_enable_global_ca_store(esp_transport_handle_t t)
ssl->cfg.use_global_ca_store = true;
}
void esp_transport_ssl_skip_server_verification(esp_transport_handle_t t)
{
GET_SSL_FROM_TRANSPORT_OR_RETURN(ssl, t);
ssl->cfg.skip_server_verification = true;
}
#ifdef CONFIG_ESP_TLS_PSK_VERIFICATION
void esp_transport_ssl_set_psk_key_hint(esp_transport_handle_t t, const psk_hint_key_t* psk_hint_key)
{