diff --git a/components/esp-tls/esp_tls.c b/components/esp-tls/esp_tls.c index 4e6b0b7e5f..77bc7e6514 100644 --- a/components/esp-tls/esp_tls.c +++ b/components/esp-tls/esp_tls.c @@ -481,6 +481,7 @@ esp_tls_t *esp_tls_conn_new(const char *hostname, int hostlen, int port, const e } /* esp_tls_conn_new() API establishes connection in a blocking manner thus this loop ensures that esp_tls_conn_new() API returns only after connection is established unless there is an error*/ + size_t start = xTaskGetTickCount(); while (1) { int ret = esp_tls_low_level_conn(hostname, hostlen, port, cfg, tls); if (ret == 1) { @@ -489,6 +490,14 @@ esp_tls_t *esp_tls_conn_new(const char *hostname, int hostlen, int port, const e esp_tls_conn_delete(tls); ESP_LOGE(TAG, "Failed to open new connection"); return NULL; + } else if (ret == 0 && cfg->timeout_ms >= 0) { + size_t timeout_ticks = pdMS_TO_TICKS(cfg->timeout_ms); + uint32_t expired = xTaskGetTickCount() - start; + if (expired >= timeout_ticks) { + esp_tls_conn_delete(tls); + ESP_LOGE(TAG, "Failed to open new connection in specified timeout"); + return NULL; + } } } return NULL; diff --git a/components/esp32/cache_err_int.c b/components/esp32/cache_err_int.c index a6de81ce65..50228d6e23 100644 --- a/components/esp32/cache_err_int.c +++ b/components/esp32/cache_err_int.c @@ -13,9 +13,9 @@ // limitations under the License. /* - The cache has an interrupt that can be raised as soon as an access to a cached - region (flash, psram) is done without the cache being enabled. We use that here - to panic the CPU, which from a debugging perspective is better than grabbing bad + The cache has an interrupt that can be raised as soon as an access to a cached + region (flash, psram) is done without the cache being enabled. We use that here + to panic the CPU, which from a debugging perspective is better than grabbing bad data from the bus. */ @@ -73,7 +73,6 @@ void esp_cache_err_int_init() int IRAM_ATTR esp_cache_err_get_cpuid() { - esp_dport_access_int_pause(); const uint32_t pro_mask = DPORT_PRO_CPU_DISABLED_CACHE_IA_DRAM1 | DPORT_PRO_CPU_DISABLED_CACHE_IA_DROM0 | diff --git a/components/esp32/panic.c b/components/esp32/panic.c index 64383f5624..8f105cac37 100644 --- a/components/esp32/panic.c +++ b/components/esp32/panic.c @@ -382,7 +382,7 @@ static void illegal_instruction_helper(XtExcFrame *frame) panicPutStr("Memory dump at 0x"); panicPutHex(epc); panicPutStr(": "); - + panicPutHex(*pepc); panicPutStr(" "); panicPutHex(*(pepc + 1)); @@ -544,8 +544,9 @@ static void commonErrorHandler_dump(XtExcFrame *frame, int core_id) panicPutStr("\r\nELF file SHA256: "); char sha256_buf[65]; - esp_ota_get_app_elf_sha256(sha256_buf, sizeof(sha256_buf)); - panicPutStr(sha256_buf); + // Disable for avoid access cache + // esp_ota_get_app_elf_sha256(sha256_buf, sizeof(sha256_buf)); + // panicPutStr(sha256_buf); panicPutStr("\r\n"); /* With windowed ABI backtracing is easy, let's do it. */ @@ -623,7 +624,7 @@ static __attribute__((noreturn)) void commonErrorHandler(XtExcFrame *frame) rtc_wdt_disable(); #if CONFIG_ESP32_PANIC_PRINT_REBOOT || CONFIG_ESP32_PANIC_SILENT_REBOOT panicPutStr("Rebooting...\r\n"); - if (frame->exccause != PANIC_RSN_CACHEERR) { + if (esp_cache_err_get_cpuid() == -1) { esp_restart_noos(); } else { // The only way to clear invalid cache access interrupt is to reset the digital part diff --git a/components/esp_http_client/esp_http_client.c b/components/esp_http_client/esp_http_client.c index 9d38bb4850..87de4c6c2b 100644 --- a/components/esp_http_client/esp_http_client.c +++ b/components/esp_http_client/esp_http_client.c @@ -742,7 +742,7 @@ esp_err_t esp_http_client_set_url(esp_http_client_handle_t client, const char *u } else { return ESP_ERR_NO_MEM; } - } + } //Reset path and query if there are no information if (purl.field_data[UF_PATH].len) { @@ -825,7 +825,7 @@ int esp_http_client_read(esp_http_client_handle_t client, char *buffer, int len) ESP_LOGD(TAG, "need_read=%d, byte_to_read=%d, rlen=%d, ridx=%d", need_read, byte_to_read, rlen, ridx); if (rlen <= 0) { - return ridx; + return rlen; } res_buffer->output_ptr = buffer + ridx; http_parser_execute(client->parser, client->parser_settings, res_buffer->data, rlen);