Skip to content

Commit 1c7d3b6

Browse files
committed
Merge branch 'change/update_at_core_v5.0' into 'release/v5.0.0.0'
change(core): Updated at core version to a0888632 (v5.0) See merge request application/esp-at!1988
2 parents e9fa003 + 07bc564 commit 1c7d3b6

11 files changed

Lines changed: 55 additions & 8 deletions

File tree

components/at/include/esp_at.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -168,3 +168,24 @@ esp_err_t esp_at_nvs_set_str(nvs_handle_t handle, const char *key, const char *v
168168
esp_err_t esp_at_nvs_get_str(nvs_handle_t handle, const char *key, char *out_value, size_t *length);
169169
esp_err_t esp_at_nvs_set_blob(nvs_handle_t handle, const char *key, const void *value, size_t length);
170170
esp_err_t esp_at_nvs_get_blob(nvs_handle_t handle, const char *key, void *out_value, size_t *length);
171+
172+
/**
173+
* @brief Yield the current task if the system has not recently executed the idle task.
174+
*
175+
* This function measures the elapsed time since the last execution of the FreeRTOS
176+
* idle hook. If that duration exceeds the specified threshold, the current task
177+
* voluntarily delays for a given number of RTOS ticks to allow lower-priority
178+
* tasks (including the idle task) to run.
179+
*
180+
* This mechanism is intended to prevent long-running tasks from monopolizing
181+
* the CPU under high workload conditions (e.g., heavy RX traffic), which may
182+
* otherwise trigger the task watchdog.
183+
*
184+
* @note This function must not be called from ISR context.
185+
*
186+
* @param[in] idle_timeout_ms Threshold in milliseconds. If the time since the
187+
* last idle hook execution exceeds this value,
188+
* a yield is performed.
189+
* @param[in] yield_ticks Number of RTOS ticks to delay when yielding.
190+
*/
191+
void esp_at_yield_if_idle_timeout(uint32_t idle_timeout_ms, uint32_t yield_ticks);

components/at/lib/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ESP32: 3258eee
22
ESP32C3: 3258eee
33
ESP32C2: 3258eee
4-
ESP32C5: d5a5cea
4+
ESP32C5: a088863
55
ESP32C6: 3258eee
6-
ESP32C61:d5a5cea
6+
ESP32C61:a088863
77
ESP32S2: 3258eee
1012 Bytes
Binary file not shown.
1016 Bytes
Binary file not shown.
84 Bytes
Binary file not shown.
88 Bytes
Binary file not shown.

components/at/src/at_init.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -10,6 +10,8 @@
1010
#include "nvs_flash.h"
1111
#include "esp_event.h"
1212
#include "esp_wifi.h"
13+
#include "esp_freertos_hooks.h"
14+
#include "esp_timer.h"
1315
#include "esp_log.h"
1416

1517
#if defined(CONFIG_BT_ENABLED)
@@ -33,6 +35,7 @@
3335
const char *g_at_mfg_nvs_name = "mfg_nvs";
3436

3537
// static variables
38+
static volatile int64_t s_last_idle_enter_us = 0;
3639
static const char *s_ready_str = "\r\nready\r\n";
3740
static at_mfg_params_storage_mode_t s_at_param_mode = AT_PARAMS_NONE;
3841
static const char *TAG = "at-init";
@@ -322,6 +325,26 @@ static IRAM_ATTR void at_alloc_failed_cb(size_t requested_size, uint32_t caps, c
322325
esp_rom_printf(DRAM_STR(LOG_ANSI_COLOR_REGULAR(LOG_ANSI_COLOR_RED) "alloc failed, size:%u, caps:0x%x" LOG_ANSI_COLOR_RESET "\n"), requested_size, caps);
323326
}
324327

328+
static bool at_idle_hook_cb(void)
329+
{
330+
s_last_idle_enter_us = esp_timer_get_time();
331+
return true;
332+
}
333+
334+
void esp_at_yield_if_idle_timeout(uint32_t idle_timeout_ms, uint32_t yield_ticks)
335+
{
336+
int64_t idle_gap_us = esp_timer_get_time() - s_last_idle_enter_us;
337+
const int64_t threshold_us = (int64_t)idle_timeout_ms * 1000;
338+
339+
if (idle_gap_us < threshold_us) {
340+
return;
341+
}
342+
343+
if (yield_ticks > 0) {
344+
vTaskDelay(yield_ticks);
345+
}
346+
}
347+
325348
#ifdef CONFIG_AT_DEBUG
326349
static void at_reconfigure_twdt(void)
327350
{
@@ -361,6 +384,9 @@ void esp_at_init(void)
361384
// register the callback function to be invoked if a memory allocation operation fails
362385
heap_caps_register_failed_alloc_callback(at_alloc_failed_cb);
363386

387+
// register idle hook to track last idle timestamp for watchdog prevention
388+
esp_register_freertos_idle_hook(at_idle_hook_cb);
389+
364390
#ifdef CONFIG_AT_DEBUG
365391
// reconfigure task watchdog timer to cancel the panic trigger when AT_DEBUG is enabled
366392
at_reconfigure_twdt();

module_config/module_esp32c5_default/sdkconfig.defaults

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ CONFIG_VFS_SUPPORT_TERMIOS=n
155155
CONFIG_LIBC_NEWLIB_NANO_FORMAT=y
156156

157157
# Common ESP-related
158-
CONFIG_ESP_TASK_WDT_TIMEOUT_S=60
158+
CONFIG_ESP_TASK_WDT_TIMEOUT_S=10
159159
CONFIG_ESP_TASK_WDT_PANIC=y
160160
CONFIG_ESP_ERR_TO_NAME_LOOKUP=n
161161

module_config/module_esp32c5_default/sdkconfig_silence.defaults

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ CONFIG_VFS_SUPPORT_TERMIOS=n
158158
CONFIG_LIBC_NEWLIB_NANO_FORMAT=y
159159

160160
# Common ESP-related
161-
CONFIG_ESP_TASK_WDT_TIMEOUT_S=60
161+
CONFIG_ESP_TASK_WDT_TIMEOUT_S=10
162162
CONFIG_ESP_TASK_WDT_PANIC=y
163163
CONFIG_ESP_ERR_TO_NAME_LOOKUP=n
164164

module_config/module_esp32c61_default/sdkconfig.defaults

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ CONFIG_VFS_SUPPORT_TERMIOS=n
168168
CONFIG_LIBC_NEWLIB_NANO_FORMAT=y
169169

170170
# Common ESP-related
171-
CONFIG_ESP_TASK_WDT_TIMEOUT_S=60
171+
CONFIG_ESP_TASK_WDT_TIMEOUT_S=10
172172
CONFIG_ESP_TASK_WDT_PANIC=y
173173
CONFIG_ESP_ERR_TO_NAME_LOOKUP=n
174174

0 commit comments

Comments
 (0)