mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-25 01:37:22 +00:00
feat(freertos/smp): Update ports to support Amazon FreeRTOS v11.0.1
- vTaskPreemptionDisable()/vTaskPreemptionEnable() are no longer available in single-core builds. - xTaskIncrementTick() calls must now be wrapped by critical section - Minimal Idle Task renamed to Passive Idle Task - Port critical section APIs updated
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -10,15 +10,28 @@
|
||||
|
||||
/* Macros used instead ofsetoff() for better performance of interrupt handler */
|
||||
#if CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES
|
||||
/*
|
||||
pxTopOfStack (4) +
|
||||
xStateListItem (28) +
|
||||
xEventListItem (28) +
|
||||
uxPriority (4)
|
||||
*/
|
||||
#define PORT_OFFSET_PX_STACK 0x40
|
||||
#else
|
||||
/*
|
||||
pxTopOfStack (4) +
|
||||
xStateListItem (20) +
|
||||
xEventListItem (20) +
|
||||
uxPriority (4)
|
||||
*/
|
||||
#define PORT_OFFSET_PX_STACK 0x30
|
||||
#endif /* #if CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES */
|
||||
#define PORT_OFFSET_PX_END_OF_STACK (PORT_OFFSET_PX_STACK + \
|
||||
/* void * pxDummy6 */ 4 + \
|
||||
/* BaseType_t xDummy23[ 2 ] */ 8 + \
|
||||
/* uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ] */ CONFIG_FREERTOS_MAX_TASK_NAME_LEN + \
|
||||
/* BaseType_t xDummy24 */ 4)
|
||||
|
||||
#define PORT_OFFSET_PX_END_OF_STACK ( \
|
||||
PORT_OFFSET_PX_STACK \
|
||||
+ 4 /* StackType_t * pxStack */ \
|
||||
+ CONFIG_FREERTOS_MAX_TASK_NAME_LEN /* pcTaskName[ configMAX_TASK_NAME_LEN ] */ \
|
||||
)
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
@@ -102,15 +115,16 @@ BaseType_t xPortCheckIfInISR(void);
|
||||
|
||||
// ------------------ Critical Sections --------------------
|
||||
|
||||
#if ( configNUMBER_OF_CORES > 1 )
|
||||
/*
|
||||
These are always called with interrupts already disabled. We simply need to get/release the spinlocks
|
||||
*/
|
||||
|
||||
extern portMUX_TYPE port_xTaskLock;
|
||||
extern portMUX_TYPE port_xISRLock;
|
||||
|
||||
void vPortTakeLock( portMUX_TYPE *lock );
|
||||
void vPortReleaseLock( portMUX_TYPE *lock );
|
||||
#endif /* configNUMBER_OF_CORES > 1 */
|
||||
|
||||
// ---------------------- Yielding -------------------------
|
||||
|
||||
@@ -175,11 +189,12 @@ void vPortTCBPreDeleteHook( void *pxTCB );
|
||||
|
||||
// ------------------ Critical Sections --------------------
|
||||
|
||||
#if ( configNUMBER_OF_CORES > 1 )
|
||||
#define portGET_TASK_LOCK() vPortTakeLock(&port_xTaskLock)
|
||||
#define portRELEASE_TASK_LOCK() vPortReleaseLock(&port_xTaskLock)
|
||||
#define portGET_ISR_LOCK() vPortTakeLock(&port_xISRLock)
|
||||
#define portRELEASE_ISR_LOCK() vPortReleaseLock(&port_xISRLock)
|
||||
|
||||
#endif /* configNUMBER_OF_CORES > 1 */
|
||||
|
||||
//Critical sections used by FreeRTOS SMP
|
||||
extern void vTaskEnterCritical( void );
|
||||
@@ -314,8 +329,8 @@ static inline bool IRAM_ATTR xPortCanYield(void)
|
||||
return (threshold <= 1);
|
||||
}
|
||||
|
||||
// Added for backward compatibility with IDF
|
||||
#define portYIELD_WITHIN_API() vTaskYieldWithinAPI()
|
||||
// Defined even for configNUMBER_OF_CORES > 1 for IDF compatibility
|
||||
#define portYIELD_WITHIN_API() esp_crosscore_int_send_yield(xPortGetCoreID())
|
||||
|
||||
// ----------------------- System --------------------------
|
||||
|
||||
|
@@ -170,6 +170,7 @@ BaseType_t xPortCheckIfInISR(void)
|
||||
|
||||
// ------------------ Critical Sections --------------------
|
||||
|
||||
#if ( configNUMBER_OF_CORES > 1 )
|
||||
void IRAM_ATTR vPortTakeLock( portMUX_TYPE *lock )
|
||||
{
|
||||
spinlock_acquire( lock, portMUX_NO_TIMEOUT);
|
||||
@@ -179,6 +180,7 @@ void IRAM_ATTR vPortReleaseLock( portMUX_TYPE *lock )
|
||||
{
|
||||
spinlock_release( lock );
|
||||
}
|
||||
#endif /* configNUMBER_OF_CORES > 1 */
|
||||
|
||||
// ---------------------- Yielding -------------------------
|
||||
|
||||
@@ -486,21 +488,21 @@ void vApplicationTickHook( void )
|
||||
#endif
|
||||
|
||||
extern void esp_vApplicationIdleHook(void);
|
||||
#if CONFIG_FREERTOS_USE_MINIMAL_IDLE_HOOK
|
||||
#if CONFIG_FREERTOS_USE_PASSIVE_IDLE_HOOK
|
||||
/*
|
||||
By default, the port uses vApplicationMinimalIdleHook() to run IDF style idle
|
||||
hooks. However, users may also want to provide their own vApplicationMinimalIdleHook().
|
||||
In this case, we use to -Wl,--wrap option to wrap the user provided vApplicationMinimalIdleHook()
|
||||
By default, the port uses vApplicationPassiveIdleHook() to run IDF style idle
|
||||
hooks. However, users may also want to provide their own vApplicationPassiveIdleHook().
|
||||
In this case, we use to -Wl,--wrap option to wrap the user provided vApplicationPassiveIdleHook()
|
||||
*/
|
||||
extern void __real_vApplicationMinimalIdleHook( void );
|
||||
void __wrap_vApplicationMinimalIdleHook( void )
|
||||
extern void __real_vApplicationPassiveIdleHook( void );
|
||||
void __wrap_vApplicationPassiveIdleHook( void )
|
||||
{
|
||||
esp_vApplicationIdleHook(); //Run IDF style hooks
|
||||
__real_vApplicationMinimalIdleHook(); //Call the user provided vApplicationMinimalIdleHook()
|
||||
__real_vApplicationPassiveIdleHook(); //Call the user provided vApplicationPassiveIdleHook()
|
||||
}
|
||||
#else // CONFIG_FREERTOS_USE_MINIMAL_IDLE_HOOK
|
||||
void vApplicationMinimalIdleHook( void )
|
||||
#else // CONFIG_FREERTOS_USE_PASSIVE_IDLE_HOOK
|
||||
void vApplicationPassiveIdleHook( void )
|
||||
{
|
||||
esp_vApplicationIdleHook(); //Run IDF style hooks
|
||||
}
|
||||
#endif // CONFIG_FREERTOS_USE_MINIMAL_IDLE_HOOK
|
||||
#endif // CONFIG_FREERTOS_USE_PASSIVE_IDLE_HOOK
|
||||
|
@@ -7,6 +7,10 @@
|
||||
#include "portmacro.h"
|
||||
#if CONFIG_ESP_SYSTEM_HW_STACK_GUARD
|
||||
#include "esp_private/hw_stack_guard.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_FREERTOS_UNICORE
|
||||
#define pxCurrentTCBs pxCurrentTCB
|
||||
#endif
|
||||
|
||||
.global uxInterruptNesting
|
||||
|
Reference in New Issue
Block a user