mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-02 10:00:57 +02:00
Merge branch 'task/refactor_freertos_port_files' into 'master'
refactor(freertos): Refactor FreeRTOS port files Closes IDF-4172 See merge request espressif/esp-idf!41981
This commit is contained in:
@@ -254,11 +254,10 @@ extern void vTaskExitCritical( void );
|
||||
// ------------------- Run Time Stats ----------------------
|
||||
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||
#else
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() 0
|
||||
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#if ( CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS )
|
||||
configRUN_TIME_COUNTER_TYPE xPortGetRunTimeCounterValue( void );
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() xPortGetRunTimeCounterValue()
|
||||
#endif
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
@@ -420,19 +419,13 @@ portmacro.h. Therefore, we need to keep these headers around for now to allow th
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
#include <limits.h>
|
||||
#include "esp_attr.h"
|
||||
#include "esp_newlib.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "esp_system.h" /* required by esp_get_...() functions in portable.h. [refactor-todo] Update portable.h */
|
||||
|
||||
/* [refactor-todo] These includes are not directly used in this file. They are kept into to prevent a breaking change. Remove these. */
|
||||
#include <limits.h>
|
||||
|
||||
/* [refactor-todo] introduce a port wrapper function to avoid including esp_timer.h into the public header */
|
||||
#if CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#include "esp_timer.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -31,6 +31,9 @@
|
||||
#include "port_systick.h"
|
||||
#include "portmacro.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#if CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#include "esp_timer.h"
|
||||
#endif
|
||||
#ifdef CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER
|
||||
#include "soc/periph_defs.h"
|
||||
#include "soc/system_reg.h"
|
||||
@@ -516,3 +519,18 @@ void vApplicationPassiveIdleHook( void )
|
||||
esp_vApplicationIdleHook(); //Run IDF style hooks
|
||||
}
|
||||
#endif // CONFIG_FREERTOS_USE_PASSIVE_IDLE_HOOK
|
||||
|
||||
/* ------------------------------------------------ Run Time Stats ------------------------------------------------- */
|
||||
|
||||
#if ( CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS )
|
||||
|
||||
configRUN_TIME_COUNTER_TYPE xPortGetRunTimeCounterValue( void )
|
||||
{
|
||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
return (configRUN_TIME_COUNTER_TYPE) esp_timer_get_time();
|
||||
#else
|
||||
return 0;
|
||||
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS */
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -239,11 +239,10 @@ extern void vTaskExitCriticalFromISR( UBaseType_t uxSavedInterruptStatus );
|
||||
|
||||
//Timers are already configured, so nothing to do for configuration of run time stats timer
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||
#else // Uses CCOUNT
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) xthal_get_ccount())
|
||||
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#if ( CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS )
|
||||
configRUN_TIME_COUNTER_TYPE xPortGetRunTimeCounterValue( void );
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() xPortGetRunTimeCounterValue()
|
||||
#endif
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
@@ -451,11 +450,6 @@ portmacro.h. Therefore, we need to keep these headers around for now to allow th
|
||||
#include <xtensa/config/system.h>
|
||||
#include <xtensa_api.h>
|
||||
|
||||
/* [refactor-todo] introduce a port wrapper function to avoid including esp_timer.h into the public header */
|
||||
#if CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#include "esp_timer.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -34,6 +34,10 @@
|
||||
#include "esp_freertos_hooks.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include <xtensa/hal.h> /* required for xthal_get_ccount() */
|
||||
#if CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#include "esp_timer.h"
|
||||
#endif
|
||||
#ifdef CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER
|
||||
#include "soc/periph_defs.h"
|
||||
#include "soc/system_reg.h"
|
||||
@@ -695,3 +699,18 @@ void vApplicationPassiveIdleHook( void )
|
||||
esp_vApplicationIdleHook(); //Run IDF style hooks
|
||||
}
|
||||
#endif // CONFIG_FREERTOS_USE_PASSIVE_IDLE_HOOK
|
||||
|
||||
/* ------------------------------------------------ Run Time Stats ------------------------------------------------- */
|
||||
|
||||
#if ( CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS )
|
||||
|
||||
configRUN_TIME_COUNTER_TYPE xPortGetRunTimeCounterValue( void )
|
||||
{
|
||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
return (configRUN_TIME_COUNTER_TYPE) esp_timer_get_time();
|
||||
#else // Uses CCOUNT
|
||||
return (configRUN_TIME_COUNTER_TYPE) xthal_get_ccount();
|
||||
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS */
|
||||
|
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -71,15 +71,8 @@
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_system.h" /* required by esp_get_...() functions in portable.h. [refactor-todo] Update portable.h */
|
||||
#include "esp_newlib.h"
|
||||
|
||||
/* [refactor-todo] These includes are not directly used in this file. They are kept into to prevent a breaking change. Remove these. */
|
||||
#include <limits.h>
|
||||
|
||||
/* [refactor-todo] introduce a port wrapper function to avoid including esp_timer.h into the public header */
|
||||
#if CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#include "esp_timer.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -414,11 +407,11 @@ void vApplicationSleep(TickType_t xExpectedIdleTime);
|
||||
/**
|
||||
* @brief Get the tick rate per second
|
||||
*
|
||||
* @note [refactor-todo] make this inline
|
||||
* @note [refactor-todo] Check if this function should be renamed (due to uint return type)
|
||||
* @deprecated This function will be removed in IDF 7.0. Use CONFIG_FREERTOS_HZ directly instead.
|
||||
* @note [refactor-todo] Remove this function in IDF 7.0 (IDF-14115)
|
||||
* @return uint32_t Tick rate in Hz
|
||||
*/
|
||||
uint32_t xPortGetTickRateHz(void);
|
||||
uint32_t xPortGetTickRateHz(void) __attribute__((deprecated("This function will be removed in IDF 7.0. Use CONFIG_FREERTOS_HZ directly instead.")));
|
||||
|
||||
/**
|
||||
* @brief Set a watchpoint to watch the last 32 bytes of the stack
|
||||
@@ -603,11 +596,10 @@ void vPortTCBPreDeleteHook( void *pxTCB );
|
||||
// ------------------- Run Time Stats ----------------------
|
||||
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||
#else
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() 0
|
||||
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#if ( CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS )
|
||||
configRUN_TIME_COUNTER_TYPE xPortGetRunTimeCounterValue( void );
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() xPortGetRunTimeCounterValue()
|
||||
#endif
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
|
@@ -56,6 +56,9 @@
|
||||
#include "portmacro.h"
|
||||
#include "port_systick.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#if CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#include "esp_timer.h"
|
||||
#endif
|
||||
|
||||
#if SOC_CPU_HAS_HWLOOP
|
||||
#include "riscv/csr.h"
|
||||
@@ -874,6 +877,21 @@ void vPortCoprocUsedInISR(void* frame)
|
||||
|
||||
#endif /* SOC_CPU_COPROC_NUM > 0 */
|
||||
|
||||
/* ------------------------------------------------ Run Time Stats ------------------------------------------------- */
|
||||
|
||||
#if ( CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS )
|
||||
|
||||
configRUN_TIME_COUNTER_TYPE xPortGetRunTimeCounterValue( void )
|
||||
{
|
||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
return (configRUN_TIME_COUNTER_TYPE) esp_timer_get_time();
|
||||
#else
|
||||
return 0;
|
||||
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS */
|
||||
|
||||
/* ---------------------------------------------- Misc Implementations -------------------------------------------------
|
||||
*
|
||||
* ------------------------------------------------------------------------------------------------------------------ */
|
||||
|
@@ -43,7 +43,6 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
#include <xtensa/config/core.h>
|
||||
#include <xtensa/hal.h> /* required for xthal_get_ccount. [refactor-todo] use cpu_hal instead */
|
||||
#include <xtensa/xtruntime.h> /* required for XTOS_SET_INTLEVEL. [refactor-todo] add common intr functions to esp_hw_support */
|
||||
#include "xt_instr_macros.h"
|
||||
#include "spinlock.h"
|
||||
@@ -57,16 +56,7 @@
|
||||
#include "esp_rom_sys.h"
|
||||
#include "esp_system.h" /* required by esp_get_...() functions in portable.h. [refactor-todo] Update portable.h */
|
||||
#include "portbenchmark.h"
|
||||
|
||||
/* [refactor-todo] These includes are not directly used in this file. They are kept into to prevent a breaking change. Remove these. */
|
||||
#include <limits.h>
|
||||
#include <xtensa/config/system.h>
|
||||
#include <xtensa_api.h>
|
||||
|
||||
/* [refactor-todo] introduce a port wrapper function to avoid including esp_timer.h into the public header */
|
||||
#if CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#include "esp_timer.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -355,10 +345,11 @@ void vApplicationSleep(TickType_t xExpectedIdleTime);
|
||||
/**
|
||||
* @brief Get the tick rate per second
|
||||
*
|
||||
* @note [refactor-todo] make this inline
|
||||
* @deprecated This function will be removed in IDF 7.0. Use CONFIG_FREERTOS_HZ directly instead.
|
||||
* @note [refactor-todo] Remove this function in IDF 7.0 (IDF-14115)
|
||||
* @return uint32_t Tick rate in Hz
|
||||
*/
|
||||
uint32_t xPortGetTickRateHz(void);
|
||||
uint32_t xPortGetTickRateHz(void) __attribute__((deprecated("This function will be removed in IDF 7.0. Use CONFIG_FREERTOS_HZ directly instead.")));
|
||||
|
||||
/**
|
||||
* @brief Set a watchpoint to watch the last 32 bytes of the stack
|
||||
@@ -510,11 +501,10 @@ extern void _frxt_setup_switch( void ); //Defined in portasm.S
|
||||
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
|
||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||
#else // Uses CCOUNT
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) xthal_get_ccount())
|
||||
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#if ( CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS )
|
||||
configRUN_TIME_COUNTER_TYPE xPortGetRunTimeCounterValue( void );
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() xPortGetRunTimeCounterValue()
|
||||
#endif
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
|
@@ -48,6 +48,10 @@
|
||||
#include "task.h" /* Required for TaskHandle_t, tskNO_AFFINITY, and vTaskStartScheduler */
|
||||
#include "port_systick.h"
|
||||
#include "esp_cpu.h"
|
||||
#include <xtensa/hal.h> /* required for xthal_get_ccount() */
|
||||
#if CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
#include "esp_timer.h"
|
||||
#endif
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
_Static_assert(portBYTE_ALIGNMENT == 16, "portBYTE_ALIGNMENT must be set to 16");
|
||||
@@ -659,3 +663,18 @@ void vPortTCBPreDeleteHook( void *pxTCB )
|
||||
vPortCleanUpCoprocArea( pxTCB );
|
||||
#endif /* XCHAL_CP_NUM > 0 */
|
||||
}
|
||||
|
||||
/* ------------------------------------------------ Run Time Stats ------------------------------------------------- */
|
||||
|
||||
#if ( CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS )
|
||||
|
||||
configRUN_TIME_COUNTER_TYPE xPortGetRunTimeCounterValue( void )
|
||||
{
|
||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
return (configRUN_TIME_COUNTER_TYPE) esp_timer_get_time();
|
||||
#else // Uses CCOUNT
|
||||
return (configRUN_TIME_COUNTER_TYPE) xthal_get_ccount();
|
||||
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS */
|
||||
|
@@ -299,7 +299,7 @@ menu "FreeRTOS"
|
||||
|
||||
choice FREERTOS_RUN_TIME_COUNTER_TYPE
|
||||
prompt "configRUN_TIME_COUNTER_TYPE"
|
||||
depends on FREERTOS_GENERATE_RUN_TIME_STATS && !FREERTOS_SMP
|
||||
depends on FREERTOS_GENERATE_RUN_TIME_STATS
|
||||
default FREERTOS_RUN_TIME_COUNTER_TYPE_U32
|
||||
help
|
||||
Sets the data type used for the FreeRTOS run time stats. A larger data type can be used to reduce the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -168,13 +168,11 @@
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1 /* Used by vTaskList() */
|
||||
#endif /* CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS */
|
||||
|
||||
#if !CONFIG_FREERTOS_SMP
|
||||
#if CONFIG_FREERTOS_RUN_TIME_COUNTER_TYPE_U32
|
||||
#define configRUN_TIME_COUNTER_TYPE uint32_t
|
||||
#elif CONFIG_FREERTOS_RUN_TIME_COUNTER_TYPE_U64
|
||||
#define configRUN_TIME_COUNTER_TYPE uint64_t
|
||||
#endif /* CONFIG_FREERTOS_RUN_TIME_COUNTER_TYPE_U64 */
|
||||
#endif /* !CONFIG_FREERTOS_SMP */
|
||||
#if CONFIG_FREERTOS_RUN_TIME_COUNTER_TYPE_U32
|
||||
#define configRUN_TIME_COUNTER_TYPE uint32_t
|
||||
#elif CONFIG_FREERTOS_RUN_TIME_COUNTER_TYPE_U64
|
||||
#define configRUN_TIME_COUNTER_TYPE uint64_t
|
||||
#endif /* CONFIG_FREERTOS_RUN_TIME_COUNTER_TYPE_U64 */
|
||||
|
||||
/* -------------------- Co-routines ----------------------- */
|
||||
|
||||
|
Reference in New Issue
Block a user