Просмотр исходного кода

freertos/portmux: increase portmux timeouts to avoid crashing when using debug feature

Closes: https://github.com/espressif/esp-idf/issues/3629#
Felipe Neves 5 лет назад
Родитель
Сommit
fe6bc06366

+ 1 - 1
components/esp_common/Kconfig

@@ -156,7 +156,7 @@ menu "Common ESP-related"
     config ESP_INT_WDT_TIMEOUT_MS
         int "Interrupt watchdog timeout (ms)"
         depends on ESP_INT_WDT
-        default 300 if !ESP32_SPIRAM_SUPPORT
+        default 600 if !ESP32_SPIRAM_SUPPORT
         default 800 if ESP32_SPIRAM_SUPPORT
         range 10 10000
         help

+ 5 - 0
components/freertos/include/freertos/portmacro.h

@@ -83,6 +83,11 @@ extern "C" {
 #include "esp_private/crosscore_int.h"
 #include "esp_timer.h"              /* required for FreeRTOS run time stats */
 
+#if  CONFIG_IDF_TARGET_ESP32
+#include "esp32/clk.h"
+#elif CONFIG_IDF_TARGET_ESP32S2BETA
+#include "esp32s2beta/clk.h"
+#endif
 
 #include <esp_heap_caps.h>
 

+ 1 - 1
components/freertos/portmux_impl.inc.h

@@ -51,7 +51,7 @@ PORTMUX_AQUIRE_MUX_FN_NAME(portMUX_TYPE *mux, int timeout_cycles) {
 	bool set_timeout = timeout_cycles > portMUX_NO_TIMEOUT;
 #ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
 	if (!set_timeout) {
-		timeout_cycles = 10000; // Always set a timeout in debug mode
+		timeout_cycles = 1000000 * (esp_clk_cpu_freq() / 1000000); // Always set a timeout in debug mode
 		set_timeout = true;
 	}
 #endif