3636#define BACKTRACE_MSG "backtrace"
3737#endif
3838
39+ #if CONFIG_PM_RTOS_IDLE_OPT
40+ # define TASK_WDT_FN_ATTR IRAM_ATTR
41+ #else
42+ # define TASK_WDT_FN_ATTR
43+ #endif
44+
3945/* We will use this function in order to simulate an `abort()` occurring in
4046 * a different context than the one it's called from. */
4147extern void xt_unhandled_exception (void * frame );
@@ -96,7 +102,7 @@ static char core_user_names[CONFIG_FREERTOS_NUMBER_OF_CORES][CORE_USER_NAME_LEN]
96102 * @brief Reset the timer and reset flags of each entry
97103 * When entering this function, the spinlock has already been taken, no need to take it back.
98104 */
99- static void task_wdt_timer_feed (void )
105+ static TASK_WDT_FN_ATTR void task_wdt_timer_feed (void )
100106{
101107 esp_task_wdt_impl_timer_feed (p_twdt_obj -> impl_ctx );
102108
@@ -114,7 +120,7 @@ static void task_wdt_timer_feed(void)
114120 * @param[out] all_reset Whether all entries have been reset
115121 * @return Whether the user entry exists
116122 */
117- static bool find_entry_and_check_all_reset (twdt_entry_t * user_entry , bool * all_reset )
123+ static TASK_WDT_FN_ATTR bool find_entry_and_check_all_reset (twdt_entry_t * user_entry , bool * all_reset )
118124{
119125 bool found_user_entry = false;
120126 bool found_non_reset = false;
@@ -139,7 +145,7 @@ static bool find_entry_and_check_all_reset(twdt_entry_t *user_entry, bool *all_r
139145 * @param[out] all_reset Whether all entries have been reset
140146 * @return Task entry, or NULL if not found
141147 */
142- static twdt_entry_t * find_entry_from_task_handle_and_check_all_reset (TaskHandle_t handle , bool * all_reset )
148+ static TASK_WDT_FN_ATTR twdt_entry_t * find_entry_from_task_handle_and_check_all_reset (TaskHandle_t handle , bool * all_reset )
143149{
144150 twdt_entry_t * target = NULL ;
145151 bool found_non_reset = false;
@@ -448,7 +454,7 @@ static void task_wdt_timeout_handling(int cores_fail, bool panic)
448454 *
449455 * @return Whether the idle tasks should continue idling
450456 */
451- static bool idle_hook_cb (void )
457+ static TASK_WDT_FN_ATTR bool idle_hook_cb (void )
452458{
453459#if CONFIG_FREERTOS_SMP
454460 esp_task_wdt_reset_user (core_user_handles [xPortGetCoreID ()]);
@@ -687,7 +693,7 @@ esp_err_t esp_task_wdt_add_user(const char *user_name, esp_task_wdt_user_handle_
687693 return ret ;
688694}
689695
690- esp_err_t esp_task_wdt_reset (void )
696+ esp_err_t TASK_WDT_FN_ATTR esp_task_wdt_reset (void )
691697{
692698 ESP_RETURN_ON_FALSE (p_twdt_obj != NULL , ESP_ERR_INVALID_STATE , TAG , "TWDT was never initialized" );
693699 esp_err_t ret ;
@@ -711,7 +717,7 @@ esp_err_t esp_task_wdt_reset(void)
711717 return ret ;
712718}
713719
714- esp_err_t esp_task_wdt_reset_user (esp_task_wdt_user_handle_t user_handle )
720+ esp_err_t TASK_WDT_FN_ATTR esp_task_wdt_reset_user (esp_task_wdt_user_handle_t user_handle )
715721{
716722 ESP_RETURN_ON_FALSE (user_handle != NULL , ESP_ERR_INVALID_ARG , TAG , "Invalid arguments" );
717723 ESP_RETURN_ON_FALSE (p_twdt_obj != NULL , ESP_ERR_INVALID_STATE , TAG , "TWDT was never initialized" );
0 commit comments