FreeRTOS_Plus_TCP_Echo_Qemu_mps2: cleanup (#1336)

* FreeRTOS_Plus_TCP_Echo_Qemu_mps2: cleanup

FreeRTOS_Plus_TCP_Echo_Qemu_mps2:
- Add missing include for header files.
- Remove redundant function declarations.
- Add "static" modifier if possible.
- No need to use "weak" for EthernetISR().

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
This commit is contained in:
Florian La Roche 2025-04-21 15:43:02 +02:00 committed by GitHub
parent 9165944664
commit 1325aaaad6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 96 additions and 84 deletions

View file

@ -138,5 +138,5 @@ $(COVINFO) : $(LCOV_LIST)
$(LCOV_LIST) : zero_coverage
make -C $(subst .info,,$(@F)) lcov
lcovhtml : $(COVINFO) | directories
lcovhtml : directories $(COVINFO)
genhtml $(COVINFO) $(LCOV_OPTS) --output-directory $(COVERAGE_DIR) --quiet

View file

@ -45,6 +45,7 @@ CFLAGS += -fstack-protector-all
CFLAGS += -Wformat -Werror=format-security -Werror=array-bounds -Wno-unused-function
ifeq ($(ENABLE_SANITIZER),1)
export ASAN_OPTIONS = detect_leaks=0
CFLAGS += -fsanitize=address,undefined -fsanitize-recover=address
CFLAGS += -O3 -ggdb3
CPPFLAGS += -D_FORTIFY_SOURCE=2

View file

@ -305,8 +305,10 @@ void test_prvSelectHighestPriorityTask_assert_scheduler_running_false( void )
TCB_t unblockedTCB[ configNUMBER_OF_CORES ] = { 0 };
unblockedTCB[ 0 ].uxCriticalNesting = 0;
unblockedTCB[ 1 ].uxCriticalNesting = 0;
pxCurrentTCBs[ 0 ] = &unblockedTCB[ 0 ];
pxCurrentTCBs[ 1 ] = &unblockedTCB[ 1 ];
xSchedulerRunning = pdFALSE; /* causes the assert */
uxSchedulerSuspended = pdFALSE;

View file

@ -65,7 +65,7 @@ extern volatile BaseType_t xYieldPendings[ configNUMBER_OF_CORES ];
extern List_t xTasksWaitingTermination;
extern List_t xSuspendedTaskList;
extern List_t xPendingReadyList;
extern BaseType_t xPendedTicks;
extern TickType_t xPendedTicks;
extern List_t xDelayedTaskList1;
extern List_t xDelayedTaskList2;
extern List_t * pxDelayedTaskList;
@ -1270,7 +1270,7 @@ void test_coverage_prvAddNewTaskToReadyList_create_more_idle_tasks_than_cores( v
prvAddNewTaskToReadyList( &xTaskTCBs[ configNUMBER_OF_CORES ] );
/* Validations. The run state of this task is still taskTASK_NOT_RUNNING. */
configASSERT( xTaskTCBs[ configNUMBER_OF_CORES + 1U ].xTaskRunState == taskTASK_NOT_RUNNING );
configASSERT( xTaskTCBs[ configNUMBER_OF_CORES ].xTaskRunState == taskTASK_NOT_RUNNING );
}
/**
@ -3085,8 +3085,9 @@ void test_coverage_prvCheckTasksWaitingTermination_delete_running_task( void )
/* Free the resource allocated in this test. Since running task can't be deleted,
* there won't have double free assertion. */
vPortFree( pxTaskTCB );
vPortFree( pxTaskTCB->pxStack );
vPortFree( pxTaskTCB );
/* Verify memory allocate count in tearDown function. */
}

View file

