Axiomatized knowledge about RP2040 architecture and added tmp workaround for over/underflows.

This commit is contained in:
Tobias Reinhard 2022-10-25 14:34:01 -04:00
parent 06bc0fbb2d
commit 8b958c7834
3 changed files with 302 additions and 243 deletions

12
tasks.c
View file

@ -28,6 +28,7 @@
#ifdef VERIFAST #ifdef VERIFAST
#include "verifast_proof_defs.h" #include "verifast_proof_defs.h"
#include "task_predicates.h" #include "task_predicates.h"
#include "verifast_RP2040_axioms.h"
#endif #endif
/* Standard includes. */ /* Standard includes. */
@ -1481,6 +1482,17 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
#if ( portSTACK_GROWTH < 0 ) #if ( portSTACK_GROWTH < 0 )
{ {
pxTopOfStack = &( pxNewTCB->pxStack[ ulStackDepth - ( uint32_t ) 1 ] ); pxTopOfStack = &( pxNewTCB->pxStack[ ulStackDepth - ( uint32_t ) 1 ] );
// Axiomatize that pointers on RP2040 are 32bit
//@ uint32_t_ptr_range(pxTopOfStack);
// TODO: How can we prove this?
// Assume that no underflow occurs
//@ assume( 0 <= (( (uint32_t) pxTopOfStack) & ~(7)) );
// TODO: How can we prove this?
// Assume that now overflow occurs.
//@ assume( (((uint32_t) pxTopOfStack) & ~7) <= UINTPTR_MAX);
pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); /*lint !e923 !e9033 !e9078 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. Checked by assert(). */ pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); /*lint !e923 !e9033 !e9078 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. Checked by assert(). */
/* Check the alignment of the calculated top of stack is correct. */ /* Check the alignment of the calculated top of stack is correct. */

View file

