change(freertos/idf): Make v10.5.1 the default kernel

This commit makes v10.5.1 the default FreeRTOS kernel in ESP-IDF by removing
the CONFIG_FREERTOS_USE_KERNEL_10_5_1 option and v10.4.3 specific code
blocks.
This commit is contained in:
Darian Leung 2023-09-26 17:47:16 +08:00
parent 2025a77dd6
commit 16ccb31d33
14 changed files with 126 additions and 260 deletions

View File

@ -590,4 +590,3 @@ mainmenu "Espressif IoT Development Framework Configuration"
- CONFIG_ESPTOOLPY_FLASHFREQ_120M
- CONFIG_SPIRAM_SPEED_120M
- CONFIG_SPI_FLASH_QUAD_32BIT_ADDR_ENABLE
- CONFIG_FREERTOS_USE_KERNEL_10_5_1

View File

@ -31,11 +31,7 @@ idf_build_get_property(target IDF_TARGET)
if(CONFIG_FREERTOS_SMP)
set(kernel_impl "FreeRTOS-Kernel-SMP")
else()
if(CONFIG_FREERTOS_USE_KERNEL_10_5_1)
set(kernel_impl "FreeRTOS-Kernel-V10.5.1")
else()
set(kernel_impl "FreeRTOS-Kernel")
endif()
set(kernel_impl "FreeRTOS-Kernel")
endif()
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
@ -73,52 +69,27 @@ list(APPEND srcs
"${kernel_impl}/timers.c"
"${kernel_impl}/event_groups.c"
"${kernel_impl}/stream_buffer.c")
if(NOT CONFIG_FREERTOS_USE_KERNEL_10_5_1)
list(APPEND srcs "${kernel_impl}/croutine.c")
endif()
# Add port source files
if(CONFIG_FREERTOS_USE_KERNEL_10_5_1)
list(APPEND srcs
"FreeRTOS-Kernel/portable/${arch}/port.c")
else()
list(APPEND srcs
"${kernel_impl}/portable/${arch}/port.c")
endif()
list(APPEND srcs
"${kernel_impl}/portable/${arch}/port.c")
if(arch STREQUAL "linux")
if(CONFIG_FREERTOS_USE_KERNEL_10_5_1)
list(APPEND srcs
"${kernel_impl}/portable/${arch}/utils/wait_for_event.c")
if(kernel_impl STREQUAL "FreeRTOS-Kernel")
list(APPEND srcs
"FreeRTOS-Kernel/portable/${arch}/utils/wait_for_event.c"
"FreeRTOS-Kernel/portable/${arch}/port_idf.c")
else()
list(APPEND srcs
"${kernel_impl}/portable/${arch}/utils/wait_for_event.c")
if(kernel_impl STREQUAL "FreeRTOS-Kernel")
list(APPEND srcs
"${kernel_impl}/portable/${arch}/port_idf.c")
endif()
"${kernel_impl}/portable/${arch}/port_idf.c")
endif()
else()
if(CONFIG_FREERTOS_USE_KERNEL_10_5_1)
list(APPEND srcs
"FreeRTOS-Kernel/portable/${arch}/portasm.S")
else()
list(APPEND srcs
"${kernel_impl}/portable/${arch}/portasm.S")
endif()
list(APPEND srcs
"${kernel_impl}/portable/${arch}/portasm.S")
endif()
if(arch STREQUAL "xtensa")
if(CONFIG_FREERTOS_USE_KERNEL_10_5_1)
list(APPEND srcs
"FreeRTOS-Kernel/portable/${arch}/xtensa_init.c"
"FreeRTOS-Kernel/portable/${arch}/xtensa_overlay_os_hook.c")
else()
list(APPEND srcs
"${kernel_impl}/portable/${arch}/xtensa_init.c"
"${kernel_impl}/portable/${arch}/xtensa_overlay_os_hook.c")
endif()
list(APPEND srcs
"${kernel_impl}/portable/${arch}/xtensa_init.c"
"${kernel_impl}/portable/${arch}/xtensa_overlay_os_hook.c")
endif()
# Add ESP-additions source files
@ -151,15 +122,9 @@ list(APPEND include_dirs
"${kernel_impl}/include") # FreeRTOS headers via `#include "freertos/xxx.h"`
# Add port public include directories
if(CONFIG_FREERTOS_USE_KERNEL_10_5_1)
list(APPEND include_dirs
"FreeRTOS-Kernel/portable/${arch}/include" # For port headers via `#include "freertos/...h"`
"FreeRTOS-Kernel/portable/${arch}/include/freertos") # For port headers via `#include "...h"`
else()
list(APPEND include_dirs
"${kernel_impl}/portable/${arch}/include" # For port headers via `#include "freertos/...h"`
"${kernel_impl}/portable/${arch}/include/freertos") # For port headers via `#include "...h"`
endif()
list(APPEND include_dirs
"${kernel_impl}/portable/${arch}/include" # For port headers via `#include "freertos/...h"`
"${kernel_impl}/portable/${arch}/include/freertos") # For port headers via `#include "...h"`
# Add ESP-additions public include directories
list(APPEND include_dirs
@ -181,13 +146,8 @@ list(APPEND private_include_dirs
# Add port private include directories
if(arch STREQUAL "linux")
if(CONFIG_FREERTOS_USE_KERNEL_10_5_1)
list(APPEND private_include_dirs
"FreeRTOS-Kernel/portable/${arch}/") # Linux port `#include "utils/wait_for_event.h"`
else()
list(APPEND private_include_dirs
"${kernel_impl}/portable/${arch}/") # Linux port `#include "utils/wait_for_event.h"`
endif()
list(APPEND private_include_dirs
"${kernel_impl}/portable/${arch}/") # Linux port `#include "utils/wait_for_event.h"`
endif()
# Add ESP-additions private include directories

View File

@ -444,10 +444,13 @@ void vPortTCBPreDeleteHook( void *pxTCB );
* - Maps to forward declared functions
* ------------------------------------------------------------------------------------------------------------------ */
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
#define portGET_CORE_ID() xPortGetCoreID()
#define portYIELD_CORE( x ) vPortYieldOtherCore( x )
#endif
// ----------------------- System --------------------------
#if ( configNUMBER_OF_CORES > 1 )
#define portGET_CORE_ID() xPortGetCoreID()
#else /* configNUMBER_OF_CORES > 1 */
#define portGET_CORE_ID() ((BaseType_t) 0);
#endif /* configNUMBER_OF_CORES > 1 */
// --------------------- Interrupts ------------------------
@ -560,6 +563,10 @@ void vPortTCBPreDeleteHook( void *pxTCB );
*/
#define portYIELD_WITHIN_API() portYIELD()
#if ( configNUMBER_OF_CORES > 1 )
#define portYIELD_CORE( xCoreID ) vPortYieldOtherCore( xCoreID )
#endif /* configNUMBER_OF_CORES > 1 */
// ------------------- Hook Functions ----------------------
#define portSUPPRESS_TICKS_AND_SLEEP(idleTime) vApplicationSleep(idleTime)

View File

@ -8,12 +8,7 @@
#include "freertos/FreeRTOSConfig.h"
#include "soc/soc_caps.h"
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
#define pxCurrentTCB pxCurrentTCBs
.extern pxCurrentTCBs
#else
.extern pxCurrentTCB
#endif
#if CONFIG_ESP_SYSTEM_HW_STACK_GUARD
#include "esp_private/hw_stack_guard.h"
@ -22,7 +17,7 @@
.global port_uxInterruptNesting
.global port_xSchedulerRunning
.global xIsrStackTop
.global pxCurrentTCB
.global pxCurrentTCBs
.global vTaskSwitchContext
.global xPortSwitchFlag
#if CONFIG_ESP_SYSTEM_HW_STACK_GUARD
@ -38,7 +33,7 @@
/**
* This function makes the RTOS aware about an ISR entering. It takes the
* current task stack pointer and places it into the pxCurrentTCB.
* current task stack pointer and places it into the pxCurrentTCBs.
* It then loads the ISR stack into sp.
* TODO: ISR nesting code improvements ?
* In the routines below, let's use a0-a5 registers to let the compiler generate
@ -75,18 +70,18 @@ rtos_int_enter:
ESP_HW_STACK_GUARD_MONITOR_STOP_CUR_CORE a0 a1
#endif /* CONFIG_ESP_SYSTEM_HW_STACK_GUARD */
/* Save the current sp in pxCurrentTCB[coreID] and load the ISR stack on to sp */
/* Save the current sp in pxCurrentTCBs[coreID] and load the ISR stack on to sp */
#if ( configNUM_CORES > 1 )
la a0, pxCurrentTCB /* a0 = &pxCurrentTCB */
add a0, a0, a5 /* a0 = &pxCurrentTCB[coreID] // a5 already contains coreID * 4 */
lw a0, (a0) /* a0 = pxCurrentTCB[coreID] */
sw sp, 0(a0) /* pxCurrentTCB[coreID] = sp */
la a0, pxCurrentTCBs /* a0 = &pxCurrentTCBs */
add a0, a0, a5 /* a0 = &pxCurrentTCBs[coreID] // a5 already contains coreID * 4 */
lw a0, (a0) /* a0 = pxCurrentTCBs[coreID] */
sw sp, 0(a0) /* pxCurrentTCBs[coreID] = sp */
la a0, xIsrStackTop /* a0 = &xIsrStackTop */
add a0, a0, a5 /* a0 = &xIsrStackTop[coreID] // a5 already contains coreID * 4 */
lw sp, (a0) /* sp = xIsrStackTop[coreID] */
#else
lw a0, pxCurrentTCB /* a0 = pxCurrentTCB */
sw sp, 0(a0) /* pxCurrentTCB[0] = sp */
lw a0, pxCurrentTCBs /* a0 = pxCurrentTCBs */
sw sp, 0(a0) /* pxCurrentTCBs[0] = sp */
lw sp, xIsrStackTop /* sp = xIsrStackTop */
#endif /* ( configNUM_CORES > 1 ) */
@ -180,20 +175,20 @@ no_switch:
/* Recover the stack of next task and prepare to exit */
csrr a1, mhartid
slli a1, a1, 2
la a0, pxCurrentTCB /* a0 = &pxCurrentTCB */
add a0, a0, a1 /* a0 = &pxCurrentTCB[coreID] */
lw a0, 0(a0) /* a0 = pxCurrentTCB[coreID] */
la a0, pxCurrentTCBs /* a0 = &pxCurrentTCBs */
add a0, a0, a1 /* a0 = &pxCurrentTCBs[coreID] */
lw a0, 0(a0) /* a0 = pxCurrentTCBs[coreID] */
lw sp, 0(a0) /* sp = previous sp */
#else
/* Recover the stack of next task */
lw a0, pxCurrentTCB
lw a0, pxCurrentTCBs
lw sp, 0(a0)
#endif /* ( configNUM_CORES > 1 ) */
#if CONFIG_ESP_SYSTEM_HW_STACK_GUARD
/* esp_hw_stack_guard_set_bounds(pxCurrentTCB[0]->pxStack,
* pxCurrentTCB[0]->pxEndOfStack);
/* esp_hw_stack_guard_set_bounds(pxCurrentTCBs[0]->pxStack,
* pxCurrentTCBs[0]->pxEndOfStack);
*/
lw a1, PORT_OFFSET_PX_END_OF_STACK(a0)
lw a0, PORT_OFFSET_PX_STACK(a0)

View File

@ -427,10 +427,13 @@ void vPortTCBPreDeleteHook( void *pxTCB );
* - Maps to forward declared functions
* ------------------------------------------------------------------------------------------------------------------ */
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
#define portGET_CORE_ID() xPortGetCoreID()
#define portYIELD_CORE( x ) vPortYieldOtherCore( x )
#endif
// ----------------------- System --------------------------
#if ( configNUMBER_OF_CORES > 1 )
#define portGET_CORE_ID() xPortGetCoreID()
#else /* configNUMBER_OF_CORES > 1 */
#define portGET_CORE_ID() ((BaseType_t) 0);
#endif /* configNUMBER_OF_CORES > 1 */
// --------------------- Interrupts ------------------------
@ -523,6 +526,10 @@ extern void _frxt_setup_switch( void ); //Defined in portasm.S
*/
#define portYIELD_WITHIN_API() esp_crosscore_int_send_yield(xPortGetCoreID())
#if ( configNUMBER_OF_CORES > 1 )
#define portYIELD_CORE( xCoreID ) vPortYieldOtherCore( xCoreID )
#endif /* configNUMBER_OF_CORES > 1 */
// ------------------- Hook Functions ----------------------
#define portSUPPRESS_TICKS_AND_SLEEP(idleTime) vApplicationSleep(idleTime)

View File

@ -33,12 +33,7 @@
#define TOPOFSTACK_OFFS 0x00 /* StackType_t *pxTopOfStack */
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
#define pxCurrentTCB pxCurrentTCBs
.extern pxCurrentTCBs
#else
.extern pxCurrentTCB
#endif
#if XCHAL_CP_NUM > 0
/* Offsets used to get a task's coprocessor save area (CPSA) from its TCB */
@ -154,11 +149,11 @@ _frxt_int_enter:
s32i a2, a3, 0 /* save nesting count */
bnei a2, 1, .Lnested /* !=0 before incr, so nested */
movi a2, pxCurrentTCB
movi a2, pxCurrentTCBs
addx4 a2, a4, a2
l32i a2, a2, 0 /* a2 = current TCB */
beqz a2, 1f
s32i a1, a2, TOPOFSTACK_OFFS /* pxCurrentTCB->pxTopOfStack = SP */
s32i a1, a2, TOPOFSTACK_OFFS /* pxCurrentTCBs->pxTopOfStack = SP */
movi a1, port_IntStack+configISR_STACK_SIZE /* a1 = top of intr stack for CPU 0 */
movi a2, configISR_STACK_SIZE /* add configISR_STACK_SIZE * cpu_num to arrive at top of stack for cpu_num */
mull a2, a4, a2
@ -221,11 +216,11 @@ _frxt_int_exit:
rsync /* ensure CPENABLE was modified */
#endif
movi a2, pxCurrentTCB
movi a2, pxCurrentTCBs
addx4 a2, a4, a2
l32i a2, a2, 0 /* a2 = current TCB */
beqz a2, 1f /* no task ? go to dispatcher */
l32i a1, a2, TOPOFSTACK_OFFS /* SP = pxCurrentTCB->pxTopOfStack */
l32i a1, a2, TOPOFSTACK_OFFS /* SP = pxCurrentTCBs->pxTopOfStack */
movi a2, port_switch_flag /* address of switch flag */
addx4 a2, a4, a2 /* point to flag for this cpu */
@ -433,7 +428,7 @@ _frxt_tick_timer_init:
* If restoring a task that was preempted, restores all state including the task's CPENABLE.
*
* Entry:
* pxCurrentTCB points to the TCB of the task to suspend,
* pxCurrentTCBs points to the TCB of the task to suspend,
* Because it is tail-called without a true function entrypoint, it needs no 'entry' instruction.
*
* Exit:
@ -449,12 +444,12 @@ _frxt_dispatch:
#ifdef __XTENSA_CALL0_ABI__
call0 vTaskSwitchContext // Get next TCB to resume
movi a2, pxCurrentTCB
movi a2, pxCurrentTCBs
getcoreid a3
addx4 a2, a3, a2
#else
call4 vTaskSwitchContext // Get next TCB to resume
movi a2, pxCurrentTCB
movi a2, pxCurrentTCBs
getcoreid a3
addx4 a2, a3, a2
#endif
@ -498,7 +493,7 @@ _frxt_dispatch:
#if XCHAL_CP_NUM > 0
/* Restore CPENABLE from task's co-processor save area. */
movi a2, pxCurrentTCB /* cp_state = */
movi a2, pxCurrentTCBs /* cp_state = */
getcoreid a3
addx4 a2, a3, a2
l32i a2, a2, 0
@ -539,7 +534,7 @@ _frxt_dispatch:
* then tail-calls the dispatcher _frxt_dispatch() to perform the actual context switch
*
* At Entry:
* pxCurrentTCB points to the TCB of the task to suspend
* pxCurrentTCBs points to the TCB of the task to suspend
* Callable from C (obeys ABI conventions on entry).
*
* Does not return to caller.
@ -591,13 +586,13 @@ vPortYield:
call0 _xt_coproc_savecs
#endif
movi a2, pxCurrentTCB
movi a2, pxCurrentTCBs
getcoreid a3
addx4 a2, a3, a2
l32i a2, a2, 0 /* a2 = pxCurrentTCB */
l32i a2, a2, 0 /* a2 = pxCurrentTCBs */
movi a3, 0
s32i a3, sp, XT_SOL_EXIT /* 0 to flag as solicited frame */
s32i sp, a2, TOPOFSTACK_OFFS /* pxCurrentTCB->pxTopOfStack = SP */
s32i sp, a2, TOPOFSTACK_OFFS /* pxCurrentTCBs->pxTopOfStack = SP */
#if XCHAL_CP_NUM > 0
/* Clear CPENABLE, also in task's co-processor state save area. */
@ -623,8 +618,8 @@ vPortYield:
* _frxt_dispatch() to perform the actual context switch.
*
* At Entry:
* Interrupted task context has been saved in an interrupt stack frame at pxCurrentTCB->pxTopOfStack.
* pxCurrentTCB points to the TCB of the task to suspend,
* Interrupted task context has been saved in an interrupt stack frame at pxCurrentTCBs->pxTopOfStack.
* pxCurrentTCBs points to the TCB of the task to suspend,
* Callable from C (obeys ABI conventions on entry).
*
* At Exit:
@ -642,7 +637,7 @@ vPortYieldFromInt:
#if XCHAL_CP_NUM > 0
/* Save CPENABLE in task's co-processor save area, and clear CPENABLE. */
movi a2, pxCurrentTCB /* cp_state = */
movi a2, pxCurrentTCBs /* cp_state = */
getcoreid a3
addx4 a2, a3, a2
l32i a2, a2, 0
@ -696,9 +691,9 @@ _frxt_task_coproc_state:
l32i a15, a15, 0
bnez a15, 1f
movi a15, pxCurrentTCB
movi a15, pxCurrentTCBs
addx4 a15, a3, a15
l32i a15, a15, 0 /* && pxCurrentTCB != 0) { */
l32i a15, a15, 0 /* && pxCurrentTCBs != 0) { */
beqz a15, 2f
get_cpsa_from_tcb a15, a3 /* After this, pointer to CP save area is in a15, a3 is destroyed */
@ -743,9 +738,9 @@ _frxt_coproc_exc_hook:
bnez a3, 1f /* We are in an interrupt. Return*/
/* CP operations are incompatible with unpinned tasks. Thus we pin the task
to the current running core. */
movi a3, pxCurrentTCB
movi a3, pxCurrentTCBs
addx4 a3, a2, a3
l32i a3, a3, 0 /* a3 = pxCurrentTCB[xCurCoreID] */
l32i a3, a3, 0 /* a3 = pxCurrentTCBs[xCurCoreID] */
movi a4, offset_xCoreID
l32i a4, a4, 0 /* a4 = offset_xCoreID */
add a3, a3, a4 /* a3 = &TCB.xCoreID */

View File

@ -3,17 +3,9 @@ menu "FreeRTOS"
menu "Kernel"
# Upstream FreeRTOS configurations go here
config FREERTOS_USE_KERNEL_10_5_1
bool "Use v10.5.1 Kernel (BETA)"
default n
help
This option enables building for FreeRTOS v10.5.1 kernel.
Note: The v10.5.1 kernel is still in BETA, thus is not production ready.
config FREERTOS_SMP
bool "Run the Amazon SMP FreeRTOS kernel instead (FEATURE UNDER DEVELOPMENT)"
depends on !FREERTOS_USE_KERNEL_10_5_1 && !IDF_TARGET_ESP32P4 #TODO: IDF-8113: Enable P4 support on AMZ SMP
depends on !IDF_TARGET_ESP32P4 #TODO: IDF-8113: Enable P4 support on AMZ SMP
default "n"
help
Amazon has released an SMP version of the FreeRTOS Kernel which can be found via the following link:

View File

@ -248,6 +248,8 @@
#else
#define configNUM_CORES 2
#endif /* CONFIG_FREERTOS_UNICORE */
/* For compatibility */
#define configNUMBER_OF_CORES configNUM_CORES
#define configRUN_MULTIPLE_PRIORITIES 1
#define configUSE_TASK_PREEMPTION_DISABLE 1
#endif /* CONFIG_FREERTOS_SMP */

View File

@ -42,17 +42,14 @@
/* ----------------------- System -------------------------- */
#define configUSE_NEWLIB_REENTRANT 1
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
/* - FreeRTOS provides default for configTLS_BLOCK_TYPE.
* - We simply provide our own INIT and DEINIT functions
* - We set "SET" to a blank macro since there is no need to set the reentrancy
* pointer. All newlib functions calls __getreent. */
#define configINIT_TLS_BLOCK( xTLSBlock ) esp_reent_init( &( xTLSBlock ) )
#define configSET_TLS_BLOCK( xTLSBlock )
#define configDEINIT_TLS_BLOCK( xTLSBlock ) _reclaim_reent( &( xTLSBlock ) )
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
#define configINIT_TLS_BLOCK( xTLSBlock ) esp_reent_init( &( xTLSBlock ) )
#define configSET_TLS_BLOCK( xTLSBlock )
#define configDEINIT_TLS_BLOCK( xTLSBlock ) _reclaim_reent( &( xTLSBlock ) )
#define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 1

View File

@ -69,17 +69,14 @@
/* ----------------------- System -------------------------- */
#define configUSE_NEWLIB_REENTRANT 1
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
/* - FreeRTOS provides default for configTLS_BLOCK_TYPE.
* - We simply provide our own INIT and DEINIT functions
* - We set "SET" to a blank macro since there is no need to set the reentrancy
* pointer. All newlib functions calls __getreent. */
#define configINIT_TLS_BLOCK( xTLSBlock ) esp_reent_init( &( xTLSBlock ) )
#define configSET_TLS_BLOCK( xTLSBlock )
#define configDEINIT_TLS_BLOCK( xTLSBlock ) _reclaim_reent( &( xTLSBlock ) )
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
#define configINIT_TLS_BLOCK( xTLSBlock ) esp_reent_init( &( xTLSBlock ) )
#define configSET_TLS_BLOCK( xTLSBlock )
#define configDEINIT_TLS_BLOCK( xTLSBlock ) _reclaim_reent( &( xTLSBlock ) )
#define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 1

View File

@ -20,11 +20,6 @@
* additional API.
*/
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
#define pxCurrentTCB pxCurrentTCBs
#else
#endif
/* ------------------------------------------------- Static Asserts ------------------------------------------------- */
/*
@ -87,7 +82,7 @@ _Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfSt
{
/* Minor optimization. This function can never switch cores mid
* execution */
BaseType_t xCoreID = xPortGetCoreID();
BaseType_t xCoreID = portGET_CORE_ID();
BaseType_t xSwitchRequired = pdFALSE;
/* This function should never be called by Core 0. */
@ -110,7 +105,7 @@ _Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfSt
{
/* Check if core 0 calling xTaskIncrementTick() has
* unblocked a task that can be run. */
if( uxTopReadyPriority > pxCurrentTCB[ xCoreID ]->uxPriority )
if( uxTopReadyPriority > pxCurrentTCBs[ xCoreID ]->uxPriority )
{
xSwitchRequired = pdTRUE;
}
@ -126,7 +121,7 @@ _Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfSt
* writer has not explicitly turned time slicing off. */
#if ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) )
{
if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB[ xCoreID ]->uxPriority ] ) ) > ( UBaseType_t ) 1 )
if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCBs[ xCoreID ]->uxPriority ] ) ) > ( UBaseType_t ) 1 )
{
xSwitchRequired = pdTRUE;
}
@ -227,23 +222,12 @@ _Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfSt
if( pxNewTCB != NULL )
{
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
{
memset( ( void * ) pxNewTCB, 0x00, sizeof( TCB_t ) );
memset( ( void * ) pxNewTCB, 0x00, sizeof( TCB_t ) );
/* Allocate space for the stack used by the task being created.
* The base of the stack memory stored in the TCB so the task can
* be deleted later if required. */
pxNewTCB->pxStack = ( StackType_t * ) pvPortMallocStack( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
}
#else /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
{
/* Allocate space for the stack used by the task being created.
* The base of the stack memory stored in the TCB so the task can
* be deleted later if required. */
pxNewTCB->pxStack = ( StackType_t * ) pvPortMalloc( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
}
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
/* Allocate space for the stack used by the task being created.
* The base of the stack memory stored in the TCB so the task can
* be deleted later if required. */
pxNewTCB->pxStack = ( StackType_t * ) pvPortMallocStack( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
if( pxNewTCB->pxStack == NULL )
{
@ -257,17 +241,8 @@ _Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfSt
{
StackType_t * pxStack;
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
{
/* Allocate space for the stack used by the task being created. */
pxStack = pvPortMallocStack( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ) ); /*lint !e9079 All values returned by pvPortMalloc() have at least the alignment required by the MCU's stack and this allocation is the stack. */
}
#else /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
{
/* Allocate space for the stack used by the task being created. */
pxStack = pvPortMalloc( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ) ); /*lint !e9079 All values returned by pvPortMalloc() have at least the alignment required by the MCU's stack and this allocation is the stack. */
}
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
/* Allocate space for the stack used by the task being created. */
pxStack = pvPortMallocStack( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ) ); /*lint !e9079 All values returned by pvPortMalloc() have at least the alignment required by the MCU's stack and this allocation is the stack. */
if( pxStack != NULL )
{
@ -276,11 +251,7 @@ _Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfSt
if( pxNewTCB != NULL )
{
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
{
memset( ( void * ) pxNewTCB, 0x00, sizeof( TCB_t ) );
}
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
memset( ( void * ) pxNewTCB, 0x00, sizeof( TCB_t ) );
/* Store the stack location in the TCB. */
pxNewTCB->pxStack = pxStack;
@ -289,15 +260,7 @@ _Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfSt
{
/* The stack cannot be used as the TCB was not created. Free
* it again. */
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
{
vPortFreeStack( pxStack );
}
#else /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
{
vPortFree( pxStack );
}
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
vPortFreeStack( pxStack );
}
}
else
@ -397,13 +360,7 @@ _Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfSt
/* The memory used for the task's TCB and stack are passed into this
* function - use them. */
pxNewTCB = ( TCB_t * ) pxTaskBuffer; /*lint !e740 !e9087 Unusual cast is ok as the structures are designed to have the same alignment, and the size is checked by an assert. */
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
{
memset( ( void * ) pxNewTCB, 0x00, sizeof( TCB_t ) );
}
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
memset( ( void * ) pxNewTCB, 0x00, sizeof( TCB_t ) );
pxNewTCB->pxStack = ( StackType_t * ) puxStackBuffer;
#if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 ) /*lint !e731 !e9029 Macro has been consolidated for readability reasons. */
@ -500,21 +457,11 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
TaskHandle_t xTaskGetIdleTaskHandleForCore( BaseType_t xCoreID )
{
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
{
/* If xTaskGetIdleTaskHandle() is called before the scheduler has been
* started, then xIdleTaskHandle will be NULL. */
configASSERT( ( xCoreID < configNUMBER_OF_CORES ) && ( xCoreID != tskNO_AFFINITY ) );
configASSERT( ( xIdleTaskHandle[ xCoreID ] != NULL ) );
return xIdleTaskHandle[ xCoreID ];
}
#else /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
{
configASSERT( xCoreID >= 0 && xCoreID < configNUM_CORES );
configASSERT( ( xIdleTaskHandle[ xCoreID ] != NULL ) );
return ( TaskHandle_t ) xIdleTaskHandle[ xCoreID ];
}
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
/* If xTaskGetIdleTaskHandle() is called before the scheduler has been
* started, then xIdleTaskHandle will be NULL. */
configASSERT( ( xCoreID < configNUMBER_OF_CORES ) && ( xCoreID != tskNO_AFFINITY ) );
configASSERT( ( xIdleTaskHandle[ xCoreID ] != NULL ) );
return xIdleTaskHandle[ xCoreID ];
}
#endif /* INCLUDE_xTaskGetIdleTaskHandle */
@ -526,7 +473,11 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
{
TaskHandle_t xReturn;
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
#if ( CONFIG_FREERTOS_SMP )
{
xReturn = xTaskGetCurrentTaskHandleCPU( ( UBaseType_t ) xCoreID );
}
#else /* CONFIG_FREERTOS_SMP */
{
configASSERT( xCoreID < configNUMBER_OF_CORES );
configASSERT( xCoreID != tskNO_AFFINITY );
@ -542,26 +493,7 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
/* Release the previously taken kernel lock. */
taskEXIT_CRITICAL_SMP_ONLY( &xKernelLock );
}
#else /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
{
#if CONFIG_FREERTOS_SMP
{
xReturn = xTaskGetCurrentTaskHandleCPU( xCoreID );
}
#else /* CONFIG_FREERTOS_SMP */
{
if( xCoreID < configNUM_CORES )
{
xReturn = pxCurrentTCB[ xCoreID ];
}
else
{
xReturn = NULL;
}
}
#endif /* CONFIG_FREERTOS_SMP */
}
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
#endif /* CONFIG_FREERTOS_SMP */
return xReturn;
}
@ -569,7 +501,7 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
#endif /* ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) */
/*----------------------------------------------------------*/
#if ( CONFIG_FREERTOS_USE_KERNEL_10_5_1 && ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )
#if ( !CONFIG_FREERTOS_SMP && ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )
configRUN_TIME_COUNTER_TYPE ulTaskGetIdleRunTimeCounterForCore( BaseType_t xCoreID )
{
@ -590,10 +522,10 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
return ulRunTimeCounter;
}
#endif /* ( CONFIG_FREERTOS_USE_KERNEL_10_5_1 && ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
#endif /* ( !CONFIG_FREERTOS_SMP && ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
/*----------------------------------------------------------*/
#if ( CONFIG_FREERTOS_USE_KERNEL_10_5_1 && ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )
#if ( !CONFIG_FREERTOS_SMP && ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )
configRUN_TIME_COUNTER_TYPE ulTaskGetIdleRunTimePercentForCore( BaseType_t xCoreID )
{
@ -627,7 +559,7 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
return ulReturn;
}
#endif /* ( CONFIG_FREERTOS_USE_KERNEL_10_5_1 && ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
#endif /* ( !CONFIG_FREERTOS_SMP && ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
/*-----------------------------------------------------------*/
uint8_t * pxTaskGetStackStart( TaskHandle_t xTask )
@ -940,15 +872,15 @@ uint8_t * pxTaskGetStackStart( TaskHandle_t xTask )
else
{
/* We have a task; return its reentrant struct. */
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
{
ret = &pxCurTask->xTLSBlock;
}
#else /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
#if ( CONFIG_FREERTOS_SMP )
{
ret = &pxCurTask->xNewLib_reent;
}
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
#else /* CONFIG_FREERTOS_SMP */
{
ret = &pxCurTask->xTLSBlock;
}
#endif /* CONFIG_FREERTOS_SMP */
}
return ret;
@ -1188,16 +1120,12 @@ void * pvTaskGetCurrentTCBForCore( BaseType_t xCoreID )
void * pvRet;
configASSERT( ( xCoreID >= 0 ) && ( xCoreID < configNUM_CORES ) );
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
#if CONFIG_FREERTOS_SMP
/* SMP FreeRTOS defines pxCurrentTCB as a macro function call */
pvRet = ( void * ) pxCurrentTCB;
#else /* CONFIG_FREERTOS_SMP */
pvRet = ( void * ) pxCurrentTCBs[ xCoreID ];
#else /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
#if CONFIG_FREERTOS_SMP
/* SMP FreeRTOS defines pxCurrentTCB as a macro function call */
pvRet = pxCurrentTCB;
#else /* CONFIG_FREERTOS_SMP */
pvRet = ( void * ) pxCurrentTCB[ xCoreID ];
#endif /* CONFIG_FREERTOS_SMP */
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
#endif /* CONFIG_FREERTOS_SMP */
return pvRet;
}

View File

@ -184,7 +184,7 @@ TaskHandle_t xTaskGetCurrentTaskHandleForCPU( BaseType_t xCoreID )
}
/** @endcond */
#if CONFIG_FREERTOS_USE_KERNEL_10_5_1
#if ( !CONFIG_FREERTOS_SMP && ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )
/**
* @brief Get the total execution of a particular core's idle task
@ -208,18 +208,7 @@ TaskHandle_t xTaskGetCurrentTaskHandleForCPU( BaseType_t xCoreID )
*/
configRUN_TIME_COUNTER_TYPE ulTaskGetIdleRunTimePercentForCore( BaseType_t xCoreID );
#else /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
/* CMock Workaround: CMock currently doesn't preprocess files, thus functions
* guarded by ifdef still get mocked. We provide a dummy define here so that
* functions using configRUN_TIME_COUNTER_TYPE can still be mocked.
*
* Todo: Will be removed when V10.5.1 becomes the default kernel. */
#ifndef configRUN_TIME_COUNTER_TYPE
#define configRUN_TIME_COUNTER_TYPE unsigned int
#endif
#endif /* CONFIG_FREERTOS_USE_KERNEL_10_5_1 */
#endif /* ( !CONFIG_FREERTOS_SMP && ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
/**
* Returns the start of the stack associated with xTask.

View File

@ -171,8 +171,7 @@ entries:
tasks:ulTaskGenericNotifyValueClear (default)
if FREERTOS_GENERATE_RUN_TIME_STATS = y:
tasks:ulTaskGetIdleRunTimeCounter (default)
if FREERTOS_USE_KERNEL_10_5_1 = y:
tasks:ulTaskGetIdleRunTimePercent (default)
tasks:ulTaskGetIdleRunTimePercent (default)
tasks:prvAddCurrentTaskToDelayedList (default)
if FREERTOS_USE_TRACE_FACILITY = y:
tasks:uxTaskGetSystemState (default)
@ -195,8 +194,7 @@ entries:
timers:uxTimerGetReloadMode (default)
timers:xTimerGetExpiryTime (default)
timers:pcTimerGetName (default)
if FREERTOS_USE_KERNEL_10_5_1 = y:
timers:prvReloadTimer (default)
timers:prvReloadTimer (default)
timers:prvProcessExpiredTimer (default)
timers:prvTimerTask (default)
timers:prvProcessTimerOrBlockTask (default)

View File

@ -28,7 +28,7 @@ entries:
tasks:xTaskGetCoreID (default)
tasks:xTaskGetIdleTaskHandleForCore (default)
tasks:xTaskGetCurrentTaskHandleForCore (default)
if FREERTOS_USE_KERNEL_10_5_1 = y && FREERTOS_GENERATE_RUN_TIME_STATS = y:
if FREERTOS_SMP = n && FREERTOS_GENERATE_RUN_TIME_STATS = y:
tasks:ulTaskGetIdleRunTimeCounterForCore (default)
tasks:ulTaskGetIdleRunTimePercentForCore (default)
tasks:pxTaskGetStackStart (default)