From 4a2a9db1859e098a42dcdf9eb3b6de7fdb32532a Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Tue, 6 Aug 2024 17:52:01 +0800 Subject: [PATCH] Update for v4 test --- FreeRTOS/Source | 2 +- .../Test/Target/boards/pico/FreeRTOSConfig.h | 1 + .../Target/tests/smp/crit_speed/crit_speed.c | 12 +++++---- .../lock_contention_end_to_end.c | 26 ++++++++++--------- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/FreeRTOS/Source b/FreeRTOS/Source index 83e7e8ae3ad..6991eb09ba6 160000 --- a/FreeRTOS/Source +++ b/FreeRTOS/Source @@ -1 +1 @@ -Subproject commit 83e7e8ae3ad7a7fd8cc036c0b16be5b35df66bf5 +Subproject commit 6991eb09ba66e258c3f035f1062519edabd78f31 diff --git a/FreeRTOS/Test/Target/boards/pico/FreeRTOSConfig.h b/FreeRTOS/Test/Target/boards/pico/FreeRTOSConfig.h index e7ddf394f3c..29a789b137f 100644 --- a/FreeRTOS/Test/Target/boards/pico/FreeRTOSConfig.h +++ b/FreeRTOS/Test/Target/boards/pico/FreeRTOSConfig.h @@ -106,6 +106,7 @@ #define configRUN_MULTIPLE_PRIORITIES 1 #define configUSE_CORE_AFFINITY 1 #define configUSE_PASSIVE_IDLE_HOOK 0 +#define configUSE_MINIMAL_IDLE_HOOK 0 #define configUSE_TASK_PREEMPTION_DISABLE 1 /* RP2040 specific */ diff --git a/FreeRTOS/Test/Target/tests/smp/crit_speed/crit_speed.c b/FreeRTOS/Test/Target/tests/smp/crit_speed/crit_speed.c index e48fc6400a8..793cce30438 100644 --- a/FreeRTOS/Test/Target/tests/smp/crit_speed/crit_speed.c +++ b/FreeRTOS/Test/Target/tests/smp/crit_speed/crit_speed.c @@ -43,7 +43,7 @@ * Test macros to be defined by each port */ #define portTEST_GET_TIME() ( ( UBaseType_t ) esp_cpu_get_cycle_count() ) - #define portTEST_NUM_SAMPLES 128 + #define portTEST_NUM_SAMPLES 2048 /*-----------------------------------------------------------*/ #endif /* UPSTREAM_BUILD */ @@ -83,17 +83,19 @@ static void Test_CriticalSectionSpeed( void ) { /* Test taskENTER_CRITICAL() elapsed time */ uxTemp = portTEST_GET_TIME(); - taskENTER_CRITICAL(); + + vTaskEnterCritical(); uxEntryElapsedCumulative += ( portTEST_GET_TIME() - uxTemp ); /* Test taskEXIT_CRITICAL elapsed time */ uxTemp = portTEST_GET_TIME(); - taskEXIT_CRITICAL(); + + vTaskExitCritical(); uxExitElapsedCumulative += ( portTEST_GET_TIME() - uxTemp ); } - printf( "taskENTER_CRITICAL() average elapsed time: %u\n", uxEntryElapsedCumulative / portTEST_NUM_SAMPLES ); - printf( "taskEXIT_CRITICAL() average elapsed time: %u\n", uxExitElapsedCumulative / portTEST_NUM_SAMPLES ); + printf( "taskENTER_CRITICAL() accumulated elapsed time: %u\n", uxEntryElapsedCumulative ); + printf( "taskEXIT_CRITICAL() accumulated elapsed time: %u\n", uxExitElapsedCumulative ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Test/Target/tests/smp/lock_contention_end_to_end/lock_contention_end_to_end.c b/FreeRTOS/Test/Target/tests/smp/lock_contention_end_to_end/lock_contention_end_to_end.c index d719f5772b9..4127b5f796b 100644 --- a/FreeRTOS/Test/Target/tests/smp/lock_contention_end_to_end/lock_contention_end_to_end.c +++ b/FreeRTOS/Test/Target/tests/smp/lock_contention_end_to_end/lock_contention_end_to_end.c @@ -67,9 +67,11 @@ #endif /* UPSTREAM_BUILD */ #if ( configNUMBER_OF_CORES < 2 ) - #error This test is for FreeRTOS SMP and therefore, requires at least 2 cores. + // #error This test is for FreeRTOS SMP and therefore, requires at least 2 cores. #endif /* if configNUMBER_OF_CORES != 2 */ +#define testNUMBER_OF_CORES 2 + #if ( configRUN_MULTIPLE_PRIORITIES != 1 ) #error configRUN_MULTIPLE_PRIORITIES must be set to 1 for this test. #endif /* if ( configRUN_MULTIPLE_PRIORITIES != 1 ) */ @@ -104,31 +106,31 @@ static void prvConsumerTask( void * pvParameters ); /** * @brief Handles of the queues accessed by each core */ -static QueueHandle_t xQueueHandles[ configNUMBER_OF_CORES ]; +static QueueHandle_t xQueueHandles[ testNUMBER_OF_CORES ]; /*-----------------------------------------------------------*/ /** * @brief Handles of the producer tasks created for each core */ -static TaskHandle_t xProducerTaskHandles[ configNUMBER_OF_CORES ]; +static TaskHandle_t xProducerTaskHandles[ testNUMBER_OF_CORES ]; /*-----------------------------------------------------------*/ /** * @brief Handles of the consumer tasks created for each core */ -static TaskHandle_t xConsumerTaskHandles[ configNUMBER_OF_CORES ]; +static TaskHandle_t xConsumerTaskHandles[ testNUMBER_OF_CORES ]; /*-----------------------------------------------------------*/ /** * @brief Start times of each iteration for each core */ -static UBaseType_t uxStartTimes[ configNUMBER_OF_CORES ]; +static UBaseType_t uxStartTimes[ testNUMBER_OF_CORES ]; /*-----------------------------------------------------------*/ /** * @brief Cumulative elapsed time of all iterations for each core */ -static UBaseType_t uxElapsedCumulative[ configNUMBER_OF_CORES ]; +static UBaseType_t uxElapsedCumulative[ testNUMBER_OF_CORES ]; /*-----------------------------------------------------------*/ /** @@ -203,7 +205,7 @@ static void Test_LockContentionEndToEnd( void ) /* Run test for portTEST_NUM_SAMPLES number of iterations */ for( iIter = 0; iIter < portTEST_NUM_SAMPLES; iIter++ ) { - for( iCore = 0; iCore < configNUMBER_OF_CORES; iCore++ ) + for( iCore = 0; iCore < testNUMBER_OF_CORES; iCore++ ) { /* Start the consumer task, which in turn starts the producer task. * Start them on the other cores first so that we don't get @@ -217,7 +219,7 @@ static void Test_LockContentionEndToEnd( void ) xTaskNotifyGive( xConsumerTaskHandles[ portGET_CORE_ID() ] ); /* Wait until both cores have completed this iteration */ - for( iCore = 0; iCore < configNUMBER_OF_CORES; iCore++ ) + for( iCore = 0; iCore < testNUMBER_OF_CORES; iCore++ ) { xSemaphoreTake( xIterDoneSem, portMAX_DELAY ); } @@ -225,7 +227,7 @@ static void Test_LockContentionEndToEnd( void ) /* Print average results */ printf("Time taken to send %d items, averaged over %d samples\n", portTEST_NUM_ITEMS, portTEST_NUM_SAMPLES); - for( iCore = 0; iCore < configNUMBER_OF_CORES; iCore++ ) + for( iCore = 0; iCore < testNUMBER_OF_CORES; iCore++ ) { printf("Core %d: %d\n", iCore, ( uxElapsedCumulative[ iCore ] / portTEST_NUM_SAMPLES ) ); } @@ -242,11 +244,11 @@ static void Test_LockContentionEndToEnd( void ) int i; /* Create counting semaphore to indicate iteration completion */ - xIterDoneSem = xSemaphoreCreateCounting( configNUMBER_OF_CORES, 0 ); + xIterDoneSem = xSemaphoreCreateCounting( testNUMBER_OF_CORES, 0 ); TEST_ASSERT_NOT_NULL_MESSAGE( xIterDoneSem, "Failed to create counting semaphore"); /* Create separate queues and tasks for each core */ - for( i = 0; i < configNUMBER_OF_CORES; i++ ) + for( i = 0; i < testNUMBER_OF_CORES; i++ ) { BaseType_t xRet; @@ -291,7 +293,7 @@ static void Test_LockContentionEndToEnd( void ) vSemaphoreDelete( xIterDoneSem ); /* Delete tasks and queues */ - for( i = 0; i < configNUMBER_OF_CORES; i++ ) + for( i = 0; i < testNUMBER_OF_CORES; i++ ) { vTaskDelete( xProducerTaskHandles[ i ] ); vTaskDelete( xConsumerTaskHandles[ i ] );