@ -120,6 +120,37 @@ predicate TCB_p(TCB_t * tcb, int stackSize) =
@*/ @*/
// # 31 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2 // # 31 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2
// # 1 "/Users/reitobia/repos2/FreeRTOS-Kernel/verification/verifast/proof_setup/verifast_RP2040_axioms.h" 1
// # 1 "/Users/reitobia/programs/verifast-21.04-83-gfae956f7/bin/stdint.h" 1
// # 18 "/Users/reitobia/programs/verifast-21.04-83-gfae956f7/bin/stdint.h"
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef __int128 int128_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
typedef unsigned __int128 uint128_t;
// # 5 "/Users/reitobia/repos2/FreeRTOS-Kernel/verification/verifast/proof_setup/verifast_RP2040_axioms.h" 2
/*
* The lemmas in this file axiomatize that the RP2040 architecture uses
* 32bit pointers.
*/
/*@
// Axiomatizes that: 0 <= ptr <= 2^32 - 1
lemma void uint32_t_ptr_range(uint32_t* ptr);
requires true;
ensures 0 <= (int) ptr &*& (int) ptr <= 4294967295;
@*/
// # 32 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2
/* Standard includes. */ /* Standard includes. */
@ -224,7 +255,7 @@ long long llabs(long long x);
//@ requires LLONG_MIN < x; //@ requires LLONG_MIN < x;
//@ ensures result == abs(x); //@ ensures result == abs(x);
//@ terminates; //@ terminates;
// # 35 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2 // # 36 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2
// # 1 "/Users/reitobia/programs/verifast-21.04-83-gfae956f7/bin/string.h" 1 // # 1 "/Users/reitobia/programs/verifast-21.04-83-gfae956f7/bin/string.h" 1
@ -293,7 +324,7 @@ void* memset(void *array, char value, size_t size);
char *strdup(char *string); char *strdup(char *string);
//@ requires [?f]string(string, ?cs); //@ requires [?f]string(string, ?cs);
//@ ensures [f]string(string, cs) &*& result == 0 ? true : string(result, cs) &*& malloc_block_chars(result, length(cs) + 1); //@ ensures [f]string(string, cs) &*& result == 0 ? true : string(result, cs) &*& malloc_block_chars(result, length(cs) + 1);
// # 36 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2 // # 37 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
* all the API functions to use the MPU wrappers. That should only be done when * all the API functions to use the MPU wrappers. That should only be done when
@ -349,20 +380,7 @@ char *strdup(char *string);
* contains the typedefs required to build FreeRTOS. Read the instructions * contains the typedefs required to build FreeRTOS. Read the instructions
* in FreeRTOS/source/stdint.readme for more information. * in FreeRTOS/source/stdint.readme for more information.
*/ */
// # 1 "/Users/reitobia/programs/verifast-21.04-83-gfae956f7/bin/stdint.h" 1
// # 18 "/Users/reitobia/programs/verifast-21.04-83-gfae956f7/bin/stdint.h"
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef __int128 int128_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
typedef unsigned __int128 uint128_t;
// # 49 "/Users/reitobia/repos2/FreeRTOS-Kernel/include/FreeRTOS.h" 2
/* *INDENT-OFF* */ /* *INDENT-OFF* */
@ -5074,7 +5092,7 @@ typedef StaticStreamBuffer_t StaticMessageBuffer_t;
/* *INDENT-ON* */ /* *INDENT-ON* */
// # 44 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2 // # 45 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2
// # 1 "/Users/reitobia/repos2/FreeRTOS-Kernel/include/task.h" 1 // # 1 "/Users/reitobia/repos2/FreeRTOS-Kernel/include/task.h" 1
/* /*
* FreeRTOS SMP Kernel V202110.00 * FreeRTOS SMP Kernel V202110.00
@ -8591,7 +8609,7 @@ void vTaskYieldWithinAPI( void );
/* *INDENT-ON* */ /* *INDENT-ON* */
// # 45 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2 // # 46 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2
// # 1 "/Users/reitobia/repos2/FreeRTOS-Kernel/include/timers.h" 1 // # 1 "/Users/reitobia/repos2/FreeRTOS-Kernel/include/timers.h" 1
/* /*
* FreeRTOS SMP Kernel V202110.00 * FreeRTOS SMP Kernel V202110.00
@ -9932,7 +9950,7 @@ BaseType_t xTimerGenericCommandFromISR( TimerHandle_t xTimer,
/* *INDENT-ON* */ /* *INDENT-ON* */
// # 46 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2 // # 47 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2
// # 1 "/Users/reitobia/repos2/FreeRTOS-Kernel/include/stack_macros.h" 1 // # 1 "/Users/reitobia/repos2/FreeRTOS-Kernel/include/stack_macros.h" 1
/* /*
* FreeRTOS SMP Kernel V202110.00 * FreeRTOS SMP Kernel V202110.00
@ -9993,7 +10011,7 @@ BaseType_t xTimerGenericCommandFromISR( TimerHandle_t xTimer,
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* Remove stack overflow macro if not being used. */ /* Remove stack overflow macro if not being used. */
// # 47 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2 // # 48 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2
// # 1 "/Users/reitobia/repos2/FreeRTOS-Kernel/verification/verifast/proof_setup/verifast_asm.h" 1 // # 1 "/Users/reitobia/repos2/FreeRTOS-Kernel/verification/verifast/proof_setup/verifast_asm.h" 1
@ -10021,7 +10039,7 @@ bool assert_fct(bool b)
* VeriFast does not support embedding block statements that consist of * VeriFast does not support embedding block statements that consist of
* multiple elemts in expression contexts, e.g., `({e1; e2})`. * multiple elemts in expression contexts, e.g., `({e1; e2})`.
*/ */
// # 50 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2 // # 51 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" 2
/* Lint e9021, e961 and e750 are suppressed as a MISRA exception justified /* Lint e9021, e961 and e750 are suppressed as a MISRA exception justified
@ -10032,7 +10050,7 @@ bool assert_fct(bool b)
/* Set configUSE_STATS_FORMATTING_FUNCTIONS to 2 to include the stats formatting /* Set configUSE_STATS_FORMATTING_FUNCTIONS to 2 to include the stats formatting
* functions but without including stdio.h here. */ * functions but without including stdio.h here. */
// # 78 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 79 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/* Values that can be assigned to the ucNotifyState member of the TCB. */ /* Values that can be assigned to the ucNotifyState member of the TCB. */
@ -10089,18 +10107,18 @@ bool assert_fct(bool b)
/* uxTopReadyPriority holds the priority of the highest priority ready /* uxTopReadyPriority holds the priority of the highest priority ready
* state task. */ * state task. */
// # 142 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 143 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* Define away taskRESET_READY_PRIORITY() and portRESET_READY_PRIORITY() as /* Define away taskRESET_READY_PRIORITY() and portRESET_READY_PRIORITY() as
* they are only required when a port optimised method of task selection is * they are only required when a port optimised method of task selection is
* being used. */ * being used. */
// # 176 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 177 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* pxDelayedTaskList and pxOverflowDelayedTaskList are switched when the tick /* pxDelayedTaskList and pxOverflowDelayedTaskList are switched when the tick
* count overflows. */ * count overflows. */
// # 194 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 195 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* /*
@ -10155,7 +10173,7 @@ typedef BaseType_t TaskRunning_t;
typedef struct tskTaskControlBlock /* The old naming convention is used to prevent breaking kernel aware debuggers. */ typedef struct tskTaskControlBlock /* The old naming convention is used to prevent breaking kernel aware debuggers. */
{ {
volatile StackType_t * pxTopOfStack; /*< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE TCB STRUCT. */ volatile StackType_t * pxTopOfStack; /*< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE TCB STRUCT. */
// # 257 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 258 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
ListItem_t xStateListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */ ListItem_t xStateListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
ListItem_t xEventListItem; /*< Used to reference a task from an event list. */ ListItem_t xEventListItem; /*< Used to reference a task from an event list. */
UBaseType_t uxPriority; /*< The priority of the task. 0 is the lowest priority. */ UBaseType_t uxPriority; /*< The priority of the task. 0 is the lowest priority. */
@ -10163,7 +10181,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to preve
volatile TaskRunning_t xTaskRunState; /*< Used to identify the core the task is running on, if any. */ volatile TaskRunning_t xTaskRunState; /*< Used to identify the core the task is running on, if any. */
BaseType_t xIsIdle; /*< Used to identify the idle tasks. */ BaseType_t xIsIdle; /*< Used to identify the idle tasks. */
char pcTaskName[ 16 ]; /*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ char pcTaskName[ 16 ]; /*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
// # 274 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 275 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
UBaseType_t uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */ UBaseType_t uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */
@ -10183,7 +10201,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to preve
void * pvThreadLocalStoragePointers[ 5 ]; void * pvThreadLocalStoragePointers[ 5 ];
// # 314 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 315 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
volatile uint32_t ulNotifiedValue[ 1 ]; volatile uint32_t ulNotifiedValue[ 1 ];
volatile uint8_t ucNotifyState[ 1 ]; volatile uint8_t ucNotifyState[ 1 ];
@ -10274,7 +10292,7 @@ const volatile UBaseType_t uxTopUsedPriority = 32 - 1U;
* must not be done by an ISR. Reads must be protected by either lock and may be done by * must not be done by an ISR. Reads must be protected by either lock and may be done by
* either an ISR or a task. */ * either an ISR or a task. */
static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) ( ( BaseType_t ) 0 ); static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) ( ( BaseType_t ) 0 );
// # 414 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 415 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*lint -restore */ /*lint -restore */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -10427,7 +10445,7 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
* will exit the Blocked state. * will exit the Blocked state.
*/ */
static void prvResetNextTaskUnblockTime( void ) ; static void prvResetNextTaskUnblockTime( void ) ;
// # 578 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 579 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/* /*
* Called after a Task_t structure has been allocated either statically or * Called after a Task_t structure has been allocated either statically or
* dynamically to fill in the structure's members. * dynamically to fill in the structure's members.
@ -10459,9 +10477,9 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) ;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 628 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 629 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 711 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 712 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvYieldCore( BaseType_t xCoreID ) static void prvYieldCore( BaseType_t xCoreID )
@ -10503,8 +10521,8 @@ static void prvYieldForTask( TCB_t * pxTCB,
/* THIS FUNCTION MUST BE CALLED FROM A CRITICAL SECTION */ /* THIS FUNCTION MUST BE CALLED FROM A CRITICAL SECTION */
(__builtin_expect(!(xTaskGetCurrentTaskHandle()->uxCriticalNesting > 0U), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 752, "xTaskGetCurrentTaskHandle()->uxCriticalNesting > 0U") : (void)0); (__builtin_expect(!(xTaskGetCurrentTaskHandle()->uxCriticalNesting > 0U), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 753, "xTaskGetCurrentTaskHandle()->uxCriticalNesting > 0U") : (void)0);
// # 765 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 766 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
xLowestPriority = ( BaseType_t ) pxTCB->uxPriority; xLowestPriority = ( BaseType_t ) pxTCB->uxPriority;
if( xPreemptEqualPriority == ( ( BaseType_t ) 0 ) ) if( xPreemptEqualPriority == ( ( BaseType_t ) 0 ) )
@ -10543,7 +10561,7 @@ static void prvYieldForTask( TCB_t * pxTCB,
{ {
; ;
} }
// # 819 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 820 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
} }
else else
{ {
@ -10556,7 +10574,7 @@ static void prvYieldForTask( TCB_t * pxTCB,
prvYieldCore( xLowestPriorityCore ); prvYieldCore( xLowestPriorityCore );
xYieldCount++; xYieldCount++;
} }
// # 839 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 840 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -10567,10 +10585,10 @@ static void prvYieldForTask( TCB_t * pxTCB,
UBaseType_t uxCurrentPriority = uxTopReadyPriority; UBaseType_t uxCurrentPriority = uxTopReadyPriority;
BaseType_t xTaskScheduled = ( ( BaseType_t ) 0 ); BaseType_t xTaskScheduled = ( ( BaseType_t ) 0 );
BaseType_t xDecrementTopPriority = ( ( BaseType_t ) 1 ); BaseType_t xDecrementTopPriority = ( ( BaseType_t ) 1 );
// # 857 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 858 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
while( xTaskScheduled == ( ( BaseType_t ) 0 ) ) while( xTaskScheduled == ( ( BaseType_t ) 0 ) )
{ {
// # 871 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 872 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
if( ( ( ( &( pxReadyTasksLists[ uxCurrentPriority ] ) )->uxNumberOfItems == ( UBaseType_t ) 0 ) ? ( ( BaseType_t ) 1 ) : ( ( BaseType_t ) 0 ) ) == ( ( BaseType_t ) 0 ) ) if( ( ( ( &( pxReadyTasksLists[ uxCurrentPriority ] ) )->uxNumberOfItems == ( UBaseType_t ) 0 ) ? ( ( BaseType_t ) 1 ) : ( ( BaseType_t ) 0 ) ) == ( ( BaseType_t ) 0 ) )
{ {
@ -10608,7 +10626,7 @@ static void prvYieldForTask( TCB_t * pxTCB,
pxTCB = pxTaskItem->pvOwner; pxTCB = pxTaskItem->pvOwner;
/*debug_printf("Attempting to schedule %s on core %d\n", pxTCB->pcTaskName, portGET_CORE_ID() ); */ /*debug_printf("Attempting to schedule %s on core %d\n", pxTCB->pcTaskName, portGET_CORE_ID() ); */
// # 924 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 925 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
if( pxTCB->xTaskRunState == ( TaskRunning_t ) ( -1 ) ) if( pxTCB->xTaskRunState == ( TaskRunning_t ) ( -1 ) )
{ {
@ -10629,7 +10647,7 @@ static void prvYieldForTask( TCB_t * pxTCB,
} }
else if( pxTCB == pxCurrentTCBs[ xCoreID ] ) else if( pxTCB == pxCurrentTCBs[ xCoreID ] )
{ {
(__builtin_expect(!(( pxTCB->xTaskRunState == xCoreID ) || ( pxTCB->xTaskRunState == ( TaskRunning_t ) ( -2 ) )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 944, "( pxTCB->xTaskRunState == xCoreID ) || ( pxTCB->xTaskRunState == ( TaskRunning_t ) ( -2 ) )") : (void)0); (__builtin_expect(!(( pxTCB->xTaskRunState == xCoreID ) || ( pxTCB->xTaskRunState == ( TaskRunning_t ) ( -2 ) )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 945, "( pxTCB->xTaskRunState == xCoreID ) || ( pxTCB->xTaskRunState == ( TaskRunning_t ) ( -2 ) )") : (void)0);
@ -10673,21 +10691,21 @@ static void prvYieldForTask( TCB_t * pxTCB,
return ( ( BaseType_t ) 0 ); return ( ( BaseType_t ) 0 );
} }
(__builtin_expect(!(( uxCurrentPriority > ( ( UBaseType_t ) 0U ) ) || ( xTaskScheduled == ( ( BaseType_t ) 1 ) )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 988, "( uxCurrentPriority > ( ( UBaseType_t ) 0U ) ) || ( xTaskScheduled == ( ( BaseType_t ) 1 ) )") : (void)0); (__builtin_expect(!(( uxCurrentPriority > ( ( UBaseType_t ) 0U ) ) || ( xTaskScheduled == ( ( BaseType_t ) 1 ) )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 989, "( uxCurrentPriority > ( ( UBaseType_t ) 0U ) ) || ( xTaskScheduled == ( ( BaseType_t ) 1 ) )") : (void)0);
uxCurrentPriority--; uxCurrentPriority--;
} }
(__builtin_expect(!(( ( 0 <= pxCurrentTCBs[ xCoreID ]->xTaskRunState ) && ( pxCurrentTCBs[ xCoreID ]->xTaskRunState < 1 ) )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 992, "( ( 0 <= pxCurrentTCBs[ xCoreID ]->xTaskRunState ) && ( pxCurrentTCBs[ xCoreID ]->xTaskRunState < 1 ) )") : (void)0); (__builtin_expect(!(( ( 0 <= pxCurrentTCBs[ xCoreID ]->xTaskRunState ) && ( pxCurrentTCBs[ xCoreID ]->xTaskRunState < 1 ) )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 993, "( ( 0 <= pxCurrentTCBs[ xCoreID ]->xTaskRunState ) && ( pxCurrentTCBs[ xCoreID ]->xTaskRunState < 1 ) )") : (void)0);
// # 1068 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1069 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
return ( ( BaseType_t ) 1 ); return ( ( BaseType_t ) 1 );
} }
// # 1084 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1085 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 1162 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1163 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 1225 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1226 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 1291 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1292 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -10702,7 +10720,7 @@ static void prvYieldForTask( TCB_t * pxTCB,
usStackDepth > 0; usStackDepth > 0;
@*/ @*/
//@ ensures true; //@ ensures true;
// # 1318 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1319 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
{ {
TCB_t * pxNewTCB; TCB_t * pxNewTCB;
BaseType_t xReturn; BaseType_t xReturn;
@ -10710,7 +10728,7 @@ static void prvYieldForTask( TCB_t * pxTCB,
/* If the stack grows down then allocate the stack then the TCB so the stack /* If the stack grows down then allocate the stack then the TCB so the stack
* does not grow into the TCB. Likewise if the stack grows up then allocate * does not grow into the TCB. Likewise if the stack grows up then allocate
* the TCB then the stack. */ * the TCB then the stack. */
// # 1348 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1349 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
{ {
StackType_t * pxStack; StackType_t * pxStack;
@ -10746,9 +10764,9 @@ static void prvYieldForTask( TCB_t * pxTCB,
if( pxNewTCB != 0 ) if( pxNewTCB != 0 )
{ {
// # 1391 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1392 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
prvInitialiseNewTask( pxTaskCode, pcName, ( uint32_t ) usStackDepth, pvParameters, uxPriority, pxCreatedTask, pxNewTCB, 0 ); prvInitialiseNewTask( pxTaskCode, pcName, ( uint32_t ) usStackDepth, pvParameters, uxPriority, pxCreatedTask, pxNewTCB, 0 );
// # 1400 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1401 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
prvAddNewTaskToReadyList( pxNewTCB ); prvAddNewTaskToReadyList( pxNewTCB );
xReturn = ( ( ( BaseType_t ) 1 ) ); xReturn = ( ( ( BaseType_t ) 1 ) );
} }
@ -10784,7 +10802,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
{ {
StackType_t * pxTopOfStack; StackType_t * pxTopOfStack;
UBaseType_t x; UBaseType_t x;
// # 1452 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1453 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
//@ open TCB_p(_,_); //@ open TCB_p(_,_);
/* Avoid dependency on memset() if it is not required. */ /* Avoid dependency on memset() if it is not required. */
@ -10817,14 +10835,24 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
{ {
pxTopOfStack = &( pxNewTCB->pxStack[ ulStackDepth - ( uint32_t ) 1 ] ); pxTopOfStack = &( pxNewTCB->pxStack[ ulStackDepth - ( uint32_t ) 1 ] );
// VF-TODO: Justiy that this does not cause an arithmetic overflow
// Axiomatize that pointers on RP2040 are 32bit
//@ uint32_t_ptr_range(pxTopOfStack);
// TODO: How can we prove this?
// Assume that no underflow occurs
//@ assume( 0 <= (( (uint32_t) pxTopOfStack) & ~(7)) );
// TODO: How can we prove this?
// Assume that now overflow occurs.
//@ assume( (((uint32_t) pxTopOfStack) & ~7) <= UINTPTR_MAX);
pxTopOfStack = ( StackType_t * ) ( ( ( uint32_t ) pxTopOfStack ) & ( ~( ( uint32_t ) ( 0x0007 ) ) ) ); /*lint !e923 !e9033 !e9078 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. Checked by assert(). */ pxTopOfStack = ( StackType_t * ) ( ( ( uint32_t ) pxTopOfStack ) & ( ~( ( uint32_t ) ( 0x0007 ) ) ) ); /*lint !e923 !e9033 !e9078 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. Checked by assert(). */
/* Check the alignment of the calculated top of stack is correct. */ /* Check the alignment of the calculated top of stack is correct. */
(__builtin_expect(!(( ( ( uint32_t ) pxTopOfStack & ( uint32_t ) ( 0x0007 ) ) == 0UL )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 1487, "( ( ( uint32_t ) pxTopOfStack & ( uint32_t ) ( 0x0007 ) ) == 0UL )") : (void)0); (__builtin_expect(!(( ( ( uint32_t ) pxTopOfStack & ( uint32_t ) ( 0x0007 ) ) == 0UL )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 1499, "( ( ( uint32_t ) pxTopOfStack & ( uint32_t ) ( 0x0007 ) ) == 0UL )") : (void)0);
// # 1496 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1508 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
} }
// # 1510 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1522 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/* Store the task name in the TCB. */ /* Store the task name in the TCB. */
if( pcName != 0 ) if( pcName != 0 )
{ {
@ -10890,7 +10918,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
{ {
pxNewTCB->uxCriticalNesting = ( UBaseType_t ) 0U; pxNewTCB->uxCriticalNesting = ( UBaseType_t ) 0U;
} }
// # 1594 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1606 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
{ {
/* Avoid compiler warning about unreferenced parameter. */ /* Avoid compiler warning about unreferenced parameter. */
( void ) xRegions; ( void ) xRegions;
@ -10908,21 +10936,21 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
memset( ( void * ) &( pxNewTCB->ulNotifiedValue[ 0 ] ), 0x00, sizeof( pxNewTCB->ulNotifiedValue ) ); memset( ( void * ) &( pxNewTCB->ulNotifiedValue[ 0 ] ), 0x00, sizeof( pxNewTCB->ulNotifiedValue ) );
memset( ( void * ) &( pxNewTCB->ucNotifyState[ 0 ] ), 0x00, sizeof( pxNewTCB->ucNotifyState ) ); memset( ( void * ) &( pxNewTCB->ucNotifyState[ 0 ] ), 0x00, sizeof( pxNewTCB->ucNotifyState ) );
} }
// # 1623 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1635 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
{ {
pxNewTCB->ucDelayAborted = ( ( BaseType_t ) 0 ); pxNewTCB->ucDelayAborted = ( ( BaseType_t ) 0 );
} }
// # 1641 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1653 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/* Initialize the TCB stack to look as if the task was already running, /* Initialize the TCB stack to look as if the task was already running,
* but had been interrupted by the scheduler. The return address is set * but had been interrupted by the scheduler. The return address is set
* to the start of the task function. Once the stack has been initialised * to the start of the task function. Once the stack has been initialised
* the top of stack variable is updated. */ * the top of stack variable is updated. */
// # 1669 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1681 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
{ {
/* If the port has capability to detect stack overflow, /* If the port has capability to detect stack overflow,
* pass the stack end address to the stack initialization * pass the stack end address to the stack initialization
* function as well. */ * function as well. */
// # 1686 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 1698 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
{ {
pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pxTaskCode, pvParameters ); pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pxTaskCode, pvParameters );
} }
@ -11131,7 +11159,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
if( xTaskRunningOnCore == xCoreID ) if( xTaskRunningOnCore == xCoreID )
{ {
(__builtin_expect(!(uxSchedulerSuspended == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 1894, "uxSchedulerSuspended == 0") : (void)0); (__builtin_expect(!(uxSchedulerSuspended == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 1906, "uxSchedulerSuspended == 0") : (void)0);
vTaskYieldWithinAPI(); vTaskYieldWithinAPI();
} }
else else
@ -11154,12 +11182,12 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
TickType_t xTimeToWake; TickType_t xTimeToWake;
BaseType_t xAlreadyYielded, xShouldDelay = ( ( BaseType_t ) 0 ); BaseType_t xAlreadyYielded, xShouldDelay = ( ( BaseType_t ) 0 );
(__builtin_expect(!(pxPreviousWakeTime), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 1917, "pxPreviousWakeTime") : (void)0); (__builtin_expect(!(pxPreviousWakeTime), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 1929, "pxPreviousWakeTime") : (void)0);
(__builtin_expect(!(( xTimeIncrement > 0U )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 1918, "( xTimeIncrement > 0U )") : (void)0); (__builtin_expect(!(( xTimeIncrement > 0U )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 1930, "( xTimeIncrement > 0U )") : (void)0);
vTaskSuspendAll(); vTaskSuspendAll();
{ {
(__builtin_expect(!(uxSchedulerSuspended == 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 1922, "uxSchedulerSuspended == 1") : (void)0); (__builtin_expect(!(uxSchedulerSuspended == 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 1934, "uxSchedulerSuspended == 1") : (void)0);
/* Minor optimisation. The tick count cannot change in this /* Minor optimisation. The tick count cannot change in this
* block. */ * block. */
@ -11245,7 +11273,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
{ {
vTaskSuspendAll(); vTaskSuspendAll();
{ {
(__builtin_expect(!(uxSchedulerSuspended == 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2008, "uxSchedulerSuspended == 1") : (void)0); (__builtin_expect(!(uxSchedulerSuspended == 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2020, "uxSchedulerSuspended == 1") : (void)0);
; ;
/* A task that is removed from the event list while the /* A task that is removed from the event list while the
@ -11299,7 +11327,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
const TCB_t * const pxTCB = xTask; const TCB_t * const pxTCB = xTask;
(__builtin_expect(!(pxTCB), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2062, "pxTCB") : (void)0); (__builtin_expect(!(pxTCB), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2074, "pxTCB") : (void)0);
vTaskEnterCritical(); vTaskEnterCritical();
{ {
@ -11475,7 +11503,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
BaseType_t xYieldForTask = ( ( BaseType_t ) 0 ); BaseType_t xYieldForTask = ( ( BaseType_t ) 0 );
BaseType_t xCoreID; BaseType_t xCoreID;
(__builtin_expect(!(( uxNewPriority < 32 )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2238, "( uxNewPriority < 32 )") : (void)0); (__builtin_expect(!(( uxNewPriority < 32 )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2250, "( uxNewPriority < 32 )") : (void)0);
/* Ensure the new priority is valid. */ /* Ensure the new priority is valid. */
if( uxNewPriority >= ( UBaseType_t ) 32 ) if( uxNewPriority >= ( UBaseType_t ) 32 )
@ -11629,13 +11657,13 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 2426 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 2438 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 2449 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 2461 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 2467 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 2479 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 2495 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 2507 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -11712,7 +11740,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
if( xTaskRunningOnCore == 0 ) if( xTaskRunningOnCore == 0 )
{ {
/* The current task has just been suspended. */ /* The current task has just been suspended. */
(__builtin_expect(!(uxSchedulerSuspended == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2571, "uxSchedulerSuspended == 0") : (void)0); (__builtin_expect(!(uxSchedulerSuspended == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2583, "uxSchedulerSuspended == 0") : (void)0);
vTaskYieldWithinAPI(); vTaskYieldWithinAPI();
} }
else else
@ -11726,7 +11754,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
{ {
vTaskExitCritical(); vTaskExitCritical();
(__builtin_expect(!(pxTCB == pxCurrentTCBs[ xTaskRunningOnCore ]), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2585, "pxTCB == pxCurrentTCBs[ xTaskRunningOnCore ]") : (void)0); (__builtin_expect(!(pxTCB == pxCurrentTCBs[ xTaskRunningOnCore ]), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2597, "pxTCB == pxCurrentTCBs[ xTaskRunningOnCore ]") : (void)0);
/* The scheduler is not running, but the task that was pointed /* The scheduler is not running, but the task that was pointed
* to by pxCurrentTCB has just been suspended and pxCurrentTCB * to by pxCurrentTCB has just been suspended and pxCurrentTCB
@ -11773,7 +11801,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
/* Accesses xPendingReadyList so must be called from a critical section. */ /* Accesses xPendingReadyList so must be called from a critical section. */
/* It does not make sense to check if the calling task is suspended. */ /* It does not make sense to check if the calling task is suspended. */
(__builtin_expect(!(xTask), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2632, "xTask") : (void)0); (__builtin_expect(!(xTask), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2644, "xTask") : (void)0);
/* Is the task being resumed actually in the suspended list? */ /* Is the task being resumed actually in the suspended list? */
if( ( ( ( &( pxTCB->xStateListItem ) )->pxContainer == ( &xSuspendedTaskList ) ) ? ( ( ( BaseType_t ) 1 ) ) : ( ( ( BaseType_t ) 0 ) ) ) != ( ( BaseType_t ) 0 ) ) if( ( ( ( &( pxTCB->xStateListItem ) )->pxContainer == ( &xSuspendedTaskList ) ) ? ( ( ( BaseType_t ) 1 ) ) : ( ( ( BaseType_t ) 0 ) ) ) != ( ( BaseType_t ) 0 ) )
@ -11822,7 +11850,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
/* It does not make sense to resume the calling task. */ /* It does not make sense to resume the calling task. */
(__builtin_expect(!(xTaskToResume), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2681, "xTaskToResume") : (void)0); (__builtin_expect(!(xTaskToResume), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2693, "xTaskToResume") : (void)0);
/* The parameter cannot be NULL as it is impossible to resume the /* The parameter cannot be NULL as it is impossible to resume the
* currently executing task. It is also impossible to resume a task * currently executing task. It is also impossible to resume a task
@ -11881,7 +11909,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
UBaseType_t uxSavedInterruptStatus; UBaseType_t uxSavedInterruptStatus;
(__builtin_expect(!(xTaskToResume), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2740, "xTaskToResume") : (void)0); (__builtin_expect(!(xTaskToResume), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 2752, "xTaskToResume") : (void)0);
/* RTOS ports that support interrupt nesting have the concept of a /* RTOS ports that support interrupt nesting have the concept of a
* maximum system call (or maximum API call) interrupt priority. * maximum system call (or maximum API call) interrupt priority.
@ -12002,7 +12030,7 @@ static BaseType_t prvCreateIdleTasks( void )
{ {
; ;
} }
// # 2908 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 2920 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
{ {
if( xCoreID == 0 ) if( xCoreID == 0 )
{ {
@ -12014,7 +12042,7 @@ static BaseType_t prvCreateIdleTasks( void )
( ( UBaseType_t ) 0x00 ), /* In effect ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), but tskIDLE_PRIORITY is zero. */ ( ( UBaseType_t ) 0x00 ), /* In effect ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), but tskIDLE_PRIORITY is zero. */
&xIdleTaskHandle[ xCoreID ] ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */ &xIdleTaskHandle[ xCoreID ] ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
} }
// # 2931 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 2943 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
} }
} }
@ -12051,7 +12079,7 @@ void vTaskStartScheduler( void )
* so interrupts will automatically get re-enabled when the first task * so interrupts will automatically get re-enabled when the first task
* starts to run. */ * starts to run. */
assert_fct(false); assert_fct(false);
// # 2981 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 2993 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
xNextTaskUnblockTime = ( TickType_t ) 0xffffffffUL; xNextTaskUnblockTime = ( TickType_t ) 0xffffffffUL;
xSchedulerRunning = ( ( BaseType_t ) 1 ); xSchedulerRunning = ( ( BaseType_t ) 1 );
xTickCount = ( TickType_t ) 0; xTickCount = ( TickType_t ) 0;
@ -12083,7 +12111,7 @@ void vTaskStartScheduler( void )
/* This line will only be reached if the kernel could not be started, /* This line will only be reached if the kernel could not be started,
* because there was not enough FreeRTOS heap to create the idle task * because there was not enough FreeRTOS heap to create the idle task
* or the timer task. */ * or the timer task. */
(__builtin_expect(!(xReturn != ( -1 )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3012, "xReturn != ( -1 )") : (void)0); (__builtin_expect(!(xReturn != ( -1 )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3024, "xReturn != ( -1 )") : (void)0);
} }
/* Prevent compiler warnings if INCLUDE_xTaskGetIdleTaskHandle is set to 0, /* Prevent compiler warnings if INCLUDE_xTaskGetIdleTaskHandle is set to 0,
@ -12148,7 +12176,7 @@ void vTaskSuspendAll( void )
} }
} }
/*----------------------------------------------------------*/ /*----------------------------------------------------------*/
// # 3139 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 3151 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*----------------------------------------------------------*/ /*----------------------------------------------------------*/
BaseType_t xTaskResumeAll( void ) BaseType_t xTaskResumeAll( void )
@ -12171,7 +12199,7 @@ BaseType_t xTaskResumeAll( void )
/* If uxSchedulerSuspended is zero then this function does not match a /* If uxSchedulerSuspended is zero then this function does not match a
* previous call to vTaskSuspendAll(). */ * previous call to vTaskSuspendAll(). */
(__builtin_expect(!(uxSchedulerSuspended), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3161, "uxSchedulerSuspended") : (void)0); (__builtin_expect(!(uxSchedulerSuspended), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3173, "uxSchedulerSuspended") : (void)0);
--uxSchedulerSuspended; --uxSchedulerSuspended;
vPortRecursiveLock(1, spin_lock_instance(15), ( ( BaseType_t ) 0 )); vPortRecursiveLock(1, spin_lock_instance(15), ( ( BaseType_t ) 0 ));
@ -12329,7 +12357,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
/* If null is passed in here then the name of the calling task is being /* If null is passed in here then the name of the calling task is being
* queried. */ * queried. */
pxTCB = ( ( ( xTaskToQuery ) == 0 ) ? xTaskGetCurrentTaskHandle() : ( xTaskToQuery ) ); pxTCB = ( ( ( xTaskToQuery ) == 0 ) ? xTaskGetCurrentTaskHandle() : ( xTaskToQuery ) );
(__builtin_expect(!(pxTCB), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3319, "pxTCB") : (void)0); (__builtin_expect(!(pxTCB), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3331, "pxTCB") : (void)0);
return &( pxTCB->pcTaskName[ 0 ] ); return &( pxTCB->pcTaskName[ 0 ] );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -12422,7 +12450,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
TCB_t * pxTCB; TCB_t * pxTCB;
/* Task names will be truncated to configMAX_TASK_NAME_LEN - 1 bytes. */ /* Task names will be truncated to configMAX_TASK_NAME_LEN - 1 bytes. */
(__builtin_expect(!(strlen( pcNameToQuery ) < 16), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3412, "strlen( pcNameToQuery ) < 16") : (void)0); (__builtin_expect(!(strlen( pcNameToQuery ) < 16), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3424, "strlen( pcNameToQuery ) < 16") : (void)0);
vTaskSuspendAll(); vTaskSuspendAll();
{ {
@ -12518,7 +12546,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
* each task in the Suspended state. */ * each task in the Suspended state. */
uxTask += prvListTasksWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), &xSuspendedTaskList, eSuspended ); uxTask += prvListTasksWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), &xSuspendedTaskList, eSuspended );
} }
// # 3522 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 3534 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
{ {
if( pulTotalRunTime != 0 ) if( pulTotalRunTime != 0 )
{ {
@ -12546,7 +12574,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
{ {
/* If xTaskGetIdleTaskHandle() is called before the scheduler has been /* If xTaskGetIdleTaskHandle() is called before the scheduler has been
* started, then xIdleTaskHandle will be NULL. */ * started, then xIdleTaskHandle will be NULL. */
(__builtin_expect(!(( xIdleTaskHandle != 0 )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3549, "( xIdleTaskHandle != 0 )") : (void)0); (__builtin_expect(!(( xIdleTaskHandle != 0 )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3561, "( xIdleTaskHandle != 0 )") : (void)0);
return &( xIdleTaskHandle[ 0 ] ); return &( xIdleTaskHandle[ 0 ] );
} }
@ -12557,7 +12585,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
* This is to ensure vTaskStepTick() is available when user defined low power mode * This is to ensure vTaskStepTick() is available when user defined low power mode
* implementations require configUSE_TICKLESS_IDLE to be set to a value other than * implementations require configUSE_TICKLESS_IDLE to be set to a value other than
* 1. */ * 1. */
// # 3573 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 3585 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*----------------------------------------------------------*/ /*----------------------------------------------------------*/
BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp )
@ -12566,7 +12594,7 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp )
/* Must not be called with the scheduler suspended as the implementation /* Must not be called with the scheduler suspended as the implementation
* relies on xPendedTicks being wound down to 0 in xTaskResumeAll(). */ * relies on xPendedTicks being wound down to 0 in xTaskResumeAll(). */
(__builtin_expect(!(uxSchedulerSuspended == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3581, "uxSchedulerSuspended == 0") : (void)0); (__builtin_expect(!(uxSchedulerSuspended == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3593, "uxSchedulerSuspended == 0") : (void)0);
/* Use xPendedTicks to mimic xTicksToCatchUp number of ticks occurring when /* Use xPendedTicks to mimic xTicksToCatchUp number of ticks occurring when
* the scheduler is suspended so the ticks are executed in xTaskResumeAll(). */ * the scheduler is suspended so the ticks are executed in xTaskResumeAll(). */
@ -12585,7 +12613,7 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp )
TCB_t * pxTCB = xTask; TCB_t * pxTCB = xTask;
BaseType_t xReturn; BaseType_t xReturn;
(__builtin_expect(!(pxTCB), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3600, "pxTCB") : (void)0); (__builtin_expect(!(pxTCB), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3612, "pxTCB") : (void)0);
vTaskSuspendAll(); vTaskSuspendAll();
{ {
@ -12684,7 +12712,7 @@ BaseType_t xTaskIncrementTick( void )
if( xConstTickCount == ( TickType_t ) 0U ) /*lint !e774 'if' does not always evaluate to false as it is looking for an overflow. */ if( xConstTickCount == ( TickType_t ) 0U ) /*lint !e774 'if' does not always evaluate to false as it is looking for an overflow. */
{ {
{ List_t * pxTemp; (__builtin_expect(!(( ( ( ( pxDelayedTaskList )->uxNumberOfItems == ( UBaseType_t ) 0 ) ? ( ( BaseType_t ) 1 ) : ( ( BaseType_t ) 0 ) ) )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3699, "( ( ( ( pxDelayedTaskList )->uxNumberOfItems == ( UBaseType_t ) 0 ) ? ( ( BaseType_t ) 1 ) : ( ( BaseType_t ) 0 ) ) )") : (void)0); pxTemp = pxDelayedTaskList; pxDelayedTaskList = pxOverflowDelayedTaskList; pxOverflowDelayedTaskList = pxTemp; xNumOfOverflows++; prvResetNextTaskUnblockTime(); }; { List_t * pxTemp; (__builtin_expect(!(( ( ( ( pxDelayedTaskList )->uxNumberOfItems == ( UBaseType_t ) 0 ) ? ( ( BaseType_t ) 1 ) : ( ( BaseType_t ) 0 ) ) )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 3711, "( ( ( ( pxDelayedTaskList )->uxNumberOfItems == ( UBaseType_t ) 0 ) ? ( ( BaseType_t ) 1 ) : ( ( BaseType_t ) 0 ) ) )") : (void)0); pxTemp = pxDelayedTaskList; pxDelayedTaskList = pxOverflowDelayedTaskList; pxOverflowDelayedTaskList = pxTemp; xNumOfOverflows++; prvResetNextTaskUnblockTime(); };
} }
else else
{ {
@ -12867,13 +12895,13 @@ BaseType_t xTaskIncrementTick( void )
return xSwitchRequired; return xSwitchRequired;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 3911 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 3923 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 3935 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 3947 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 3960 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 3972 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 3993 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4005 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vTaskSwitchContext( BaseType_t xCoreID ) void vTaskSwitchContext( BaseType_t xCoreID )
@ -12891,7 +12919,7 @@ void vTaskSwitchContext( BaseType_t xCoreID )
{ {
/* vTaskSwitchContext() must never be called from within a critical section. /* vTaskSwitchContext() must never be called from within a critical section.
* This is not necessarily true for vanilla FreeRTOS, but it is for this SMP port. */ * This is not necessarily true for vanilla FreeRTOS, but it is for this SMP port. */
(__builtin_expect(!(xTaskGetCurrentTaskHandle()->uxCriticalNesting == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4010, "xTaskGetCurrentTaskHandle()->uxCriticalNesting == 0") : (void)0); (__builtin_expect(!(xTaskGetCurrentTaskHandle()->uxCriticalNesting == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4022, "xTaskGetCurrentTaskHandle()->uxCriticalNesting == 0") : (void)0);
if( uxSchedulerSuspended != ( UBaseType_t ) ( ( BaseType_t ) 0 ) ) if( uxSchedulerSuspended != ( UBaseType_t ) ( ( BaseType_t ) 0 ) )
{ {
@ -12903,7 +12931,7 @@ void vTaskSwitchContext( BaseType_t xCoreID )
{ {
xYieldPendings[ xCoreID ] = ( ( BaseType_t ) 0 ); xYieldPendings[ xCoreID ] = ( ( BaseType_t ) 0 );
; ;
// # 4051 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4063 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/* Check for stack overflow, if configured. */ /* Check for stack overflow, if configured. */
{ const uint32_t * const pulStack = ( uint32_t * ) xTaskGetCurrentTaskHandle()->pxStack; const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; if( ( pulStack[ 0 ] != ulCheckValue ) || ( pulStack[ 1 ] != ulCheckValue ) || ( pulStack[ 2 ] != ulCheckValue ) || ( pulStack[ 3 ] != ulCheckValue ) ) { vApplicationStackOverflowHook( ( TaskHandle_t ) xTaskGetCurrentTaskHandle(), xTaskGetCurrentTaskHandle()->pcTaskName ); } }; { const uint32_t * const pulStack = ( uint32_t * ) xTaskGetCurrentTaskHandle()->pxStack; const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; if( ( pulStack[ 0 ] != ulCheckValue ) || ( pulStack[ 1 ] != ulCheckValue ) || ( pulStack[ 2 ] != ulCheckValue ) || ( pulStack[ 3 ] != ulCheckValue ) ) { vApplicationStackOverflowHook( ( TaskHandle_t ) xTaskGetCurrentTaskHandle(), xTaskGetCurrentTaskHandle()->pcTaskName ); } };
@ -12920,7 +12948,7 @@ void vTaskSwitchContext( BaseType_t xCoreID )
; ;
/* After the new task is switched in, update the global errno. */ /* After the new task is switched in, update the global errno. */
// # 4085 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4097 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
} }
} }
vPortRecursiveLock(0, spin_lock_instance(14), ( ( BaseType_t ) 0 )); vPortRecursiveLock(0, spin_lock_instance(14), ( ( BaseType_t ) 0 ));
@ -12931,7 +12959,7 @@ void vTaskSwitchContext( BaseType_t xCoreID )
void vTaskPlaceOnEventList( List_t * const pxEventList, void vTaskPlaceOnEventList( List_t * const pxEventList,
const TickType_t xTicksToWait ) const TickType_t xTicksToWait )
{ {
(__builtin_expect(!(pxEventList), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4095, "pxEventList") : (void)0); (__builtin_expect(!(pxEventList), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4107, "pxEventList") : (void)0);
/* THIS FUNCTION MUST BE CALLED WITH EITHER INTERRUPTS DISABLED OR THE /* THIS FUNCTION MUST BE CALLED WITH EITHER INTERRUPTS DISABLED OR THE
* SCHEDULER SUSPENDED AND THE QUEUE BEING ACCESSED LOCKED. */ * SCHEDULER SUSPENDED AND THE QUEUE BEING ACCESSED LOCKED. */
@ -12950,11 +12978,11 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList,
const TickType_t xItemValue, const TickType_t xItemValue,
const TickType_t xTicksToWait ) const TickType_t xTicksToWait )
{ {
(__builtin_expect(!(pxEventList), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4114, "pxEventList") : (void)0); (__builtin_expect(!(pxEventList), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4126, "pxEventList") : (void)0);
/* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by
* the event groups implementation. */ * the event groups implementation. */
(__builtin_expect(!(uxSchedulerSuspended != 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4118, "uxSchedulerSuspended != 0") : (void)0); (__builtin_expect(!(uxSchedulerSuspended != 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4130, "uxSchedulerSuspended != 0") : (void)0);
/* Store the item value in the event list item. It is safe to access the /* Store the item value in the event list item. It is safe to access the
* event list item here as interrupts won't access the event list item of a * event list item here as interrupts won't access the event list item of a
@ -12978,7 +13006,7 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList,
TickType_t xTicksToWait, TickType_t xTicksToWait,
const BaseType_t xWaitIndefinitely ) const BaseType_t xWaitIndefinitely )
{ {
(__builtin_expect(!(pxEventList), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4142, "pxEventList") : (void)0); (__builtin_expect(!(pxEventList), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4154, "pxEventList") : (void)0);
/* This function should not be called by application code hence the /* This function should not be called by application code hence the
* 'Restricted' in its name. It is not part of the public API. It is * 'Restricted' in its name. It is not part of the public API. It is
@ -13026,14 +13054,14 @@ BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList )
* This function assumes that a check has already been made to ensure that * This function assumes that a check has already been made to ensure that
* pxEventList is not empty. */ * pxEventList is not empty. */
pxUnblockedTCB = ( ( &( ( pxEventList )->xListEnd ) )->pxNext->pvOwner ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */ pxUnblockedTCB = ( ( &( ( pxEventList )->xListEnd ) )->pxNext->pvOwner ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */
(__builtin_expect(!(pxUnblockedTCB), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4190, "pxUnblockedTCB") : (void)0); (__builtin_expect(!(pxUnblockedTCB), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4202, "pxUnblockedTCB") : (void)0);
( void ) uxListRemove( &( pxUnblockedTCB->xEventListItem ) ); ( void ) uxListRemove( &( pxUnblockedTCB->xEventListItem ) );
if( uxSchedulerSuspended == ( UBaseType_t ) ( ( BaseType_t ) 0 ) ) if( uxSchedulerSuspended == ( UBaseType_t ) ( ( BaseType_t ) 0 ) )
{ {
( void ) uxListRemove( &( pxUnblockedTCB->xStateListItem ) ); ( void ) uxListRemove( &( pxUnblockedTCB->xStateListItem ) );
; { if( ( ( pxUnblockedTCB )->uxPriority ) > uxTopReadyPriority ) { uxTopReadyPriority = ( ( pxUnblockedTCB )->uxPriority ); } }; vListInsertEnd( &( pxReadyTasksLists[ ( pxUnblockedTCB )->uxPriority ] ), &( ( pxUnblockedTCB )->xStateListItem ) ); ; ; { if( ( ( pxUnblockedTCB )->uxPriority ) > uxTopReadyPriority ) { uxTopReadyPriority = ( ( pxUnblockedTCB )->uxPriority ); } }; vListInsertEnd( &( pxReadyTasksLists[ ( pxUnblockedTCB )->uxPriority ] ), &( ( pxUnblockedTCB )->xStateListItem ) ); ;
// # 4211 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4223 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
} }
else else
{ {
@ -13063,7 +13091,7 @@ void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem,
/* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by
* the event flags implementation. */ * the event flags implementation. */
(__builtin_expect(!(uxSchedulerSuspended != ( ( BaseType_t ) 0 )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4240, "uxSchedulerSuspended != ( ( BaseType_t ) 0 )") : (void)0); (__builtin_expect(!(uxSchedulerSuspended != ( ( BaseType_t ) 0 )), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4252, "uxSchedulerSuspended != ( ( BaseType_t ) 0 )") : (void)0);
/* Store the new item value in the event list. */ /* Store the new item value in the event list. */
( ( pxEventListItem )->xItemValue = ( xItemValue | 0x80000000UL ) ); ( ( pxEventListItem )->xItemValue = ( xItemValue | 0x80000000UL ) );
@ -13071,9 +13099,9 @@ void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem,
/* Remove the event list form the event flag. Interrupts do not access /* Remove the event list form the event flag. Interrupts do not access
* event flags. */ * event flags. */
pxUnblockedTCB = ( ( pxEventListItem )->pvOwner ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */ pxUnblockedTCB = ( ( pxEventListItem )->pvOwner ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */
(__builtin_expect(!(pxUnblockedTCB), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4248, "pxUnblockedTCB") : (void)0); (__builtin_expect(!(pxUnblockedTCB), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4260, "pxUnblockedTCB") : (void)0);
( void ) uxListRemove( pxEventListItem ); ( void ) uxListRemove( pxEventListItem );
// # 4265 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4277 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/* Remove the task from the delayed list and add it to the ready list. The /* Remove the task from the delayed list and add it to the ready list. The
* scheduler is suspended so interrupts will not be accessing the ready * scheduler is suspended so interrupts will not be accessing the ready
* lists. */ * lists. */
@ -13092,7 +13120,7 @@ void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem,
void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut )
{ {
(__builtin_expect(!(pxTimeOut), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4283, "pxTimeOut") : (void)0); (__builtin_expect(!(pxTimeOut), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4295, "pxTimeOut") : (void)0);
vTaskEnterCritical(); vTaskEnterCritical();
{ {
pxTimeOut->xOverflowCount = xNumOfOverflows; pxTimeOut->xOverflowCount = xNumOfOverflows;
@ -13115,8 +13143,8 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut,
{ {
BaseType_t xReturn; BaseType_t xReturn;
(__builtin_expect(!(pxTimeOut), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4306, "pxTimeOut") : (void)0); (__builtin_expect(!(pxTimeOut), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4318, "pxTimeOut") : (void)0);
(__builtin_expect(!(pxTicksToWait), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4307, "pxTicksToWait") : (void)0); (__builtin_expect(!(pxTicksToWait), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4319, "pxTicksToWait") : (void)0);
vTaskEnterCritical(); vTaskEnterCritical();
{ {
@ -13238,7 +13266,7 @@ void vTaskMissedYield( void )
* *
* @todo additional conditional compiles to remove this function. * @todo additional conditional compiles to remove this function.
*/ */
// # 4489 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4501 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/* /*
* ----------------------------------------------------------- * -----------------------------------------------------------
* The Idle task. * The Idle task.
@ -13268,7 +13296,7 @@ static void prvIdleTask( void * pvParameters )
/* See if any tasks have deleted themselves - if so then the idle task /* See if any tasks have deleted themselves - if so then the idle task
* is responsible for freeing the deleted task's TCB and stack. */ * is responsible for freeing the deleted task's TCB and stack. */
prvCheckTasksWaitingTermination(); prvCheckTasksWaitingTermination();
// # 4530 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4542 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
{ {
/* When using preemption tasks of equal priority will be /* When using preemption tasks of equal priority will be
* timesliced. If a task that is sharing the idle priority is ready * timesliced. If a task that is sharing the idle priority is ready
@ -13289,16 +13317,16 @@ static void prvIdleTask( void * pvParameters )
; ;
} }
} }
// # 4566 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4578 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/* This conditional compilation should use inequality to 0, not equality /* This conditional compilation should use inequality to 0, not equality
* to 1. This is to ensure portSUPPRESS_TICKS_AND_SLEEP() is called when * to 1. This is to ensure portSUPPRESS_TICKS_AND_SLEEP() is called when
* user defined low power mode implementations require * user defined low power mode implementations require
* configUSE_TICKLESS_IDLE to be set to a value other than 1. */ * configUSE_TICKLESS_IDLE to be set to a value other than 1. */
// # 4631 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4643 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 4681 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4693 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -13312,7 +13340,7 @@ static void prvIdleTask( void * pvParameters )
if( xIndex < 5 ) if( xIndex < 5 )
{ {
pxTCB = ( ( ( xTaskToSet ) == 0 ) ? xTaskGetCurrentTaskHandle() : ( xTaskToSet ) ); pxTCB = ( ( ( xTaskToSet ) == 0 ) ? xTaskGetCurrentTaskHandle() : ( xTaskToSet ) );
(__builtin_expect(!(pxTCB != 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4694, "pxTCB != 0") : (void)0); (__builtin_expect(!(pxTCB != 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 4706, "pxTCB != 0") : (void)0);
pxTCB->pvThreadLocalStoragePointers[ xIndex ] = pvValue; pxTCB->pvThreadLocalStoragePointers[ xIndex ] = pvValue;
} }
} }
@ -13343,7 +13371,7 @@ static void prvIdleTask( void * pvParameters )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 4741 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4753 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvInitialiseTaskLists( void ) static void prvInitialiseTaskLists( void )
@ -13445,7 +13473,7 @@ static void prvCheckTasksWaitingTermination( void )
{ {
pxTaskStatus->uxBasePriority = pxTCB->uxBasePriority; pxTaskStatus->uxBasePriority = pxTCB->uxBasePriority;
} }
// # 4853 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 4865 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
{ {
pxTaskStatus->ulRunTimeCounter = 0; pxTaskStatus->ulRunTimeCounter = 0;
} }
@ -13576,7 +13604,7 @@ static void prvCheckTasksWaitingTermination( void )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 5022 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 5034 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -13633,7 +13661,7 @@ static void prvCheckTasksWaitingTermination( void )
free( (void*) pxTCB->pxStack); free( (void*) pxTCB->pxStack);
free( (void*) pxTCB); free( (void*) pxTCB);
} }
// # 5105 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 5117 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
} }
@ -13838,8 +13866,8 @@ static void prvResetNextTaskUnblockTime( void )
* If the mutex is held by a task then it cannot be given from an * If the mutex is held by a task then it cannot be given from an
* interrupt, and if a mutex is given by the holding task then it must * interrupt, and if a mutex is given by the holding task then it must
* be the running state task. */ * be the running state task. */
(__builtin_expect(!(pxTCB == xTaskGetCurrentTaskHandle()), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5309, "pxTCB == xTaskGetCurrentTaskHandle()") : (void)0); (__builtin_expect(!(pxTCB == xTaskGetCurrentTaskHandle()), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5321, "pxTCB == xTaskGetCurrentTaskHandle()") : (void)0);
(__builtin_expect(!(pxTCB->uxMutexesHeld), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5310, "pxTCB->uxMutexesHeld") : (void)0); (__builtin_expect(!(pxTCB->uxMutexesHeld), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5322, "pxTCB->uxMutexesHeld") : (void)0);
( pxTCB->uxMutexesHeld )--; ( pxTCB->uxMutexesHeld )--;
/* Has the holder of the mutex inherited the priority of another /* Has the holder of the mutex inherited the priority of another
@ -13925,7 +13953,7 @@ static void prvResetNextTaskUnblockTime( void )
{ {
/* If pxMutexHolder is not NULL then the holder must hold at least /* If pxMutexHolder is not NULL then the holder must hold at least
* one mutex. */ * one mutex. */
(__builtin_expect(!(pxTCB->uxMutexesHeld), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5396, "pxTCB->uxMutexesHeld") : (void)0); (__builtin_expect(!(pxTCB->uxMutexesHeld), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5408, "pxTCB->uxMutexesHeld") : (void)0);
/* Determine the priority to which the priority of the task that /* Determine the priority to which the priority of the task that
* holds the mutex should be set. This will be the greater of the * holds the mutex should be set. This will be the greater of the
@ -13952,7 +13980,7 @@ static void prvResetNextTaskUnblockTime( void )
/* If a task has timed out because it already holds the /* If a task has timed out because it already holds the
* mutex it was trying to obtain then it cannot of inherited * mutex it was trying to obtain then it cannot of inherited
* its own priority. */ * its own priority. */
(__builtin_expect(!(pxTCB != xTaskGetCurrentTaskHandle()), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5423, "pxTCB != xTaskGetCurrentTaskHandle()") : (void)0); (__builtin_expect(!(pxTCB != xTaskGetCurrentTaskHandle()), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5435, "pxTCB != xTaskGetCurrentTaskHandle()") : (void)0);
/* Disinherit the priority, remembering the previous /* Disinherit the priority, remembering the previous
* priority to facilitate determining the subject task's * priority to facilitate determining the subject task's
@ -14083,7 +14111,7 @@ void vTaskYieldWithinAPI( void )
{ {
/* If pxCurrentTCB->uxCriticalNesting is zero then this function /* If pxCurrentTCB->uxCriticalNesting is zero then this function
* does not match a previous call to vTaskEnterCritical(). */ * does not match a previous call to vTaskEnterCritical(). */
(__builtin_expect(!(xTaskGetCurrentTaskHandle()->uxCriticalNesting > 0U), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5554, "xTaskGetCurrentTaskHandle()->uxCriticalNesting > 0U") : (void)0); (__builtin_expect(!(xTaskGetCurrentTaskHandle()->uxCriticalNesting > 0U), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5566, "xTaskGetCurrentTaskHandle()->uxCriticalNesting > 0U") : (void)0);
if( xTaskGetCurrentTaskHandle()->uxCriticalNesting > 0U ) if( xTaskGetCurrentTaskHandle()->uxCriticalNesting > 0U )
{ {
@ -14133,11 +14161,11 @@ void vTaskYieldWithinAPI( void )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 5630 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 5642 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 5736 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 5748 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*----------------------------------------------------------*/ /*----------------------------------------------------------*/
// # 5863 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 5875 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
TickType_t uxTaskResetEventItemValue( void ) TickType_t uxTaskResetEventItemValue( void )
@ -14179,7 +14207,7 @@ TickType_t uxTaskResetEventItemValue( void )
{ {
uint32_t ulReturn; uint32_t ulReturn;
(__builtin_expect(!(uxIndexToWait < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5904, "uxIndexToWait < 1") : (void)0); (__builtin_expect(!(uxIndexToWait < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5916, "uxIndexToWait < 1") : (void)0);
vTaskEnterCritical(); vTaskEnterCritical();
{ {
@ -14253,7 +14281,7 @@ TickType_t uxTaskResetEventItemValue( void )
{ {
BaseType_t xReturn; BaseType_t xReturn;
(__builtin_expect(!(uxIndexToWait < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5978, "uxIndexToWait < 1") : (void)0); (__builtin_expect(!(uxIndexToWait < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 5990, "uxIndexToWait < 1") : (void)0);
vTaskEnterCritical(); vTaskEnterCritical();
{ {
@ -14341,8 +14369,8 @@ TickType_t uxTaskResetEventItemValue( void )
BaseType_t xReturn = ( ( ( BaseType_t ) 1 ) ); BaseType_t xReturn = ( ( ( BaseType_t ) 1 ) );
uint8_t ucOriginalNotifyState; uint8_t ucOriginalNotifyState;
(__builtin_expect(!(uxIndexToNotify < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6066, "uxIndexToNotify < 1") : (void)0); (__builtin_expect(!(uxIndexToNotify < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6078, "uxIndexToNotify < 1") : (void)0);
(__builtin_expect(!(xTaskToNotify), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6067, "xTaskToNotify") : (void)0); (__builtin_expect(!(xTaskToNotify), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6079, "xTaskToNotify") : (void)0);
pxTCB = xTaskToNotify; pxTCB = xTaskToNotify;
vTaskEnterCritical(); vTaskEnterCritical();
@ -14395,7 +14423,7 @@ TickType_t uxTaskResetEventItemValue( void )
/* Should not get here if all enums are handled. /* Should not get here if all enums are handled.
* Artificially force an assert by testing a value the * Artificially force an assert by testing a value the
* compiler can't assume is const. */ * compiler can't assume is const. */
(__builtin_expect(!(xTickCount == ( TickType_t ) 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6120, "xTickCount == ( TickType_t ) 0") : (void)0); (__builtin_expect(!(xTickCount == ( TickType_t ) 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6132, "xTickCount == ( TickType_t ) 0") : (void)0);
break; break;
} }
@ -14410,8 +14438,8 @@ TickType_t uxTaskResetEventItemValue( void )
; { if( ( ( pxTCB )->uxPriority ) > uxTopReadyPriority ) { uxTopReadyPriority = ( ( pxTCB )->uxPriority ); } }; vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); ; ; { if( ( ( pxTCB )->uxPriority ) > uxTopReadyPriority ) { uxTopReadyPriority = ( ( pxTCB )->uxPriority ); } }; vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); ;
/* The task should not have been on an event list. */ /* The task should not have been on an event list. */
(__builtin_expect(!(( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6135, "( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0") : (void)0); (__builtin_expect(!(( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6147, "( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0") : (void)0);
// # 6154 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 6166 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
{ {
prvYieldForTask( pxTCB, ( ( BaseType_t ) 0 ) ); prvYieldForTask( pxTCB, ( ( BaseType_t ) 0 ) );
} }
@ -14444,8 +14472,8 @@ TickType_t uxTaskResetEventItemValue( void )
BaseType_t xReturn = ( ( ( BaseType_t ) 1 ) ); BaseType_t xReturn = ( ( ( BaseType_t ) 1 ) );
UBaseType_t uxSavedInterruptStatus; UBaseType_t uxSavedInterruptStatus;
(__builtin_expect(!(xTaskToNotify), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6186, "xTaskToNotify") : (void)0); (__builtin_expect(!(xTaskToNotify), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6198, "xTaskToNotify") : (void)0);
(__builtin_expect(!(uxIndexToNotify < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6187, "uxIndexToNotify < 1") : (void)0); (__builtin_expect(!(uxIndexToNotify < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6199, "uxIndexToNotify < 1") : (void)0);
/* RTOS ports that support interrupt nesting have the concept of a /* RTOS ports that support interrupt nesting have the concept of a
* maximum system call (or maximum API call) interrupt priority. * maximum system call (or maximum API call) interrupt priority.
@ -14516,7 +14544,7 @@ TickType_t uxTaskResetEventItemValue( void )
/* Should not get here if all enums are handled. /* Should not get here if all enums are handled.
* Artificially force an assert by testing a value the * Artificially force an assert by testing a value the
* compiler can't assume is const. */ * compiler can't assume is const. */
(__builtin_expect(!(xTickCount == ( TickType_t ) 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6258, "xTickCount == ( TickType_t ) 0") : (void)0); (__builtin_expect(!(xTickCount == ( TickType_t ) 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6270, "xTickCount == ( TickType_t ) 0") : (void)0);
break; break;
} }
@ -14527,7 +14555,7 @@ TickType_t uxTaskResetEventItemValue( void )
if( ucOriginalNotifyState == ( ( uint8_t ) 1 ) ) if( ucOriginalNotifyState == ( ( uint8_t ) 1 ) )
{ {
/* The task should not have been on an event list. */ /* The task should not have been on an event list. */
(__builtin_expect(!(( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6269, "( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0") : (void)0); (__builtin_expect(!(( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6281, "( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0") : (void)0);
if( uxSchedulerSuspended == ( UBaseType_t ) ( ( BaseType_t ) 0 ) ) if( uxSchedulerSuspended == ( UBaseType_t ) ( ( BaseType_t ) 0 ) )
{ {
@ -14572,8 +14600,8 @@ TickType_t uxTaskResetEventItemValue( void )
uint8_t ucOriginalNotifyState; uint8_t ucOriginalNotifyState;
UBaseType_t uxSavedInterruptStatus; UBaseType_t uxSavedInterruptStatus;
(__builtin_expect(!(xTaskToNotify), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6314, "xTaskToNotify") : (void)0); (__builtin_expect(!(xTaskToNotify), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6326, "xTaskToNotify") : (void)0);
(__builtin_expect(!(uxIndexToNotify < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6315, "uxIndexToNotify < 1") : (void)0); (__builtin_expect(!(uxIndexToNotify < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6327, "uxIndexToNotify < 1") : (void)0);
/* RTOS ports that support interrupt nesting have the concept of a /* RTOS ports that support interrupt nesting have the concept of a
* maximum system call (or maximum API call) interrupt priority. * maximum system call (or maximum API call) interrupt priority.
@ -14611,7 +14639,7 @@ TickType_t uxTaskResetEventItemValue( void )
if( ucOriginalNotifyState == ( ( uint8_t ) 1 ) ) if( ucOriginalNotifyState == ( ( uint8_t ) 1 ) )
{ {
/* The task should not have been on an event list. */ /* The task should not have been on an event list. */
(__builtin_expect(!(( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6353, "( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0") : (void)0); (__builtin_expect(!(( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6365, "( ( &( pxTCB->xEventListItem ) )->pxContainer ) == 0") : (void)0);
if( uxSchedulerSuspended == ( UBaseType_t ) ( ( BaseType_t ) 0 ) ) if( uxSchedulerSuspended == ( UBaseType_t ) ( ( BaseType_t ) 0 ) )
{ {
@ -14652,7 +14680,7 @@ TickType_t uxTaskResetEventItemValue( void )
TCB_t * pxTCB; TCB_t * pxTCB;
BaseType_t xReturn; BaseType_t xReturn;
(__builtin_expect(!(uxIndexToClear < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6394, "uxIndexToClear < 1") : (void)0); (__builtin_expect(!(uxIndexToClear < 1), 0) ? __assert_rtn ((const char *)-1L, "tasks.c", 6406, "uxIndexToClear < 1") : (void)0);
/* If null is passed in here then it is the calling task that is having /* If null is passed in here then it is the calling task that is having
* its notification state cleared. */ * its notification state cleared. */
@ -14705,7 +14733,7 @@ TickType_t uxTaskResetEventItemValue( void )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
// # 6463 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 6475 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
@ -14781,7 +14809,7 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
} }
} }
} }
// # 6575 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c" // # 6587 "/Users/reitobia/repos2/FreeRTOS-Kernel/tasks.c"
} }
/* Code below here allows additional code to be inserted into this source file, /* Code below here allows additional code to be inserted into this source file,

View file

@ -0,0 +1,19 @@
#ifndef VERIFAST_RP2040_AXIOMS_H
#define VERIFAST_RP2040_AXIOMS_H
#include "stdint.h"
/*
* The lemmas in this file axiomatize that the RP2040 architecture uses
* 32bit pointers.
*/
/*@
// Axiomatizes that: 0 <= ptr <= 2^32 - 1
lemma void uint32_t_ptr_range(uint32_t* ptr);
requires true;
ensures 0 <= (int) ptr &*& (int) ptr <= 4294967295;
@*/
#endif