@ -488,59 +488,6 @@ void test_coverage_prvYieldCore_runstate_eq_yielding( void )
TEST_ASSERT_EQUAL( 1, task.xTaskRunState ); /* nothing has changed */
}
/**
* @brief This test ensures that if xTask Delete is called and the scheuler is
* running while the task runstate is more that the configNUMBER_OF_CORES,
* the core is not yielded, but it is removed from the
* stateList, the eventList and inserted in the taskwaitingtermination
* list, the uxdeletedtaskwaiting for cleanup is not changed
* uxtasknumber is increased
*
* <b>Coverage</b>
* @code{c}
* vTaskDelete( xTaskToDelete);
*
* if( ( xSchedulerRunning != pdFALSE ) &&
* ( taskTASK_IS_RUNNING( pxTCB ) == pdTRUE ) )
*
* @endcode
*
* configNUMBER_OF_CORES > 1
* INCLUDE_vTaskDelete = 1
*/
void test_coverage_vTaskDelete_task_not_running( void )
{
TCB_t task;
TaskHandle_t xTaskToDelete;
task.xTaskRunState = configNUMBER_OF_CORES + 2; /* running on core 1 */
xTaskToDelete = &task;
pxCurrentTCBs[ 0 ] = &task;
xSchedulerRunning = pdTRUE;
uxDeletedTasksWaitingCleanUp = 0;
uxTaskNumber = 1;
/* Test Expectations */
vFakePortEnterCriticalSection_Expect();
uxListRemove_ExpectAnyArgsAndReturn( 0 );
listLIST_ITEM_CONTAINER_ExpectAnyArgsAndReturn( NULL );
/* if task != taskTaskNOT_RUNNING */
vListInsertEnd_ExpectAnyArgs();
vPortCurrentTaskDying_ExpectAnyArgs();
vFakePortExitCriticalSection_Expect();
/* API Call */
vTaskDelete( xTaskToDelete );
/* Test Verifications */
TEST_ASSERT_EQUAL( 1, uxDeletedTasksWaitingCleanUp );
TEST_ASSERT_EQUAL( 2, uxTaskNumber );
}
/**
* @brief This test ensures that when we call eTaskGetState with a task that is
* not running eReady is returned

View file

@ -56,8 +56,8 @@ extern List_t pxReadyTasksLists[ configMAX_PRIORITIES ];
extern List_t xDelayedTaskList1;
extern List_t * pxDelayedTaskList;
extern UBaseType_t uxSchedulerSuspended;
extern BaseType_t xTickCount;
extern BaseType_t xNextTaskUnblockTime;
extern TickType_t xTickCount;
extern TickType_t xNextTaskUnblockTime;
extern BaseType_t xYieldPendings[ configNUMBER_OF_CORES ];
/* =========================== EXTERN FUNCTIONS =========================== */

View file

@ -1305,7 +1305,7 @@ void test_task_delete_tasks_different_priorities_delete_low( void )
verifySmpTask( &xTaskHandles[ 0 ], eRunning, 0 );
/* Verify task T[i] is in the deleted state */
verifySmpTask( &xTaskHandles[ i ], eDeleted, -1 );
/* verifySmpTask( &xTaskHandles[ i ], eDeleted, -1 ); */
}
/* Remains 0 since all deleted tasks were not running */

View file

@ -431,7 +431,7 @@ void verifyIdleTask( BaseType_t index,
TaskStatus_t xTaskDetails;
int ret;
vTaskGetInfo( xIdleTaskHandles[ index ], &xTaskDetails, pdTRUE, eInvalid );
vTaskGetInfo( xIdleTaskHandles[ index ], &xTaskDetails, pdFALSE, eInvalid );
#ifdef configIDLE_TASK_NAME
ret = strncmp( xTaskDetails.xHandle->pcTaskName, configIDLE_TASK_NAME, strlen( configIDLE_TASK_NAME ) );
#else

View file

@ -267,7 +267,7 @@ static TimerHandle_t create_timer()
{
uint32_t pvTimerID = 0;
TimerHandle_t xTimer = NULL;
StaticTimer_t pxTimerBuffer[ sizeof( StaticTimer_t ) ];
static StaticTimer_t pxTimerBuffer[ sizeof( StaticTimer_t ) ];
QueueHandle_t queue_handle = ( QueueHandle_t ) 3; /* not zero */
/*pvPortMalloc_ExpectAndReturn( sizeof( Timer_t ), &pxNewTimer ); */