From d603c9b1ba39a5f1c1ce8ea42397c72cc5bfcaa3 Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Wed, 24 Jan 2024 19:34:14 +0800 Subject: [PATCH 01/21] Update for vTaskSuspend SMP unit test (#1160) --- .../smp/config_assert/config_assert_utest.c | 34 ++++++++++++++----- ...tiple_priorities_no_timeslice_mock_utest.c | 12 +++++++ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c b/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c index a99773c53d..58a524b1c1 100644 --- a/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c +++ b/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c @@ -410,19 +410,27 @@ void test_vTaskDelete_assert_scheduler_suspended_eq_1( void ) } /** - * @brief This test ensures that the code asserts when a task is suspended while - * the scheduler is suspended + * @brief vTaskSuspend - scheduler suspended assertion. + * + * This test ensures that the code asserts when a task is suspended while + * the scheduler is suspended * * Coverage * @code{c} - * vTaskDelete( xTaskToDelete ); - * - * configASSERT( uxSchedulerSuspended == 0 ); - * + * if( xSchedulerRunning != pdFALSE ) + * { + * if( pxTCB->xTaskRunState == ( BaseType_t ) portGET_CORE_ID() ) + * { + * configASSERT( uxSchedulerSuspended == 0 ); + * vTaskYieldWithinAPI(); + * } + * else + * { + * prvYieldCore( pxTCB->xTaskRunState ); + * } + * } * @endcode - * - * configNUMBER_OF_CORES > 1 - * INCLUDE_vTaskSuspend + * configASSERT( uxSchedulerSuspended == 0 ) is triggered. */ void test_vTaskSuspend_assert_schedulersuspended_ne_zero( void ) { @@ -438,7 +446,15 @@ void test_vTaskSuspend_assert_schedulersuspended_ne_zero( void ) uxListRemove_ExpectAnyArgsAndReturn( pdTRUE ); listLIST_ITEM_CONTAINER_ExpectAnyArgsAndReturn( NULL ); vListInsertEnd_ExpectAnyArgs(); + vFakePortExitCriticalSection_Expect(); + + /* Reset the next expected unblock time if scheduler is running. */ + vFakePortEnterCriticalSection_Expect(); listLIST_IS_EMPTY_ExpectAnyArgsAndReturn( pdTRUE ); + vFakePortExitCriticalSection_Expect(); + + /* Check task run state in critical section. */ + vFakePortEnterCriticalSection_Expect(); vFakePortGetCoreID_ExpectAndReturn( 1 ); EXPECT_ASSERT_BREAK( vTaskSuspend( xTaskToSuspend ) ); diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c index 06e0613791..b238ad1e7f 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c @@ -239,6 +239,10 @@ void test_coverage_vTaskSuspend_scheduler_running_false( void ) vListInsertEnd_ExpectAnyArgs(); vFakePortExitCriticalSection_Expect(); + /* Enter critical section to check task run state. */ + vFakePortEnterCriticalSection_Expect(); + vFakePortExitCriticalSection_Expect(); + /* API call. */ vTaskSuspend( &xTaskTCBs[ 0 ] ); @@ -277,6 +281,10 @@ void test_coverage_vTaskSuspend_running_state_below_range( void ) vListInsertEnd_ExpectAnyArgs(); vFakePortExitCriticalSection_Expect(); + /* Enter critical section to check task run state. */ + vFakePortEnterCriticalSection_Expect(); + vFakePortExitCriticalSection_Expect(); + /* API call. */ vTaskSuspend( &xTaskTCBs[ 0 ] ); @@ -314,6 +322,10 @@ void test_coverage_vTaskSuspend_running_state_above_range( void ) vListInsertEnd_ExpectAnyArgs(); vFakePortExitCriticalSection_Expect(); + /* Enter critical section to check task run state. */ + vFakePortEnterCriticalSection_Expect(); + vFakePortExitCriticalSection_Expect(); + /* API call. */ vTaskSuspend( &xTaskTCBs[ 0 ] ); From c852aaeeeb42fae4e8de7f83bbb1c9b6e4e0b871 Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:55:40 +0800 Subject: [PATCH 02/21] Update kernel submodule for vTaskSuspend change (#1161) --- FreeRTOS/Source | 2 +- manifest.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FreeRTOS/Source b/FreeRTOS/Source index cf2366c949..72c7d86276 160000 --- a/FreeRTOS/Source +++ b/FreeRTOS/Source @@ -1 +1 @@ -Subproject commit cf2366c949735eec9c5eee83b5909bb913cd1679 +Subproject commit 72c7d862762425832d9fce2df7b03d2ad355cb1e diff --git a/manifest.yml b/manifest.yml index 8240ff67b8..5a4576f06b 100644 --- a/manifest.yml +++ b/manifest.yml @@ -5,7 +5,7 @@ license: "MIT" dependencies: - name: "FreeRTOS-Kernel" - version: "cf2366c" + version: "72c7d86" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git" From 7fc12c29f3416acf433a74465ded70a0d4d822cb Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Fri, 26 Jan 2024 19:51:49 -0500 Subject: [PATCH 03/21] Update FreeRTOS and AWS Library Submodules (#1162) * Update the AWS and FreeRTOS Library Submodule Pointers * Update the manifest.yml file for new submodules --- FreeRTOS-Plus/Source/AWS/device-defender | 2 +- FreeRTOS-Plus/Source/AWS/device-shadow | 2 +- FreeRTOS-Plus/Source/AWS/fleet-provisioning | 2 +- FreeRTOS-Plus/Source/AWS/jobs | 2 +- FreeRTOS-Plus/Source/AWS/ota | 2 +- FreeRTOS-Plus/Source/AWS/sigv4 | 2 +- .../Source/Application-Protocols/coreHTTP | 2 +- .../Source/Application-Protocols/coreMQTT | 2 +- .../Application-Protocols/coreMQTT-Agent | 2 +- .../Source/Application-Protocols/coreSNTP | 2 +- .../Source/FreeRTOS-Cellular-Interface | 2 +- .../Source/FreeRTOS-Cellular-Modules/bg96 | 2 +- .../Source/FreeRTOS-Cellular-Modules/sara-r4 | 2 +- FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP | 2 +- .../Source/Utilities/backoff_algorithm | 2 +- FreeRTOS-Plus/Source/coreJSON | 2 +- FreeRTOS-Plus/Source/corePKCS11 | 2 +- .../Demo/ThirdParty/Community-Supported-Demos | 2 +- .../Demo/ThirdParty/Partner-Supported-Demos | 2 +- FreeRTOS/Source | 2 +- manifest.yml | 40 +++++++++---------- 21 files changed, 40 insertions(+), 40 deletions(-) diff --git a/FreeRTOS-Plus/Source/AWS/device-defender b/FreeRTOS-Plus/Source/AWS/device-defender index 747ae050e1..9dbf7ba0d4 160000 --- a/FreeRTOS-Plus/Source/AWS/device-defender +++ b/FreeRTOS-Plus/Source/AWS/device-defender @@ -1 +1 @@ -Subproject commit 747ae050e1d22682c8c757fff48dba2760094505 +Subproject commit 9dbf7ba0d4bae6c8cabdb7732289942f5a23507c diff --git a/FreeRTOS-Plus/Source/AWS/device-shadow b/FreeRTOS-Plus/Source/AWS/device-shadow index 0c17830735..2f16e7c12d 160000 --- a/FreeRTOS-Plus/Source/AWS/device-shadow +++ b/FreeRTOS-Plus/Source/AWS/device-shadow @@ -1 +1 @@ -Subproject commit 0c17830735d83fe1e399af056820de0f4666f43c +Subproject commit 2f16e7c12d9a585d2aa9071e53ed8a346d076005 diff --git a/FreeRTOS-Plus/Source/AWS/fleet-provisioning b/FreeRTOS-Plus/Source/AWS/fleet-provisioning index 8ce2b28325..daf174d3b9 160000 --- a/FreeRTOS-Plus/Source/AWS/fleet-provisioning +++ b/FreeRTOS-Plus/Source/AWS/fleet-provisioning @@ -1 +1 @@ -Subproject commit 8ce2b28325efb917c2e357aed2361e3fa6162ecf +Subproject commit daf174d3b934d550492e775650137b8bb1b63545 diff --git a/FreeRTOS-Plus/Source/AWS/jobs b/FreeRTOS-Plus/Source/AWS/jobs index 3e33c6a0ee..f1c3bd6829 160000 --- a/FreeRTOS-Plus/Source/AWS/jobs +++ b/FreeRTOS-Plus/Source/AWS/jobs @@ -1 +1 @@ -Subproject commit 3e33c6a0eeaebb820a445a3d4b1a02896b3e557d +Subproject commit f1c3bd68298a9c997f1709f48e61ca3f22dc8ed0 diff --git a/FreeRTOS-Plus/Source/AWS/ota b/FreeRTOS-Plus/Source/AWS/ota index 0c46d6a6f7..9a8395beaf 160000 --- a/FreeRTOS-Plus/Source/AWS/ota +++ b/FreeRTOS-Plus/Source/AWS/ota @@ -1 +1 @@ -Subproject commit 0c46d6a6f77414ed8d8a383d1a04d93dcc7e0f5c +Subproject commit 9a8395beaf52cfe5335f9a3b760b6e6743d0991e diff --git a/FreeRTOS-Plus/Source/AWS/sigv4 b/FreeRTOS-Plus/Source/AWS/sigv4 index 1e692f74f1..9d9f95a95a 160000 --- a/FreeRTOS-Plus/Source/AWS/sigv4 +++ b/FreeRTOS-Plus/Source/AWS/sigv4 @@ -1 +1 @@ -Subproject commit 1e692f74f17c8ab9f8332cc2af37e283660bac03 +Subproject commit 9d9f95a95acdf3e1428df803cec79e65e2da81f0 diff --git a/FreeRTOS-Plus/Source/Application-Protocols/coreHTTP b/FreeRTOS-Plus/Source/Application-Protocols/coreHTTP index 48ccceb4bc..dc94df08e4 160000 --- a/FreeRTOS-Plus/Source/Application-Protocols/coreHTTP +++ b/FreeRTOS-Plus/Source/Application-Protocols/coreHTTP @@ -1 +1 @@ -Subproject commit 48ccceb4bc048a36012ff33a0adbb49bc891045f +Subproject commit dc94df08e4819471b73858b863fddd50c0ca38c6 diff --git a/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT b/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT index 143a15eb11..238350a844 160000 --- a/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT +++ b/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT @@ -1 +1 @@ -Subproject commit 143a15eb11124903e51ab3c0bba6234fbbe23f42 +Subproject commit 238350a844336c6dea7e3aa50ecab729bf27e288 diff --git a/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent b/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent index 3b743173dd..d3668a69bf 160000 --- a/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent +++ b/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent @@ -1 +1 @@ -Subproject commit 3b743173ddc7ec00d3073462847db15580a56617 +Subproject commit d3668a69bff0487f8964ad1de0fea0799ffe407c diff --git a/FreeRTOS-Plus/Source/Application-Protocols/coreSNTP b/FreeRTOS-Plus/Source/Application-Protocols/coreSNTP index 3cb8ad937f..c5face5fa3 160000 --- a/FreeRTOS-Plus/Source/Application-Protocols/coreSNTP +++ b/FreeRTOS-Plus/Source/Application-Protocols/coreSNTP @@ -1 +1 @@ -Subproject commit 3cb8ad937f70516cb9f08a7d622cfa9195736d3b +Subproject commit c5face5fa3cc3c37b8216c35d03d323373e89a85 diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface b/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface index 4675955e0e..f1097fb3b1 160000 --- a/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface +++ b/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface @@ -1 +1 @@ -Subproject commit 4675955e0eb792b602666bf52a901650768c6d7e +Subproject commit f1097fb3b1c69120a0a0541c6a858830b3f4e762 diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Modules/bg96 b/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Modules/bg96 index 6761849664..f61fc4c9b2 160000 --- a/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Modules/bg96 +++ b/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Modules/bg96 @@ -1 +1 @@ -Subproject commit 6761849664d2a0c7490c1f226b6f424a1a9c4662 +Subproject commit f61fc4c9b23668a72868c02f7e77829037e4d7f2 diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Modules/sara-r4 b/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Modules/sara-r4 index f536afea36..dcdae990a1 160000 --- a/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Modules/sara-r4 +++ b/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Modules/sara-r4 @@ -1 +1 @@ -Subproject commit f536afea36a60b4a159a6646dfff0bb0867c3d03 +Subproject commit dcdae990a197c80a49450d801aeeec72863d9da9 diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP index 40c16fef7b..b41e57e7b2 160000 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP @@ -1 +1 @@ -Subproject commit 40c16fef7b3380982a8e6517654272cca5a9dc0a +Subproject commit b41e57e7b28d714a494cc470f16a8f5fea2b9e18 diff --git a/FreeRTOS-Plus/Source/Utilities/backoff_algorithm b/FreeRTOS-Plus/Source/Utilities/backoff_algorithm index f4b3fcfe92..0b4f9920fa 160000 --- a/FreeRTOS-Plus/Source/Utilities/backoff_algorithm +++ b/FreeRTOS-Plus/Source/Utilities/backoff_algorithm @@ -1 +1 @@ -Subproject commit f4b3fcfe92002a3a7609e511fd05361b9e812021 +Subproject commit 0b4f9920fa28faba02815521f10b31a3443eaf59 diff --git a/FreeRTOS-Plus/Source/coreJSON b/FreeRTOS-Plus/Source/coreJSON index 360cfcd8ea..b92c8cd9cd 160000 --- a/FreeRTOS-Plus/Source/coreJSON +++ b/FreeRTOS-Plus/Source/coreJSON @@ -1 +1 @@ -Subproject commit 360cfcd8eac76737cddab9be6c4eb057446b1ec0 +Subproject commit b92c8cd9cdba790e46eab05f7a620b0f15c5be69 diff --git a/FreeRTOS-Plus/Source/corePKCS11 b/FreeRTOS-Plus/Source/corePKCS11 index 8b5ec3b3e3..cb865c1a25 160000 --- a/FreeRTOS-Plus/Source/corePKCS11 +++ b/FreeRTOS-Plus/Source/corePKCS11 @@ -1 +1 @@ -Subproject commit 8b5ec3b3e3a7fbf0c1d47646773ada90fa12b19b +Subproject commit cb865c1a25de899c598b1ca47571f9f74b60a118 diff --git a/FreeRTOS/Demo/ThirdParty/Community-Supported-Demos b/FreeRTOS/Demo/ThirdParty/Community-Supported-Demos index db9704fb76..3d475bddf7 160000 --- a/FreeRTOS/Demo/ThirdParty/Community-Supported-Demos +++ b/FreeRTOS/Demo/ThirdParty/Community-Supported-Demos @@ -1 +1 @@ -Subproject commit db9704fb761d23f7389a0edb2786c614b5c700fc +Subproject commit 3d475bddf7ac8af425da67cdaa2485e90a57a881 diff --git a/FreeRTOS/Demo/ThirdParty/Partner-Supported-Demos b/FreeRTOS/Demo/ThirdParty/Partner-Supported-Demos index 44b2426a9b..e4183c70fd 160000 --- a/FreeRTOS/Demo/ThirdParty/Partner-Supported-Demos +++ b/FreeRTOS/Demo/ThirdParty/Partner-Supported-Demos @@ -1 +1 @@ -Subproject commit 44b2426a9bba9456a8f7d0dfe2a5f849122f18be +Subproject commit e4183c70fda884d31a324b40c96fad09057792c9 diff --git a/FreeRTOS/Source b/FreeRTOS/Source index 72c7d86276..8e664fc984 160000 --- a/FreeRTOS/Source +++ b/FreeRTOS/Source @@ -1 +1 @@ -Subproject commit 72c7d862762425832d9fce2df7b03d2ad355cb1e +Subproject commit 8e664fc9844e03cc839074aff933fc9b79842d9c diff --git a/manifest.yml b/manifest.yml index 5a4576f06b..72bdc8eb8f 100644 --- a/manifest.yml +++ b/manifest.yml @@ -5,77 +5,77 @@ license: "MIT" dependencies: - name: "FreeRTOS-Kernel" - version: "72c7d86" + version: "8e664fc98" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git" path: "FreeRTOS/Source" - name: "FreeRTOS-Plus-TCP" - version: "40c16fe" + version: "V4.0.0" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Plus-TCP.git" path: "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP" - name: "coreJSON" - version: "360cfcd" + version: "b92c8cd" repository: type: "git" url: "https://github.com/FreeRTOS/coreJSON.git" path: "FreeRTOS-Plus/Source/coreJSON" - name: "sigv4" - version: "1e692f7" + version: "9d9f95a" repository: type: "git" url: "https://github.com/aws/SigV4-for-AWS-IoT-embedded-sdk.git" path: "FreeRTOS-Plus/Source/AWS/sigv4" - name: "coreHTTP" - version: "48ccceb" + version: "dc94df0" repository: type: "git" url: "https://github.com/FreeRTOS/coreHTTP.git" path: "FreeRTOS-Plus/Source/Application-Protocols/coreHTTP" - name: "coreMQTT" - version: "143a15e" + version: "238350a" repository: type: "git" url: "https://github.com/FreeRTOS/coreMQTT.git" path: "FreeRTOS-Plus/Source/Application-Protocols/coreMQTT" - name: "coreMQTT Agent" - version: "3b74317" + version: "d3668a6" repository: type: "git" url: "https://github.com/FreeRTOS/coreMQTT-Agent.git" path: "FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent" - name: "corePKCS11" - version: "8b5ec3b3e" + version: "cb865c1" repository: type: "git" url: "https://github.com/FreeRTOS/corePKCS11.git" path: "FreeRTOS-Plus/Source/corePKCS11" - name: "device-defender" - version: "747ae05" + version: "9dbf7ba" repository: type: "git" url: "https://github.com/aws/Device-Defender-for-AWS-IoT-embedded-sdk.git" path: "FreeRTOS-Plus/Source/AWS/device-defender" - name: "device-shadow" - version: "0c17830" + version: "2f16e7c" repository: type: "git" url: "https://github.com/aws/Device-Shadow-for-AWS-IoT-embedded-sdk.git" path: "FreeRTOS-Plus/Source/AWS/device-shadow" - name: "jobs" - version: "3e33c6a" + version: "f1c3bd6" repository: type: "git" url: "https://github.com/aws/Jobs-for-AWS-IoT-embedded-sdk.git" @@ -110,49 +110,49 @@ dependencies: path: "FreeRTOS-Plus/ThirdParty/libslirp" - name: "backoffAlgorithm" - version: "f4b3fcf" + version: "0b4f992" repository: type: "git" url: "https://github.com/FreeRTOS/backoffAlgorithm" path: "FreeRTOS-Plus/Source/Utilities/backoff_algorithm" - name: "ota" - version: "0c46d6a" + version: "9a8395b" repository: type: "git" url: "https://github.com/aws/ota-for-aws-iot-embedded-sdk" path: "FreeRTOS-Plus/Source/AWS/ota" - name: "coreSNTP" - version: "3cb8ad9" + version: "c5face5" repository: type: "git" url: "https://github.com/FreeRTOS/coreSNTP" path: "FreeRTOS-Plus/Source/Application-Protocols/coreSNTP" - name: "FreeRTOS-Community-Supported-Demos" - version: "db9704f" + version: "3d475bd" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Community-Supported-Demos" path: "FreeRTOS/Demo/ThirdParty/Community-Supported-Demos" - name: "FreeRTOS-Partner-Supported-Demos" - version: "44b242" + version: "e4183c7" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Partner-Supported-Demos" path: "FreeRTOS/Demo/ThirdParty/Partner-Supported-Demos" - name: "FreeRTOS-Cellular-Interface" - version: "4675955" + version: "f1097fb" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface.git" path: "FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface" - name: "Lab-FreeRTOS-Cellular-Interface-Reference-Quectel-BG96" - version: "6761849" + version: "f61fc4c" repository: type: "git" url: "https://github.com/FreeRTOS/Lab-FreeRTOS-Cellular-Interface-Reference-Quectel-BG96.git" @@ -166,14 +166,14 @@ dependencies: path: "FreeRTOS-Plus/Source/FreeRTOS-Cellular-Modules/hl7802" - name: "Lab-FreeRTOS-Cellular-Interface-Reference-ublox-SARA-R4" - version: "f536afe" + version: "dcdae99" repository: type: "git" url: "https://github.com/FreeRTOS/Lab-FreeRTOS-Cellular-Interface-Reference-ublox-SARA-R4.git" path: "FreeRTOS-Plus/Source/FreeRTOS-Cellular-Modules/sara-r4" - name: "fleet-provisioning" - version: "8ce2b28" + version: "daf174d" repository: type: "git" url: "https://github.com/aws/Fleet-Provisioning-for-AWS-IoT-embedded-sdk.git" From 770e93bdfe38a62ce61fa17c1ffdd8a817f14bd4 Mon Sep 17 00:00:00 2001 From: Gabriele Monaco <32201227+glemco@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:34:40 +0300 Subject: [PATCH 04/21] Add tests for streambuffers with different notification index (#1150) * Add tests for streambuffers with different notification index * Uncrustify: triggered by comment. * Updated kernel with tested functionality * Fix typo Signed-off-by: Gaurav Aggarwal --------- Signed-off-by: Gaurav Aggarwal Co-authored-by: GitHub Action Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Co-authored-by: Gaurav Aggarwal --- .../api/stream_buffer_api_utest.c | 130 ++++++++++++++++-- .../CMock/tasks/tasks_freertos/FreeRTOS.h | 1 + 2 files changed, 121 insertions(+), 10 deletions(-) diff --git a/FreeRTOS/Test/CMock/stream_buffer/api/stream_buffer_api_utest.c b/FreeRTOS/Test/CMock/stream_buffer/api/stream_buffer_api_utest.c index 92b834647c..2dea15b58a 100644 --- a/FreeRTOS/Test/CMock/stream_buffer/api/stream_buffer_api_utest.c +++ b/FreeRTOS/Test/CMock/stream_buffer/api/stream_buffer_api_utest.c @@ -48,36 +48,41 @@ * @brief Sample size in bytes of the stream buffer used for test. * The size is kept short enough so that the buffer can be allocated on stack. */ -#define TEST_STREAM_BUFFER_SIZE ( 64U ) +#define TEST_STREAM_BUFFER_SIZE ( 64U ) /** * @brief Sample trigger level in bytes used for stream buffer tests. * When a receiver task is blocked waiting for data, trigger level determines how much bytes should * be available before which receiver task can be unblocked. */ -#define TEST_STREAM_BUFFER_TRIGGER_LEVEL ( 32U ) +#define TEST_STREAM_BUFFER_TRIGGER_LEVEL ( 32U ) /** * @brief Maximum unsigned long value that can be passed as a stream buffer size so as to * trigger an integer overflow. */ -#define TEST_STREAM_BUFFER_MAX_UINT_SIZE ( ~( size_t ) ( 0UL ) ) +#define TEST_STREAM_BUFFER_MAX_UINT_SIZE ( ~( size_t ) ( 0UL ) ) /** * @brief A value used to test setting and getting stream buffer number. */ -#define TEST_STREAM_BUFFER_NUMBER ( 0xFFU ) +#define TEST_STREAM_BUFFER_NUMBER ( 0xFFU ) + +/** + * @brief A value used to test setting and getting stream buffer notification index. + */ +#define TEST_STREAM_BUFFER_NOTIFICATION_INDEX ( 0x2 ) /** * @brief Wait ticks passed into from tests if the stream buffer is full while sending data or * empty while receiving data. */ -#define TEST_STREAM_BUFFER_WAIT_TICKS ( 1000U ) +#define TEST_STREAM_BUFFER_WAIT_TICKS ( 1000U ) /** * @brief CException code for when a configASSERT should be intercepted. */ -#define configASSERT_E 0xAA101 +#define configASSERT_E 0xAA101 /** * @brief Expect a configASSERT from the function called. @@ -119,6 +124,11 @@ static int senderTaskWoken = 0; */ static int receiverTaskWoken = 0; +/** + * @brief Global variable to keep track of the last notification index we are waiting on + */ +static UBaseType_t notificationIndex = -1; + /** * @brief Dummy sender task handle to which the stream buffer receive APIs will send notification. */ @@ -182,6 +192,7 @@ static BaseType_t streamBufferReceiveCallback( UBaseType_t uxIndexToWaitOn, uint8_t data[ TEST_STREAM_BUFFER_SIZE ] = { 0 }; size_t dataReceived = 0; + notificationIndex = uxIndexToWaitOn; /* Receive enough bytes (full size) from stream buffer to wake up sender task. */ dataReceived = xStreamBufferReceive( xStreamBuffer, data, TEST_STREAM_BUFFER_SIZE, TEST_STREAM_BUFFER_WAIT_TICKS ); TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_SIZE, dataReceived ); @@ -199,6 +210,7 @@ static BaseType_t streamBufferReceiveFromISRCallback( UBaseType_t uxIndexToWaitO size_t dataReceived = 0; BaseType_t senderTaskWokenFromISR = pdFALSE; + notificationIndex = uxIndexToWaitOn; /* Receive enough bytes (full size) from stream buffer to wake up sender task. */ dataReceived = xStreamBufferReceiveFromISR( xStreamBuffer, data, TEST_STREAM_BUFFER_SIZE, &senderTaskWokenFromISR ); TEST_ASSERT_EQUAL( pdTRUE, senderTaskWokenFromISR ); @@ -215,6 +227,7 @@ static BaseType_t resetWhenBlockedCallback( UBaseType_t uxIndexToWaitOn, { BaseType_t status; + notificationIndex = uxIndexToWaitOn; /* Reset when the task is blocked on stream buffer, should fail and return pdFAIL. */ status = xStreamBufferReset( xStreamBuffer ); TEST_ASSERT_EQUAL( pdFAIL, status ); @@ -230,6 +243,7 @@ static BaseType_t sendCompletedFromISRCallback( UBaseType_t uxIndexToWaitOn, { BaseType_t status = pdFALSE, highPriorityTaskWoken = pdFALSE; + notificationIndex = uxIndexToWaitOn; /* Executing the send completed API from ISR should unblock a high priority task waiting to receive from stream buffer. */ status = xStreamBufferSendCompletedFromISR( xStreamBuffer, &highPriorityTaskWoken ); TEST_ASSERT_EQUAL( pdTRUE, status ); @@ -246,6 +260,7 @@ static BaseType_t receiveCompletedFromISRCallback( UBaseType_t uxIndexToWaitOn, { BaseType_t status = pdFALSE, highPriorityTaskWoken = pdFALSE; + notificationIndex = uxIndexToWaitOn; /* Executing the receive completed API from ISR should unblock a high priority task waiting to send to stream buffer. */ status = xStreamBufferReceiveCompletedFromISR( xStreamBuffer, &highPriorityTaskWoken ); TEST_ASSERT_EQUAL( pdTRUE, status ); @@ -261,7 +276,12 @@ static BaseType_t senderTaskNotificationCallback( TaskHandle_t xTaskToNotify, int cmock_num_calls ) { TEST_ASSERT_EQUAL( senderTask, xTaskToNotify ); - senderTaskWoken++; + + if( uxIndexToNotify == notificationIndex ) + { + senderTaskWoken++; + } + return pdTRUE; } @@ -274,7 +294,12 @@ static BaseType_t senderTaskNotificationFromISRCallback( TaskHandle_t xTaskToNot int cmock_num_calls ) { TEST_ASSERT_EQUAL( senderTask, xTaskToNotify ); - senderTaskWoken++; + + if( uxIndexToNotify == notificationIndex ) + { + senderTaskWoken++; + } + *pxHigherPriorityTaskWoken = pdTRUE; return pdTRUE; @@ -290,6 +315,7 @@ static BaseType_t streamBufferSendCallback( UBaseType_t uxIndexToWaitOn, uint8_t data[ TEST_STREAM_BUFFER_TRIGGER_LEVEL ] = { 0 }; size_t dataSent = 0; + notificationIndex = uxIndexToWaitOn; /* Send enough (trigger level) bytes to stream buffer to wake up the receiver Task. */ dataSent = xStreamBufferSend( xStreamBuffer, data, TEST_STREAM_BUFFER_TRIGGER_LEVEL, TEST_STREAM_BUFFER_WAIT_TICKS ); TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_TRIGGER_LEVEL, dataSent ); @@ -307,6 +333,7 @@ static BaseType_t streamBufferSendFromISRCallback( UBaseType_t uxIndexToWaitOn, size_t dataSent = 0; BaseType_t receiverTaskWokenFromISR = pdFALSE; + notificationIndex = uxIndexToWaitOn; /* Send enough (trigger level) bytes to stream buffer to wake up the receiver Task. */ dataSent = xStreamBufferSendFromISR( xStreamBuffer, data, TEST_STREAM_BUFFER_TRIGGER_LEVEL, &receiverTaskWokenFromISR ); TEST_ASSERT_EQUAL( pdTRUE, receiverTaskWokenFromISR ); @@ -324,6 +351,7 @@ static BaseType_t sendLessThanTriggerLevelBytesCallback( UBaseType_t uxIndexToWa uint8_t data[ TEST_STREAM_BUFFER_TRIGGER_LEVEL ] = { 0 }; size_t dataSent = 0; + notificationIndex = uxIndexToWaitOn; /* Sending less than trigger level bytes should not wake up the receiver Task. */ dataSent = xStreamBufferSend( xStreamBuffer, data, TEST_STREAM_BUFFER_TRIGGER_LEVEL - 1, 0 ); TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_TRIGGER_LEVEL - 1, dataSent ); @@ -341,6 +369,7 @@ static BaseType_t sendLessThanTriggerLevelBytesFromISRCallback( UBaseType_t uxIn size_t dataSent = 0; BaseType_t receiverTaskWokenFromISR = pdFALSE; + notificationIndex = uxIndexToWaitOn; /* Sending less than trigger level bytes should not wake up the receiver Task. */ dataSent = xStreamBufferSendFromISR( xStreamBuffer, data, TEST_STREAM_BUFFER_TRIGGER_LEVEL - 1, &receiverTaskWokenFromISR ); TEST_ASSERT_EQUAL( pdFALSE, receiverTaskWokenFromISR ); @@ -357,7 +386,12 @@ static BaseType_t receiverTaskNotificationFromISRCallback( TaskHandle_t xTaskToN int cmock_num_calls ) { TEST_ASSERT_EQUAL( receiverTask, xTaskToNotify ); - receiverTaskWoken++; + + if( uxIndexToNotify == notificationIndex ) + { + receiverTaskWoken++; + } + *pxHigherPriorityTaskWoken = pdTRUE; return pdTRUE; @@ -371,7 +405,12 @@ static BaseType_t receiverTaskNotificationCallback( TaskHandle_t xTaskToNotify, int cmock_num_calls ) { TEST_ASSERT_EQUAL( receiverTask, xTaskToNotify ); - receiverTaskWoken++; + + if( uxIndexToNotify == notificationIndex ) + { + receiverTaskWoken++; + } + return pdTRUE; } @@ -384,6 +423,7 @@ void setUp( void ) xStreamBuffer = NULL; senderTaskWoken = 0; receiverTaskWoken = 0; + notificationIndex = -1; shouldAbortOnAssertion = pdTRUE; dynamicMemoryAllocated = 0; @@ -434,6 +474,7 @@ static void validate_stream_buffer_init_state( StreamBufferHandle_t xStreamBuffe TEST_ASSERT_EQUAL( 0U, xStreamBufferBytesAvailable( xStreamBuffer ) ); TEST_ASSERT_EQUAL( 0U, xStreamBufferNextMessageLengthBytes( xStreamBuffer ) ); TEST_ASSERT_EQUAL( 0, ucStreamBufferGetStreamBufferType( xStreamBuffer ) ); + TEST_ASSERT_EQUAL( tskDEFAULT_INDEX_TO_NOTIFY, uxStreamBufferGetStreamBufferNotificationIndex( xStreamBuffer ) ); } static void validate_and_clear_assertions( void ) @@ -460,6 +501,10 @@ void test_xStreamBufferCreate_success( void ) vStreamBufferSetStreamBufferNumber( xStreamBuffer, TEST_STREAM_BUFFER_NUMBER ); TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_NUMBER, uxStreamBufferGetStreamBufferNumber( xStreamBuffer ) ); + /* Set a notification index and get it. */ + vStreamBufferSetStreamBufferNotificationIndex( xStreamBuffer, TEST_STREAM_BUFFER_NOTIFICATION_INDEX ); + TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_NOTIFICATION_INDEX, uxStreamBufferGetStreamBufferNotificationIndex( xStreamBuffer ) ); + vStreamBufferDelete( xStreamBuffer ); } @@ -669,6 +714,7 @@ void test_xStreamBufferSend_blocking( void ) xStreamBuffer = xStreamBufferCreate( TEST_STREAM_BUFFER_SIZE, TEST_STREAM_BUFFER_TRIGGER_LEVEL ); TEST_ASSERT_NOT_NULL( xStreamBuffer ); TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_SIZE, xStreamBufferSpacesAvailable( xStreamBuffer ) ); + TEST_ASSERT_EQUAL( tskDEFAULT_INDEX_TO_NOTIFY, uxStreamBufferGetStreamBufferNotificationIndex( xStreamBuffer ) ); /* Sending upto size of stream buffer should not block. */ sent = xStreamBufferSend( xStreamBuffer, data, TEST_STREAM_BUFFER_SIZE - 1, TEST_STREAM_BUFFER_WAIT_TICKS ); @@ -709,6 +755,39 @@ void test_xStreamBufferSend_blocking( void ) TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_SIZE, xStreamBufferBytesAvailable( xStreamBuffer ) ); TEST_ASSERT_EQUAL( 2, senderTaskWoken ); + + /* + * A task trying to send to a stream buffer without any space available should block for upto TEST_STREAM_BUFFER_WAIT_TICKS. + * Sender task should be notified and woken up when bytes are consumed by a receiver task during the wait period, + * also with different notification index. + */ + vStreamBufferSetStreamBufferNotificationIndex( xStreamBuffer, TEST_STREAM_BUFFER_NOTIFICATION_INDEX ); + xTaskGenericNotifyWait_AddCallback( streamBufferReceiveCallback ); + xTaskGenericNotify_StubWithCallback( senderTaskNotificationCallback ); + xTaskGenericNotifyWait_ExpectAndReturn( TEST_STREAM_BUFFER_NOTIFICATION_INDEX, 0, 0, NULL, TEST_STREAM_BUFFER_WAIT_TICKS, pdTRUE ); + xTaskCheckForTimeOut_IgnoreAndReturn( pdFALSE ); + sent = xStreamBufferSend( xStreamBuffer, data, TEST_STREAM_BUFFER_SIZE, TEST_STREAM_BUFFER_WAIT_TICKS ); + TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_NOTIFICATION_INDEX, uxStreamBufferGetStreamBufferNotificationIndex( xStreamBuffer ) ); + TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_SIZE, sent ); + TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_SIZE, xStreamBufferBytesAvailable( xStreamBuffer ) ); + TEST_ASSERT_EQUAL( 3, senderTaskWoken ); + + /* + * A task trying to send to a stream buffer without any space available should block for upto TEST_STREAM_BUFFER_WAIT_TICKS. + * Sender task should be notified and woken up when bytes are consumed by an ISR during the wait period, + * also with different notification index. (restore default index after this run) + */ + vStreamBufferSetStreamBufferNotificationIndex( xStreamBuffer, TEST_STREAM_BUFFER_NOTIFICATION_INDEX ); + xTaskGenericNotifyWait_AddCallback( streamBufferReceiveFromISRCallback ); + xTaskGenericNotifyWait_ExpectAndReturn( TEST_STREAM_BUFFER_NOTIFICATION_INDEX, 0, 0, NULL, TEST_STREAM_BUFFER_WAIT_TICKS, pdTRUE ); + xTaskGenericNotifyFromISR_StubWithCallback( senderTaskNotificationFromISRCallback ); + xTaskCheckForTimeOut_IgnoreAndReturn( pdFALSE ); + sent = xStreamBufferSend( xStreamBuffer, data, TEST_STREAM_BUFFER_SIZE, TEST_STREAM_BUFFER_WAIT_TICKS ); + TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_NOTIFICATION_INDEX, uxStreamBufferGetStreamBufferNotificationIndex( xStreamBuffer ) ); + TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_SIZE, sent ); + TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_SIZE, xStreamBufferBytesAvailable( xStreamBuffer ) ); + TEST_ASSERT_EQUAL( 4, senderTaskWoken ); + vStreamBufferDelete( xStreamBuffer ); } @@ -839,6 +918,7 @@ void test_xStreamBufferReceive_blocking( void ) xStreamBuffer = xStreamBufferCreate( TEST_STREAM_BUFFER_SIZE, TEST_STREAM_BUFFER_TRIGGER_LEVEL ); TEST_ASSERT_NOT_NULL( xStreamBuffer ); TEST_ASSERT_EQUAL( 0, xStreamBufferBytesAvailable( xStreamBuffer ) ); + TEST_ASSERT_EQUAL( tskDEFAULT_INDEX_TO_NOTIFY, uxStreamBufferGetStreamBufferNotificationIndex( xStreamBuffer ) ); /* * Receiving from an empty buffer causes the task to wait for TEST_STREAM_BUFFER_WAIT_TICKS period. @@ -885,6 +965,36 @@ void test_xStreamBufferReceive_blocking( void ) receivedBytes = xStreamBufferReceive( xStreamBuffer, data, TEST_STREAM_BUFFER_SIZE, TEST_STREAM_BUFFER_WAIT_TICKS ); TEST_ASSERT_EQUAL( 2, receiverTaskWoken ); + + /* + * Sending at least trigger level bytes, should notify and wake up the receiver task, + * also with different notification index. + */ + vStreamBufferSetStreamBufferNotificationIndex( xStreamBuffer, TEST_STREAM_BUFFER_NOTIFICATION_INDEX ); + xTaskGenericNotifyWait_AddCallback( streamBufferSendCallback ); + xTaskGenericNotifyWait_ExpectAndReturn( TEST_STREAM_BUFFER_NOTIFICATION_INDEX, 0, 0, NULL, TEST_STREAM_BUFFER_WAIT_TICKS, pdTRUE ); + xTaskCheckForTimeOut_IgnoreAndReturn( pdFALSE ); + receivedBytes = xStreamBufferReceive( xStreamBuffer, data, TEST_STREAM_BUFFER_SIZE, TEST_STREAM_BUFFER_WAIT_TICKS ); + TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_NOTIFICATION_INDEX, uxStreamBufferGetStreamBufferNotificationIndex( xStreamBuffer ) ); + TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_TRIGGER_LEVEL, receivedBytes ); + TEST_ASSERT_EQUAL( 3, receiverTaskWoken ); + TEST_ASSERT_EQUAL( 0, xStreamBufferBytesAvailable( xStreamBuffer ) ); + + /* + * Sending at least trigger level bytes from ISR, should notify and wake up the receiver task, + * also with different notification index. (restore default index after this run) + */ + xTaskGenericNotifyWait_AddCallback( streamBufferSendFromISRCallback ); + xTaskGenericNotifyWait_ExpectAndReturn( TEST_STREAM_BUFFER_NOTIFICATION_INDEX, 0, 0, NULL, TEST_STREAM_BUFFER_WAIT_TICKS, pdTRUE ); + xTaskGenericNotifyFromISR_StubWithCallback( receiverTaskNotificationFromISRCallback ); + xTaskCheckForTimeOut_IgnoreAndReturn( pdFALSE ); + receivedBytes = xStreamBufferReceive( xStreamBuffer, data, TEST_STREAM_BUFFER_SIZE, TEST_STREAM_BUFFER_WAIT_TICKS ); + TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_NOTIFICATION_INDEX, uxStreamBufferGetStreamBufferNotificationIndex( xStreamBuffer ) ); + TEST_ASSERT_EQUAL( TEST_STREAM_BUFFER_TRIGGER_LEVEL, receivedBytes ); + TEST_ASSERT_EQUAL( 4, receiverTaskWoken ); + TEST_ASSERT_EQUAL( 0, xStreamBufferBytesAvailable( xStreamBuffer ) ); + vStreamBufferSetStreamBufferNotificationIndex( xStreamBuffer, tskDEFAULT_INDEX_TO_NOTIFY ); + vStreamBufferDelete( xStreamBuffer ); } diff --git a/FreeRTOS/Test/CMock/tasks/tasks_freertos/FreeRTOS.h b/FreeRTOS/Test/CMock/tasks/tasks_freertos/FreeRTOS.h index 7c3674ad3f..bd7b65c103 100644 --- a/FreeRTOS/Test/CMock/tasks/tasks_freertos/FreeRTOS.h +++ b/FreeRTOS/Test/CMock/tasks/tasks_freertos/FreeRTOS.h @@ -3240,6 +3240,7 @@ typedef struct xSTATIC_STREAM_BUFFER #if ( configUSE_SB_COMPLETED_CALLBACK == 1 ) void * pvDummy5[ 2 ]; #endif + UBaseType_t uxDummy6; } StaticStreamBuffer_t; /* Message buffers are built on stream buffers. */ From b0c6296cbf0f7287db910a9188b335fcea2e01fa Mon Sep 17 00:00:00 2001 From: Moral-Hao Date: Mon, 29 Jan 2024 15:05:30 +0800 Subject: [PATCH 05/21] Update all CMock configuration to compare_ptr. (#1123) Bring the change of CMock configuration in directory tasks to all other directories. Co-authored-by: Soren Ptak Co-authored-by: Nikhil Kamath <110539926+amazonKamath@users.noreply.github.com> Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> --- FreeRTOS/Test/CMock/event_groups/event_groups.yml | 2 +- FreeRTOS/Test/CMock/list/list.yml | 2 +- FreeRTOS/Test/CMock/message_buffer/message_buffer.yml | 2 +- FreeRTOS/Test/CMock/queue/queue.yml | 2 +- FreeRTOS/Test/CMock/smp/smp.yml | 2 +- FreeRTOS/Test/CMock/stream_buffer/stream_buffer.yml | 2 +- FreeRTOS/Test/CMock/timers/timers.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/FreeRTOS/Test/CMock/event_groups/event_groups.yml b/FreeRTOS/Test/CMock/event_groups/event_groups.yml index de9ad9be42..e149b08f25 100644 --- a/FreeRTOS/Test/CMock/event_groups/event_groups.yml +++ b/FreeRTOS/Test/CMock/event_groups/event_groups.yml @@ -1,13 +1,13 @@ :cmock: :mock_prefix: mock_ :when_no_prototypes: :warn + :when_ptr: :compare_ptr :treat_externs: :include :enforce_strict_ordering: TRUE :plugins: - :ignore - :ignore_arg - :expect_any_args - - :array - :callback - :return_thru_ptr :callback_include_count: true # include a count arg when calling the callback diff --git a/FreeRTOS/Test/CMock/list/list.yml b/FreeRTOS/Test/CMock/list/list.yml index de9ad9be42..e149b08f25 100644 --- a/FreeRTOS/Test/CMock/list/list.yml +++ b/FreeRTOS/Test/CMock/list/list.yml @@ -1,13 +1,13 @@ :cmock: :mock_prefix: mock_ :when_no_prototypes: :warn + :when_ptr: :compare_ptr :treat_externs: :include :enforce_strict_ordering: TRUE :plugins: - :ignore - :ignore_arg - :expect_any_args - - :array - :callback - :return_thru_ptr :callback_include_count: true # include a count arg when calling the callback diff --git a/FreeRTOS/Test/CMock/message_buffer/message_buffer.yml b/FreeRTOS/Test/CMock/message_buffer/message_buffer.yml index de9ad9be42..e149b08f25 100644 --- a/FreeRTOS/Test/CMock/message_buffer/message_buffer.yml +++ b/FreeRTOS/Test/CMock/message_buffer/message_buffer.yml @@ -1,13 +1,13 @@ :cmock: :mock_prefix: mock_ :when_no_prototypes: :warn + :when_ptr: :compare_ptr :treat_externs: :include :enforce_strict_ordering: TRUE :plugins: - :ignore - :ignore_arg - :expect_any_args - - :array - :callback - :return_thru_ptr :callback_include_count: true # include a count arg when calling the callback diff --git a/FreeRTOS/Test/CMock/queue/queue.yml b/FreeRTOS/Test/CMock/queue/queue.yml index 1ebd268bf5..c9ba70e6a7 100644 --- a/FreeRTOS/Test/CMock/queue/queue.yml +++ b/FreeRTOS/Test/CMock/queue/queue.yml @@ -1,13 +1,13 @@ :cmock: :mock_prefix: mock_ :when_no_prototypes: :warn + :when_ptr: :compare_ptr :treat_externs: :include :enforce_strict_ordering: TRUE :plugins: - :ignore - :ignore_arg - :expect_any_args - - :array - :callback - :return_thru_ptr :callback_include_count: true # include a count arg when calling the callback diff --git a/FreeRTOS/Test/CMock/smp/smp.yml b/FreeRTOS/Test/CMock/smp/smp.yml index 5f50def2f8..d766527c50 100644 --- a/FreeRTOS/Test/CMock/smp/smp.yml +++ b/FreeRTOS/Test/CMock/smp/smp.yml @@ -1,13 +1,13 @@ :cmock: :mock_prefix: mock_ :when_no_prototypes: :warn + :when_ptr: :compare_ptr :treat_externs: :include :enforce_strict_ordering: TRUE :plugins: - :ignore - :ignore_arg - :expect_any_args - - :array - :callback - :return_thru_ptr - :cexception diff --git a/FreeRTOS/Test/CMock/stream_buffer/stream_buffer.yml b/FreeRTOS/Test/CMock/stream_buffer/stream_buffer.yml index de9ad9be42..e149b08f25 100644 --- a/FreeRTOS/Test/CMock/stream_buffer/stream_buffer.yml +++ b/FreeRTOS/Test/CMock/stream_buffer/stream_buffer.yml @@ -1,13 +1,13 @@ :cmock: :mock_prefix: mock_ :when_no_prototypes: :warn + :when_ptr: :compare_ptr :treat_externs: :include :enforce_strict_ordering: TRUE :plugins: - :ignore - :ignore_arg - :expect_any_args - - :array - :callback - :return_thru_ptr :callback_include_count: true # include a count arg when calling the callback diff --git a/FreeRTOS/Test/CMock/timers/timers.yml b/FreeRTOS/Test/CMock/timers/timers.yml index de9ad9be42..e149b08f25 100644 --- a/FreeRTOS/Test/CMock/timers/timers.yml +++ b/FreeRTOS/Test/CMock/timers/timers.yml @@ -1,13 +1,13 @@ :cmock: :mock_prefix: mock_ :when_no_prototypes: :warn + :when_ptr: :compare_ptr :treat_externs: :include :enforce_strict_ordering: TRUE :plugins: - :ignore - :ignore_arg - :expect_any_args - - :array - :callback - :return_thru_ptr :callback_include_count: true # include a count arg when calling the callback From 3d236bd83d3b218c10e5153df64c1d24e4247c17 Mon Sep 17 00:00:00 2001 From: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Tue, 30 Jan 2024 10:44:47 +0530 Subject: [PATCH 06/21] Add x64 configuration to Win32-MSVC demo (#1164) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add x64 configuration to Win32-MSVC demo. This was originally contributed in this PR - #1139 --------- Signed-off-by: Gaurav Aggarwal Co-authored-by: José Simões Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> --- .github/workflows/freertos_demos.yml | 36 ++++++++--- .../FreeRTOSConfig.h | 21 ++++--- .../Demo/FreeRTOS_Plus_TCP_Echo_Posix/main.c | 60 +------------------ FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h | 2 +- FreeRTOS/Demo/WIN32-MSVC/WIN32.sln | 7 ++- FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj | 25 ++++---- .../Demo/WIN32-MSVC/WIN32.vcxproj.filters | 3 + FreeRTOS/Demo/WIN32-MSVC/main.c | 19 +++--- FreeRTOS/Source | 2 +- manifest.yml | 2 +- 10 files changed, 76 insertions(+), 101 deletions(-) diff --git a/.github/workflows/freertos_demos.yml b/.github/workflows/freertos_demos.yml index ad610251b3..0a21b618c2 100644 --- a/.github/workflows/freertos_demos.yml +++ b/.github/workflows/freertos_demos.yml @@ -24,7 +24,7 @@ jobs: stepName: Checkout Repository name: ${{ env.stepName }} uses: actions/checkout@v3 - + - env: stepName: Fetch Required Submodule name: ${{ env.stepName }} @@ -62,7 +62,8 @@ jobs: $content = Get-Content -Path 'main.c' -Raw $newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );' $newContent | Set-Content -Path 'main.c' - msbuild WIN32.sln -t:rebuild + msbuild WIN32.sln /p:Platform=Win32 -t:rebuild + msbuild WIN32.sln /p:Platform=x64 -t:rebuild $exitStatus = $? echo "::endgroup::" if($exitStatus -eq 1) { @@ -73,11 +74,21 @@ jobs: } - env: - stepName: Run and monitor WIN32-MSVC Full Demo + stepName: Run and monitor WIN32-MSVC Full Demo - Win32 + name: ${{ env.stepName }} + uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main + with: + exe-path: FreeRTOS/Demo/WIN32-MSVC/Win32/Debug/RTOSDemo.exe + timeout-seconds: 60 + success-line: "No errors - tick count" + retry-attempts: 3 + + - env: + stepName: Run and monitor WIN32-MSVC Full Demo - x64 name: ${{ env.stepName }} uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main with: - exe-path: FreeRTOS/Demo/WIN32-MSVC/Debug/RTOSDemo.exe + exe-path: FreeRTOS/Demo/WIN32-MSVC/x64/Debug/RTOSDemo.exe timeout-seconds: 60 success-line: "No errors - tick count" retry-attempts: 3 @@ -93,7 +104,8 @@ jobs: $content = Get-Content -Path 'main.c' -Raw $newContent = $content -replace '#define\s+mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\s+0', '#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1' $newContent | Set-Content -Path 'main.c' - msbuild WIN32.sln -t:rebuild + msbuild WIN32.sln /p:Platform=Win32 -t:rebuild + msbuild WIN32.sln /p:Platform=x64 -t:rebuild echo "::endgroup::" $exitStatus = $? if($exitStatus -eq 1) { @@ -104,11 +116,21 @@ jobs: } - env: - stepName: Run and monitor WIN32-MSVC Blinky Demo + stepName: Run and monitor WIN32-MSVC Blinky Demo - Win32 + name: ${{ env.stepName }} + uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main + with: + exe-path: FreeRTOS/Demo/WIN32-MSVC/Win32/Debug/RTOSDemo.exe + timeout-seconds: 60 + success-line: "Message received from software timer" + retry-attempts: 3 + + - env: + stepName: Run and monitor WIN32-MSVC Blinky Demo - x64 name: ${{ env.stepName }} uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main with: - exe-path: FreeRTOS/Demo/WIN32-MSVC/Debug/RTOSDemo.exe + exe-path: FreeRTOS/Demo/WIN32-MSVC/x64/Debug/RTOSDemo.exe timeout-seconds: 60 success-line: "Message received from software timer" retry-attempts: 3 diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSConfig.h index 7ec703eb81..0cf89d6ffc 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSConfig.h +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSConfig.h @@ -205,19 +205,22 @@ extern void vAssertCalled( const char * const pcFileName, * 208.67.220.220. Used in ipconfigUSE_DNS is set to 0, or ipconfigUSE_DNS is set * to 1 but a DNS server cannot be contacted.*/ -#define configDNS_SERVER_ADDR0 10 -#define configDNS_SERVER_ADDR1 4 -#define configDNS_SERVER_ADDR2 4 -#define configDNS_SERVER_ADDR3 10 +#define configDNS_SERVER_ADDR0 10 +#define configDNS_SERVER_ADDR1 4 +#define configDNS_SERVER_ADDR2 4 +#define configDNS_SERVER_ADDR3 10 /* Default netmask configuration. Used in ipconfigUSE_DNS is set to 0, or * ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */ -#define configNET_MASK0 255 -#define configNET_MASK1 255 -#define configNET_MASK2 240 -#define configNET_MASK3 0 +#define configNET_MASK0 255 +#define configNET_MASK1 255 +#define configNET_MASK2 240 +#define configNET_MASK3 0 /* The UDP port to which print messages are sent. */ -#define configPRINT_PORT ( 15000 ) +#define configPRINT_PORT ( 15000 ) + +/* Use kernel provided static memory for timer and idle tasks. */ +#define configKERNEL_PROVIDED_STATIC_MEMORY 1 #endif /* FREERTOS_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main.c index 66efef40fd..ebaa23fd83 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main.c @@ -83,12 +83,6 @@ void vApplicationIdleHook( void ); void vApplicationStackOverflowHook( TaskHandle_t pxTask, char * pcTaskName ); void vApplicationTickHook( void ); -void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, - StackType_t ** ppxIdleTaskStackBuffer, - uint32_t * pulIdleTaskStackSize ); -void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, - StackType_t ** ppxTimerTaskStackBuffer, - uint32_t * pulTimerTaskStackSize ); /* * Writes trace data to a disk file when the trace recording is stopped. @@ -322,58 +316,6 @@ static void prvSaveTraceFile( void ) } /*-----------------------------------------------------------*/ -/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an - * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is - * used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, - StackType_t ** ppxIdleTaskStackBuffer, - uint32_t * pulIdleTaskStackSize ) -{ -/* If the buffers to be provided to the Idle task are declared inside this - * function then they must be declared static - otherwise they will be allocated on - * the stack and so not exists after this function exits. */ - static StaticTask_t xIdleTaskTCB; - static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - * state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - * Note that, as the array is necessarily of type StackType_t, - * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; -} -/*-----------------------------------------------------------*/ - -/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the - * application must provide an implementation of vApplicationGetTimerTaskMemory() - * to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, - StackType_t ** ppxTimerTaskStackBuffer, - uint32_t * pulTimerTaskStackSize ) -{ -/* If the buffers to be provided to the Timer task are declared inside this - * function then they must be declared static - otherwise they will be allocated on - * the stack and so not exists after this function exits. */ - static StaticTask_t xTimerTaskTCB; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - * task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - * Note that, as the array is necessarily of type StackType_t, - * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; -} - static uint32_t ulEntryTime = 0U; void vTraceTimerReset( void ) @@ -390,3 +332,5 @@ uint32_t uiTraceTimerGetValue( void ) { return( xTaskGetTickCount() - ulEntryTime ); } + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h b/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h index 40ec37e684..c8d6b31f1b 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h @@ -46,7 +46,7 @@ #define configUSE_DAEMON_TASK_STARTUP_HOOK 1 #define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */ #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */ -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 49 * 1024 ) ) /* This demo tests heap_5 so places multiple blocks within this total heap size. See mainREGION_1_SIZE to mainREGION_3_SIZE definitions in main.c. */ +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 490 * 1024 ) ) /* This demo tests heap_5 so places multiple blocks within this total heap size. See mainREGION_1_SIZE to mainREGION_3_SIZE definitions in main.c. */ #define configMAX_TASK_NAME_LEN ( 12 ) #define configUSE_TRACE_FACILITY 1 #define configUSE_16_BIT_TICKS 0 diff --git a/FreeRTOS/Demo/WIN32-MSVC/WIN32.sln b/FreeRTOS/Demo/WIN32-MSVC/WIN32.sln index 8dda0ce1a4..28f6d4e261 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/WIN32.sln +++ b/FreeRTOS/Demo/WIN32-MSVC/WIN32.sln @@ -1,16 +1,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.34114.132 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.ActiveCfg = Debug|Win32 {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.Build.0 = Debug|Win32 + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|x64.ActiveCfg = Debug|x64 + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|x64.Build.0 = Debug|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj b/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj index 0ef5e555ac..50fe3c9f94 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj +++ b/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj @@ -5,17 +5,22 @@ Debug Win32 + + Debug + x64 + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} RTOSDemo + 10.0 - + Application false MultiByte - v142 + v143 @@ -27,8 +32,8 @@ <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ true @@ -43,10 +48,6 @@ WIN32;WIN32_LEAN_AND_MEAN;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0601;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ Level4 true EditAndContinue @@ -59,10 +60,9 @@ 0x0c09 - .\Debug/RTOSDemo.exe + $(OutDir)$(TargetName)$(TargetExt) true true - .\Debug/WIN32.pdb Console MachineX86 %(AdditionalDependencies) @@ -73,6 +73,11 @@ .\Debug/WIN32.bsc + + + ..\..\Source\include;..\..\Source\portable\MSVC-MingW;..\Common\Include;..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-Trace\kernelports\FreeRTOS;..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-Trace\kernelports\FreeRTOS\include;..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-Trace\include;.\Trace_Recorder_Configuration;.;%(AdditionalIncludeDirectories) + + diff --git a/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj.filters b/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj.filters index 7049d309c3..64a87bb798 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj.filters +++ b/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj.filters @@ -225,6 +225,9 @@ Demo App Source\FreeRTOS+Trace Recorder\include + + Configuration Files + diff --git a/FreeRTOS/Demo/WIN32-MSVC/main.c b/FreeRTOS/Demo/WIN32-MSVC/main.c index 639102a701..51ee484cfa 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/main.c +++ b/FreeRTOS/Demo/WIN32-MSVC/main.c @@ -86,9 +86,9 @@ * as this demo could easily create one large heap region instead of multiple * smaller heap regions - in which case heap_4.c would be the more appropriate * choice. See http://www.freertos.org/a00111.html for an explanation. */ -#define mainREGION_1_SIZE 8201 -#define mainREGION_2_SIZE 23905 -#define mainREGION_3_SIZE 16807 +#define mainREGION_1_SIZE 82010 +#define mainREGION_2_SIZE 239050 +#define mainREGION_3_SIZE 168070 /* This demo allows for users to perform actions with the keyboard. */ #define mainNO_KEY_PRESS_VALUE -1 @@ -149,7 +149,7 @@ static void prvSaveTraceFile( void ); * FreeRTOS simulator. This thread passes data safely into the FreeRTOS * simulator using a stream buffer. */ -static DWORD WINAPI prvWindowsKeyboardInputThread( void * pvParam ); +static int32_t WINAPI prvWindowsKeyboardInputThread( void * pvParam ); /* * Interrupt handler for when keyboard input is received. @@ -349,12 +349,7 @@ void vAssertCalled( unsigned long ulLine, * value. */ while( ulSetToNonZeroInDebuggerToContinue == 0 ) { - __asm { - NOP - }; - __asm { - NOP - }; + __nop(); } /* Re-enable the trace recording. */ @@ -422,7 +417,7 @@ static void prvInitialiseHeap( void ) * used by the Idle task. */ void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, - uint32_t * pulIdleTaskStackSize ) + configSTACK_DEPTH_TYPE * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this * function then they must be declared static - otherwise they will be allocated on @@ -514,7 +509,7 @@ static uint32_t prvKeyboardInterruptHandler( void ) * FreeRTOS simulator. This thread passes data into the simulator using * an integer. */ -static DWORD WINAPI prvWindowsKeyboardInputThread( void * pvParam ) +static int32_t WINAPI prvWindowsKeyboardInputThread( void * pvParam ) { ( void ) pvParam; diff --git a/FreeRTOS/Source b/FreeRTOS/Source index 8e664fc984..14dd5b503a 160000 --- a/FreeRTOS/Source +++ b/FreeRTOS/Source @@ -1 +1 @@ -Subproject commit 8e664fc9844e03cc839074aff933fc9b79842d9c +Subproject commit 14dd5b503afc7d9ed88ee9483d586d88d71d20c0 diff --git a/manifest.yml b/manifest.yml index 72bdc8eb8f..dd64d627c1 100644 --- a/manifest.yml +++ b/manifest.yml @@ -5,7 +5,7 @@ license: "MIT" dependencies: - name: "FreeRTOS-Kernel" - version: "8e664fc98" + version: "14dd5b503" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git" From 8422d793832f02f6f73f27df702bd7bd728140a1 Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:02:12 +0800 Subject: [PATCH 07/21] Update on target test for passive idle hook (#1128) Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> --- FreeRTOS/Test/Target/boards/pico/FreeRTOSConfig.h | 1 + .../Target/tests/smp/multiple_tasks_running/test_config.h | 5 ----- FreeRTOS/Test/Target/tests/smp/template/README.md | 1 - FreeRTOS/Test/Target/tests/smp/template/test_config.h | 4 ---- 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/FreeRTOS/Test/Target/boards/pico/FreeRTOSConfig.h b/FreeRTOS/Test/Target/boards/pico/FreeRTOSConfig.h index 863bf57154..22d7b7720b 100644 --- a/FreeRTOS/Test/Target/boards/pico/FreeRTOSConfig.h +++ b/FreeRTOS/Test/Target/boards/pico/FreeRTOSConfig.h @@ -42,6 +42,7 @@ /* Scheduler Related */ #define configUSE_TICKLESS_IDLE 0 #define configUSE_IDLE_HOOK 0 +#define configUSE_PASSIVE_IDLE_HOOK 0 #define configUSE_TICK_HOOK 1 #define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) #define configMAX_PRIORITIES 32 diff --git a/FreeRTOS/Test/Target/tests/smp/multiple_tasks_running/test_config.h b/FreeRTOS/Test/Target/tests/smp/multiple_tasks_running/test_config.h index 1998c31759..bcaedd7890 100644 --- a/FreeRTOS/Test/Target/tests/smp/multiple_tasks_running/test_config.h +++ b/FreeRTOS/Test/Target/tests/smp/multiple_tasks_running/test_config.h @@ -38,10 +38,6 @@ #undef configUSE_CORE_AFFINITY #endif /* ifdef configUSE_CORE_AFFINITY */ -#ifdef configUSE_MINIMAL_IDLE_HOOK - #undef configUSE_MINIMAL_IDLE_HOOK -#endif /* ifdef configUSE_MINIMAL_IDLE_HOOK */ - #ifdef configUSE_TASK_PREEMPTION_DISABLE #undef configUSE_TASK_PREEMPTION_DISABLE #endif /* ifdef configUSE_TASK_PREEMPTION_DISABLE */ @@ -56,7 +52,6 @@ #define configRUN_MULTIPLE_PRIORITIES 1 #define configUSE_CORE_AFFINITY 0 -#define configUSE_MINIMAL_IDLE_HOOK 0 #define configUSE_TASK_PREEMPTION_DISABLE 0 #define configUSE_TIME_SLICING 0 #define configUSE_PREEMPTION 0 diff --git a/FreeRTOS/Test/Target/tests/smp/template/README.md b/FreeRTOS/Test/Target/tests/smp/template/README.md index 8452554149..8124f5c01a 100644 --- a/FreeRTOS/Test/Target/tests/smp/template/README.md +++ b/FreeRTOS/Test/Target/tests/smp/template/README.md @@ -16,7 +16,6 @@ - Ensure that the following configurations are not defined in `FreeRTOSConfig.h` as those are defined in `test_config.h`: - `configRUN_MULTIPLE_PRIORITIES` - `configUSE_CORE_AFFINITY` - - `configUSE_MINIMAL_IDLE_HOOK` - `configUSE_TASK_PREEMPTION_DISABLE` - `configUSE_TIME_SLICING` - `configUSE_PREEMPTION` diff --git a/FreeRTOS/Test/Target/tests/smp/template/test_config.h b/FreeRTOS/Test/Target/tests/smp/template/test_config.h index 0a029c1d55..59f4e62aa7 100644 --- a/FreeRTOS/Test/Target/tests/smp/template/test_config.h +++ b/FreeRTOS/Test/Target/tests/smp/template/test_config.h @@ -38,10 +38,6 @@ #undef configUSE_CORE_AFFINITY #endif /* ifdef configUSE_CORE_AFFINITY */ -#ifdef configUSE_MINIMAL_IDLE_HOOK - #undef configUSE_MINIMAL_IDLE_HOOK -#endif /* ifdef configUSE_MINIMAL_IDLE_HOOK */ - #ifdef configUSE_TASK_PREEMPTION_DISABLE #undef configUSE_TASK_PREEMPTION_DISABLE #endif /* ifdef configUSE_TASK_PREEMPTION_DISABLE */ From 269b16a03a5aa695264462e788446784bbb7a079 Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Thu, 1 Feb 2024 10:51:51 +0800 Subject: [PATCH 08/21] Fix unit test for vTaskEndShceduler (#1163) * Update unit test for vTaskEndScheduler change * test_coverage_vTaskDelete_scheduler_not_running is removed due to vTaskDelete implementation change --------- Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> --- ...tiple_priorities_no_timeslice_mock_utest.c | 51 ------------------- FreeRTOS/Test/CMock/tasks/tasks_1_utest.c | 50 ++++++++++++++++-- 2 files changed, 46 insertions(+), 55 deletions(-) diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c index b238ad1e7f..3fb5783ce3 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c @@ -500,57 +500,6 @@ void test_coverage_prvYieldCore_runstate_eq_yielding( void ) TEST_ASSERT_EQUAL( 1, task.xTaskRunState ); /* nothing has changed */ } -/** - * @brief vTaskDelete - scheduler not running. - * - * This test ensures that if vTaskDelete is called and the scheuler is - * not running, 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 increased and the - * uxtasknumber is increased - * - * Coverage - * @code{c} - * if( ( xSchedulerRunning != pdFALSE ) && - * ( taskTASK_IS_RUNNING( pxTCB ) == pdTRUE ) ) - * ... - * @endcode - * ( xSchedulerRunning != pdFALSE ) is false. - */ -void test_coverage_vTaskDelete_scheduler_not_running( void ) -{ - TCB_t task; - TaskHandle_t xTaskToDelete; - - task.xTaskRunState = 1; /* running on core 1 */ - xTaskToDelete = &task; - pxCurrentTCBs[ 0 ] = &task; - - xSchedulerRunning = pdFALSE; - - 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 if xTask Delete is called and the scheuler is * running while the task runstate is more that the configNUMBER_OF_CORES, diff --git a/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c b/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c index 793766c412..8a376d8e10 100644 --- a/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c +++ b/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c @@ -886,10 +886,12 @@ void test_xTaskCreate_fail_tcb_malloc( void ) /* -------------------------- INCLUDE_vTaskDelete --------------------------- */ void test_vTaskDelete_success_current_task( void ) { + /* Setup */ ptcb = ( TCB_t * ) create_task(); - TEST_ASSERT_EQUAL( 1, uxCurrentNumberOfTasks ); + xSchedulerRunning = pdTRUE; + /* Expectations */ uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, pdPASS ); listLIST_ITEM_CONTAINER_ExpectAndReturn( &ptcb->xEventListItem, NULL ); @@ -908,6 +910,8 @@ void test_vTaskDelete_success_current_task_ready_empty( void ) ptcb = ( TCB_t * ) create_task(); TEST_ASSERT_EQUAL( 1, uxCurrentNumberOfTasks ); + xSchedulerRunning = pdTRUE; + /* Expectations */ uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, pdFAIL ); listCURRENT_LIST_LENGTH_ExpectAndReturn( &pxReadyTasksLists[ ptcb->uxPriority ], 0 ); @@ -923,10 +927,12 @@ void test_vTaskDelete_success_current_task_ready_empty( void ) void test_vTaskDelete_success_current_task_ready_empty_null_task( void ) { + /* Setup */ ptcb = ( TCB_t * ) create_task(); - TEST_ASSERT_EQUAL( 1, uxCurrentNumberOfTasks ); + xSchedulerRunning = pdTRUE; + /* Expectations */ uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, pdFAIL ); listCURRENT_LIST_LENGTH_ExpectAndReturn( &pxReadyTasksLists[ ptcb->uxPriority ], 1 ); @@ -1122,8 +1128,44 @@ void test_vTaskStartScheduler_idle_fail( void ) void test_vTaskEndScheduler_success() { + /* Setup. */ + TCB_t * pIdleTaskTCB = ( TCB_t * ) create_task(); + TCB_t * pTimerTaskTCB = ( TCB_t * ) create_task(); + + uxCurrentNumberOfTasks = 0; + pIdleTaskTCB = ( TCB_t * ) create_task(); + TEST_ASSERT_EQUAL( 1, uxCurrentNumberOfTasks ); + xIdleTaskHandles[ 0 ] = ( TaskHandle_t ) pIdleTaskTCB; + pTimerTaskTCB = ( TCB_t * ) create_task(); + TEST_ASSERT_EQUAL( 2, uxCurrentNumberOfTasks ); + ptcb = ( TCB_t * ) create_task(); + TEST_ASSERT_EQUAL( 3, uxCurrentNumberOfTasks ); + + xSchedulerRunning = pdTRUE; + uxDeletedTasksWaitingCleanUp = 0U; /* prvCheckTasksWaitingTermination function call. */ + + /* Expectations. */ + /* Delete the timer task. */ + xTimerGetTimerDaemonTaskHandle_ExpectAndReturn( pTimerTaskTCB ); + uxListRemove_ExpectAndReturn( &pTimerTaskTCB->xStateListItem, pdPASS ); + listLIST_ITEM_CONTAINER_ExpectAndReturn( &pTimerTaskTCB->xEventListItem, NULL ); + listLIST_IS_EMPTY_ExpectAnyArgsAndReturn( pdTRUE ); + vPortFree_ExpectAnyArgs(); + vPortFree_ExpectAnyArgs(); + + /* Delete the idle task. */ + uxListRemove_ExpectAndReturn( &pIdleTaskTCB->xStateListItem, pdPASS ); + listLIST_ITEM_CONTAINER_ExpectAndReturn( &pIdleTaskTCB->xEventListItem, NULL ); + listLIST_IS_EMPTY_ExpectAnyArgsAndReturn( pdTRUE ); + vPortFree_ExpectAnyArgs(); + vPortFree_ExpectAnyArgs(); + vPortEndScheduler_Expect(); + + /* API call. */ vTaskEndScheduler(); + + /* Verification. */ TEST_ASSERT_EQUAL( pdFALSE, xSchedulerRunning ); } @@ -4429,8 +4471,8 @@ void test_xTaskGetSchedulerState_not_running( void ) { BaseType_t ret_sched_state; - vPortEndScheduler_Expect(); - vTaskEndScheduler(); + xSchedulerRunning = pdFALSE; + ret_sched_state = xTaskGetSchedulerState(); TEST_ASSERT_EQUAL( taskSCHEDULER_NOT_STARTED, ret_sched_state ); } From 457ca860c1ad95a82542a67323bb302b054f8e55 Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:46:02 +0800 Subject: [PATCH 09/21] Update kernel submodule for vTaskEndScheduler and vTaskDelete unit test (#1169) --- FreeRTOS/Source | 2 +- manifest.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FreeRTOS/Source b/FreeRTOS/Source index 14dd5b503a..1de764ba87 160000 --- a/FreeRTOS/Source +++ b/FreeRTOS/Source @@ -1 +1 @@ -Subproject commit 14dd5b503afc7d9ed88ee9483d586d88d71d20c0 +Subproject commit 1de764ba879a36fe3e155dece2d11b1116b64360 diff --git a/manifest.yml b/manifest.yml index dd64d627c1..7031d693c5 100644 --- a/manifest.yml +++ b/manifest.yml @@ -5,7 +5,7 @@ license: "MIT" dependencies: - name: "FreeRTOS-Kernel" - version: "14dd5b503" + version: "1de764ba8" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git" From 1bfa474f0c6a1dd7440e0290b35acbe08821e666 Mon Sep 17 00:00:00 2001 From: Paul Bartell Date: Fri, 2 Feb 2024 12:42:16 -0800 Subject: [PATCH 10/21] Update jquery to version 3.7.1 --- tools/aws_config_offline/CertificateConfigurator.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/aws_config_offline/CertificateConfigurator.html b/tools/aws_config_offline/CertificateConfigurator.html index fa07e99dc1..da1c0a8101 100644 --- a/tools/aws_config_offline/CertificateConfigurator.html +++ b/tools/aws_config_offline/CertificateConfigurator.html @@ -6,7 +6,7 @@ - + From 257c2916c060a52e32448840ec5313912d8272cd Mon Sep 17 00:00:00 2001 From: Paul Bartell Date: Fri, 2 Feb 2024 12:35:45 -0800 Subject: [PATCH 11/21] Remove included server key/certs from WolfSSL Demo --- .../ca-cert.pem | 93 --------- .../server-cert.pem | 185 ------------------ .../server-key.pem | 27 --- 3 files changed, 305 deletions(-) delete mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/ca-cert.pem delete mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/server-cert.pem delete mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/server-key.pem diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/ca-cert.pem b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/ca-cert.pem deleted file mode 100644 index a72435e0f8..0000000000 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/ca-cert.pem +++ /dev/null @@ -1,93 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: - 5e:ba:a4:f4:b1:f7:48:25:e3:5f:9b:da:a1:13:ed:d5:2b:03:67:15 - Signature Algorithm: sha256WithRSAEncryption - Issuer: C = US, ST = Montana, L = Bozeman, O = Sawtooth, OU = Consulting, CN = www.wolfssl.com, emailAddress = info@wolfssl.com - Validity - Not Before: Jun 19 13:23:41 2020 GMT - Not After : Mar 16 13:23:41 2023 GMT - Subject: C = US, ST = Montana, L = Bozeman, O = Sawtooth, OU = Consulting, CN = www.wolfssl.com, emailAddress = info@wolfssl.com - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public-Key: (2048 bit) - Modulus: - 00:bf:0c:ca:2d:14:b2:1e:84:42:5b:cd:38:1f:4a: - f2:4d:75:10:f1:b6:35:9f:df:ca:7d:03:98:d3:ac: - de:03:66:ee:2a:f1:d8:b0:7d:6e:07:54:0b:10:98: - 21:4d:80:cb:12:20:e7:cc:4f:de:45:7d:c9:72:77: - 32:ea:ca:90:bb:69:52:10:03:2f:a8:f3:95:c5:f1: - 8b:62:56:1b:ef:67:6f:a4:10:41:95:ad:0a:9b:e3: - a5:c0:b0:d2:70:76:50:30:5b:a8:e8:08:2c:7c:ed: - a7:a2:7a:8d:38:29:1c:ac:c7:ed:f2:7c:95:b0:95: - 82:7d:49:5c:38:cd:77:25:ef:bd:80:75:53:94:3c: - 3d:ca:63:5b:9f:15:b5:d3:1d:13:2f:19:d1:3c:db: - 76:3a:cc:b8:7d:c9:e5:c2:d7:da:40:6f:d8:21:dc: - 73:1b:42:2d:53:9c:fe:1a:fc:7d:ab:7a:36:3f:98: - de:84:7c:05:67:ce:6a:14:38:87:a9:f1:8c:b5:68: - cb:68:7f:71:20:2b:f5:a0:63:f5:56:2f:a3:26:d2: - b7:6f:b1:5a:17:d7:38:99:08:fe:93:58:6f:fe:c3: - 13:49:08:16:0b:a7:4d:67:00:52:31:67:23:4e:98: - ed:51:45:1d:b9:04:d9:0b:ec:d8:28:b3:4b:bd:ed: - 36:79 - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Subject Key Identifier: - 27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 - X509v3 Authority Key Identifier: - keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 - DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com - serial:5E:BA:A4:F4:B1:F7:48:25:E3:5F:9B:DA:A1:13:ED:D5:2B:03:67:15 - - X509v3 Basic Constraints: - CA:TRUE - X509v3 Subject Alternative Name: - DNS:example.com, IP Address:127.0.0.1 - X509v3 Extended Key Usage: - TLS Web Server Authentication, TLS Web Client Authentication - Signature Algorithm: sha256WithRSAEncryption - b9:ed:94:3e:00:73:2d:a5:d1:04:b3:fb:dc:f0:b7:0d:3d:ad: - 96:74:4c:92:67:ad:6d:7c:e2:99:6a:33:ca:b2:0f:04:5a:a5: - 67:f8:e3:0b:3d:f5:d0:5b:1e:20:52:12:92:28:ea:31:a3:51: - 9e:8b:d2:39:e4:25:ea:61:61:41:16:2d:54:50:d3:fb:d0:34: - 00:10:f1:7b:bc:f0:08:a7:f5:27:5e:7e:40:9d:99:b0:d3:31: - 11:c3:9d:a9:51:a0:17:cf:83:2c:55:84:e0:d5:92:a0:05:3a: - 9f:b8:75:f8:1b:e5:f7:a4:6c:e9:aa:25:8b:19:93:46:1f:3f: - 33:af:47:29:cf:7b:8b:59:27:eb:d7:4f:cb:33:19:fa:5f:ee: - d8:13:e9:0c:07:ad:3b:c0:7f:10:d7:e4:ed:e8:db:16:e1:1f: - a4:7f:16:3c:bd:d7:11:f2:d4:3a:a9:9b:95:e1:39:51:99:eb: - 5b:65:46:ef:63:84:73:95:23:b8:bf:b5:f6:4d:12:71:f7:ff: - 33:aa:4a:8c:65:73:73:89:69:df:a6:dc:a4:91:ff:ae:c7:28: - 93:b5:1a:de:a9:8f:2b:30:85:83:8b:99:82:ca:b3:7c:11:10: - 88:9d:8e:6c:2c:f3:05:6f:cb:80:85:16:b7:ed:e4:68:fb:b6: - b6:31:8a:7d ------BEGIN CERTIFICATE----- -MIIE/zCCA+egAwIBAgIUXrqk9LH3SCXjX5vaoRPt1SsDZxUwDQYJKoZIhvcNAQEL -BQAwgZQxCzAJBgNVBAYTAlVTMRAwDgYDVQQIDAdNb250YW5hMRAwDgYDVQQHDAdC -b3plbWFuMREwDwYDVQQKDAhTYXd0b290aDETMBEGA1UECwwKQ29uc3VsdGluZzEY -MBYGA1UEAwwPd3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdv -bGZzc2wuY29tMB4XDTIwMDYxOTEzMjM0MVoXDTIzMDMxNjEzMjM0MVowgZQxCzAJ -BgNVBAYTAlVTMRAwDgYDVQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMREw -DwYDVQQKDAhTYXd0b290aDETMBEGA1UECwwKQ29uc3VsdGluZzEYMBYGA1UEAwwP -d3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29t -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvwzKLRSyHoRCW804H0ry -TXUQ8bY1n9/KfQOY06zeA2buKvHYsH1uB1QLEJghTYDLEiDnzE/eRX3Jcncy6sqQ -u2lSEAMvqPOVxfGLYlYb72dvpBBBla0Km+OlwLDScHZQMFuo6AgsfO2nonqNOCkc -rMft8nyVsJWCfUlcOM13Je+9gHVTlDw9ymNbnxW10x0TLxnRPNt2Osy4fcnlwtfa -QG/YIdxzG0ItU5z+Gvx9q3o2P5jehHwFZ85qFDiHqfGMtWjLaH9xICv1oGP1Vi+j -JtK3b7FaF9c4mQj+k1hv/sMTSQgWC6dNZwBSMWcjTpjtUUUduQTZC+zYKLNLve02 -eQIDAQABo4IBRTCCAUEwHQYDVR0OBBYEFCeOZxF0wyYdP+0zY7Ok2B0w5ejVMIHU -BgNVHSMEgcwwgcmAFCeOZxF0wyYdP+0zY7Ok2B0w5ejVoYGapIGXMIGUMQswCQYD -VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8G -A1UECgwIU2F3dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3 -dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbYIU -Xrqk9LH3SCXjX5vaoRPt1SsDZxUwDAYDVR0TBAUwAwEB/zAcBgNVHREEFTATggtl -eGFtcGxlLmNvbYcEfwAAATAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIw -DQYJKoZIhvcNAQELBQADggEBALntlD4Acy2l0QSz+9zwtw09rZZ0TJJnrW184plq -M8qyDwRapWf44ws99dBbHiBSEpIo6jGjUZ6L0jnkJephYUEWLVRQ0/vQNAAQ8Xu8 -8Ain9SdefkCdmbDTMRHDnalRoBfPgyxVhODVkqAFOp+4dfgb5fekbOmqJYsZk0Yf -PzOvRynPe4tZJ+vXT8szGfpf7tgT6QwHrTvAfxDX5O3o2xbhH6R/Fjy91xHy1Dqp -m5XhOVGZ61tlRu9jhHOVI7i/tfZNEnH3/zOqSoxlc3OJad+m3KSR/67HKJO1Gt6p -jyswhYOLmYLKs3wREIidjmws8wVvy4CFFrft5Gj7trYxin0= ------END CERTIFICATE----- diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/server-cert.pem b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/server-cert.pem deleted file mode 100644 index bd6715b740..0000000000 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/server-cert.pem +++ /dev/null @@ -1,185 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 1 (0x1) - Signature Algorithm: sha256WithRSAEncryption - Issuer: C = US, ST = Montana, L = Bozeman, O = Sawtooth, OU = Consulting, CN = www.wolfssl.com, emailAddress = info@wolfssl.com - Validity - Not Before: Jun 19 13:23:41 2020 GMT - Not After : Mar 16 13:23:41 2023 GMT - Subject: C = US, ST = Montana, L = Bozeman, O = wolfSSL, OU = Support, CN = www.wolfssl.com, emailAddress = info@wolfssl.com - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public-Key: (2048 bit) - Modulus: - 00:c0:95:08:e1:57:41:f2:71:6d:b7:d2:45:41:27: - 01:65:c6:45:ae:f2:bc:24:30:b8:95:ce:2f:4e:d6: - f6:1c:88:bc:7c:9f:fb:a8:67:7f:fe:5c:9c:51:75: - f7:8a:ca:07:e7:35:2f:8f:e1:bd:7b:c0:2f:7c:ab: - 64:a8:17:fc:ca:5d:7b:ba:e0:21:e5:72:2e:6f:2e: - 86:d8:95:73:da:ac:1b:53:b9:5f:3f:d7:19:0d:25: - 4f:e1:63:63:51:8b:0b:64:3f:ad:43:b8:a5:1c:5c: - 34:b3:ae:00:a0:63:c5:f6:7f:0b:59:68:78:73:a6: - 8c:18:a9:02:6d:af:c3:19:01:2e:b8:10:e3:c6:cc: - 40:b4:69:a3:46:33:69:87:6e:c4:bb:17:a6:f3:e8: - dd:ad:73:bc:7b:2f:21:b5:fd:66:51:0c:bd:54:b3: - e1:6d:5f:1c:bc:23:73:d1:09:03:89:14:d2:10:b9: - 64:c3:2a:d0:a1:96:4a:bc:e1:d4:1a:5b:c7:a0:c0: - c1:63:78:0f:44:37:30:32:96:80:32:23:95:a1:77: - ba:13:d2:97:73:e2:5d:25:c9:6a:0d:c3:39:60:a4: - b4:b0:69:42:42:09:e9:d8:08:bc:33:20:b3:58:22: - a7:aa:eb:c4:e1:e6:61:83:c5:d2:96:df:d9:d0:4f: - ad:d7 - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Subject Key Identifier: - B3:11:32:C9:92:98:84:E2:C9:F8:D0:3B:6E:03:42:CA:1F:0E:8E:3C - X509v3 Authority Key Identifier: - keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 - DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com - serial:5E:BA:A4:F4:B1:F7:48:25:E3:5F:9B:DA:A1:13:ED:D5:2B:03:67:15 - - X509v3 Basic Constraints: - CA:TRUE - X509v3 Subject Alternative Name: - DNS:example.com, IP Address:127.0.0.1 - X509v3 Extended Key Usage: - TLS Web Server Authentication, TLS Web Client Authentication - Signature Algorithm: sha256WithRSAEncryption - 35:91:e6:72:cc:0b:f1:47:8f:3d:e3:5d:52:2f:83:b8:b1:3b: - 6d:d6:ac:13:79:74:14:ff:07:8d:ee:74:77:64:ff:b8:83:1d: - 81:80:84:bb:38:fa:8f:f3:75:29:23:ce:e5:09:a8:13:85:14: - b6:6a:35:30:2c:1c:c4:0f:23:67:ea:ed:cb:91:c4:05:e3:ec: - 6b:be:11:bf:d9:9a:ab:93:17:9f:e4:9a:59:d4:e7:cc:ce:dc: - 83:10:f5:cd:de:d7:35:75:4b:aa:7a:7a:ba:02:a0:b0:b5:c1: - 8a:6b:b1:72:cf:64:59:4e:d3:a4:a1:6c:64:4b:14:cf:a3:d6: - 37:0a:e6:f9:5b:21:be:de:0c:c1:cf:43:e1:18:0b:19:13:6b: - 8e:3d:df:0f:a7:43:fb:35:67:4a:50:e8:09:46:34:bd:f4:ab: - 1a:8f:bd:4d:1c:6b:20:be:1c:8c:ca:66:98:ba:03:67:f2:1c: - 3c:1e:01:f0:4d:c6:85:82:6f:a9:49:f7:1b:7d:6b:db:76:84: - 73:bb:16:c5:6e:74:ab:7b:fb:1c:e9:91:bb:29:73:1c:de:27: - b4:67:3b:10:51:f4:17:eb:b8:38:a0:9a:eb:37:5b:76:8f:39: - 12:39:35:d1:ca:fe:c0:26:fb:73:50:1e:2d:b9:d2:ba:e5:4c: - 35:bd:ed:7b ------BEGIN CERTIFICATE----- -MIIE6DCCA9CgAwIBAgIBATANBgkqhkiG9w0BAQsFADCBlDELMAkGA1UEBhMCVVMx -EDAOBgNVBAgMB01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xETAPBgNVBAoMCFNh -d3Rvb3RoMRMwEQYDVQQLDApDb25zdWx0aW5nMRgwFgYDVQQDDA93d3cud29sZnNz -bC5jb20xHzAdBgkqhkiG9w0BCQEWEGluZm9Ad29sZnNzbC5jb20wHhcNMjAwNjE5 -MTMyMzQxWhcNMjMwMzE2MTMyMzQxWjCBkDELMAkGA1UEBhMCVVMxEDAOBgNVBAgM -B01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xEDAOBgNVBAoMB3dvbGZTU0wxEDAO -BgNVBAsMB1N1cHBvcnQxGDAWBgNVBAMMD3d3dy53b2xmc3NsLmNvbTEfMB0GCSqG -SIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAMCVCOFXQfJxbbfSRUEnAWXGRa7yvCQwuJXOL07W9hyIvHyf+6hn -f/5cnFF194rKB+c1L4/hvXvAL3yrZKgX/Mpde7rgIeVyLm8uhtiVc9qsG1O5Xz/X -GQ0lT+FjY1GLC2Q/rUO4pRxcNLOuAKBjxfZ/C1loeHOmjBipAm2vwxkBLrgQ48bM -QLRpo0YzaYduxLsXpvPo3a1zvHsvIbX9ZlEMvVSz4W1fHLwjc9EJA4kU0hC5ZMMq -0KGWSrzh1Bpbx6DAwWN4D0Q3MDKWgDIjlaF3uhPSl3PiXSXJag3DOWCktLBpQkIJ -6dgIvDMgs1gip6rrxOHmYYPF0pbf2dBPrdcCAwEAAaOCAUUwggFBMB0GA1UdDgQW -BBSzETLJkpiE4sn40DtuA0LKHw6OPDCB1AYDVR0jBIHMMIHJgBQnjmcRdMMmHT/t -M2OzpNgdMOXo1aGBmqSBlzCBlDELMAkGA1UEBhMCVVMxEDAOBgNVBAgMB01vbnRh -bmExEDAOBgNVBAcMB0JvemVtYW4xETAPBgNVBAoMCFNhd3Rvb3RoMRMwEQYDVQQL -DApDb25zdWx0aW5nMRgwFgYDVQQDDA93d3cud29sZnNzbC5jb20xHzAdBgkqhkiG -9w0BCQEWEGluZm9Ad29sZnNzbC5jb22CFF66pPSx90gl41+b2qET7dUrA2cVMAwG -A1UdEwQFMAMBAf8wHAYDVR0RBBUwE4ILZXhhbXBsZS5jb22HBH8AAAEwHQYDVR0l -BBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMA0GCSqGSIb3DQEBCwUAA4IBAQA1keZy -zAvxR489411SL4O4sTtt1qwTeXQU/weN7nR3ZP+4gx2BgIS7OPqP83UpI87lCagT -hRS2ajUwLBzEDyNn6u3LkcQF4+xrvhG/2Zqrkxef5JpZ1OfMztyDEPXN3tc1dUuq -enq6AqCwtcGKa7Fyz2RZTtOkoWxkSxTPo9Y3Cub5WyG+3gzBz0PhGAsZE2uOPd8P -p0P7NWdKUOgJRjS99Ksaj71NHGsgvhyMymaYugNn8hw8HgHwTcaFgm+pSfcbfWvb -doRzuxbFbnSre/sc6ZG7KXMc3ie0ZzsQUfQX67g4oJrrN1t2jzkSOTXRyv7AJvtz -UB4tudK65Uw1ve17 ------END CERTIFICATE----- -Certificate: - Data: - Version: 3 (0x2) - Serial Number: - 5e:ba:a4:f4:b1:f7:48:25:e3:5f:9b:da:a1:13:ed:d5:2b:03:67:15 - Signature Algorithm: sha256WithRSAEncryption - Issuer: C = US, ST = Montana, L = Bozeman, O = Sawtooth, OU = Consulting, CN = www.wolfssl.com, emailAddress = info@wolfssl.com - Validity - Not Before: Jun 19 13:23:41 2020 GMT - Not After : Mar 16 13:23:41 2023 GMT - Subject: C = US, ST = Montana, L = Bozeman, O = Sawtooth, OU = Consulting, CN = www.wolfssl.com, emailAddress = info@wolfssl.com - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public-Key: (2048 bit) - Modulus: - 00:bf:0c:ca:2d:14:b2:1e:84:42:5b:cd:38:1f:4a: - f2:4d:75:10:f1:b6:35:9f:df:ca:7d:03:98:d3:ac: - de:03:66:ee:2a:f1:d8:b0:7d:6e:07:54:0b:10:98: - 21:4d:80:cb:12:20:e7:cc:4f:de:45:7d:c9:72:77: - 32:ea:ca:90:bb:69:52:10:03:2f:a8:f3:95:c5:f1: - 8b:62:56:1b:ef:67:6f:a4:10:41:95:ad:0a:9b:e3: - a5:c0:b0:d2:70:76:50:30:5b:a8:e8:08:2c:7c:ed: - a7:a2:7a:8d:38:29:1c:ac:c7:ed:f2:7c:95:b0:95: - 82:7d:49:5c:38:cd:77:25:ef:bd:80:75:53:94:3c: - 3d:ca:63:5b:9f:15:b5:d3:1d:13:2f:19:d1:3c:db: - 76:3a:cc:b8:7d:c9:e5:c2:d7:da:40:6f:d8:21:dc: - 73:1b:42:2d:53:9c:fe:1a:fc:7d:ab:7a:36:3f:98: - de:84:7c:05:67:ce:6a:14:38:87:a9:f1:8c:b5:68: - cb:68:7f:71:20:2b:f5:a0:63:f5:56:2f:a3:26:d2: - b7:6f:b1:5a:17:d7:38:99:08:fe:93:58:6f:fe:c3: - 13:49:08:16:0b:a7:4d:67:00:52:31:67:23:4e:98: - ed:51:45:1d:b9:04:d9:0b:ec:d8:28:b3:4b:bd:ed: - 36:79 - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Subject Key Identifier: - 27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 - X509v3 Authority Key Identifier: - keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 - DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com - serial:5E:BA:A4:F4:B1:F7:48:25:E3:5F:9B:DA:A1:13:ED:D5:2B:03:67:15 - - X509v3 Basic Constraints: - CA:TRUE - X509v3 Subject Alternative Name: - DNS:example.com, IP Address:127.0.0.1 - X509v3 Extended Key Usage: - TLS Web Server Authentication, TLS Web Client Authentication - Signature Algorithm: sha256WithRSAEncryption - b9:ed:94:3e:00:73:2d:a5:d1:04:b3:fb:dc:f0:b7:0d:3d:ad: - 96:74:4c:92:67:ad:6d:7c:e2:99:6a:33:ca:b2:0f:04:5a:a5: - 67:f8:e3:0b:3d:f5:d0:5b:1e:20:52:12:92:28:ea:31:a3:51: - 9e:8b:d2:39:e4:25:ea:61:61:41:16:2d:54:50:d3:fb:d0:34: - 00:10:f1:7b:bc:f0:08:a7:f5:27:5e:7e:40:9d:99:b0:d3:31: - 11:c3:9d:a9:51:a0:17:cf:83:2c:55:84:e0:d5:92:a0:05:3a: - 9f:b8:75:f8:1b:e5:f7:a4:6c:e9:aa:25:8b:19:93:46:1f:3f: - 33:af:47:29:cf:7b:8b:59:27:eb:d7:4f:cb:33:19:fa:5f:ee: - d8:13:e9:0c:07:ad:3b:c0:7f:10:d7:e4:ed:e8:db:16:e1:1f: - a4:7f:16:3c:bd:d7:11:f2:d4:3a:a9:9b:95:e1:39:51:99:eb: - 5b:65:46:ef:63:84:73:95:23:b8:bf:b5:f6:4d:12:71:f7:ff: - 33:aa:4a:8c:65:73:73:89:69:df:a6:dc:a4:91:ff:ae:c7:28: - 93:b5:1a:de:a9:8f:2b:30:85:83:8b:99:82:ca:b3:7c:11:10: - 88:9d:8e:6c:2c:f3:05:6f:cb:80:85:16:b7:ed:e4:68:fb:b6: - b6:31:8a:7d ------BEGIN CERTIFICATE----- -MIIE/zCCA+egAwIBAgIUXrqk9LH3SCXjX5vaoRPt1SsDZxUwDQYJKoZIhvcNAQEL -BQAwgZQxCzAJBgNVBAYTAlVTMRAwDgYDVQQIDAdNb250YW5hMRAwDgYDVQQHDAdC -b3plbWFuMREwDwYDVQQKDAhTYXd0b290aDETMBEGA1UECwwKQ29uc3VsdGluZzEY -MBYGA1UEAwwPd3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdv -bGZzc2wuY29tMB4XDTIwMDYxOTEzMjM0MVoXDTIzMDMxNjEzMjM0MVowgZQxCzAJ -BgNVBAYTAlVTMRAwDgYDVQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMREw -DwYDVQQKDAhTYXd0b290aDETMBEGA1UECwwKQ29uc3VsdGluZzEYMBYGA1UEAwwP -d3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29t -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvwzKLRSyHoRCW804H0ry -TXUQ8bY1n9/KfQOY06zeA2buKvHYsH1uB1QLEJghTYDLEiDnzE/eRX3Jcncy6sqQ -u2lSEAMvqPOVxfGLYlYb72dvpBBBla0Km+OlwLDScHZQMFuo6AgsfO2nonqNOCkc -rMft8nyVsJWCfUlcOM13Je+9gHVTlDw9ymNbnxW10x0TLxnRPNt2Osy4fcnlwtfa -QG/YIdxzG0ItU5z+Gvx9q3o2P5jehHwFZ85qFDiHqfGMtWjLaH9xICv1oGP1Vi+j -JtK3b7FaF9c4mQj+k1hv/sMTSQgWC6dNZwBSMWcjTpjtUUUduQTZC+zYKLNLve02 -eQIDAQABo4IBRTCCAUEwHQYDVR0OBBYEFCeOZxF0wyYdP+0zY7Ok2B0w5ejVMIHU -BgNVHSMEgcwwgcmAFCeOZxF0wyYdP+0zY7Ok2B0w5ejVoYGapIGXMIGUMQswCQYD -VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8G -A1UECgwIU2F3dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3 -dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbYIU -Xrqk9LH3SCXjX5vaoRPt1SsDZxUwDAYDVR0TBAUwAwEB/zAcBgNVHREEFTATggtl -eGFtcGxlLmNvbYcEfwAAATAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIw -DQYJKoZIhvcNAQELBQADggEBALntlD4Acy2l0QSz+9zwtw09rZZ0TJJnrW184plq -M8qyDwRapWf44ws99dBbHiBSEpIo6jGjUZ6L0jnkJephYUEWLVRQ0/vQNAAQ8Xu8 -8Ain9SdefkCdmbDTMRHDnalRoBfPgyxVhODVkqAFOp+4dfgb5fekbOmqJYsZk0Yf -PzOvRynPe4tZJ+vXT8szGfpf7tgT6QwHrTvAfxDX5O3o2xbhH6R/Fjy91xHy1Dqp -m5XhOVGZ61tlRu9jhHOVI7i/tfZNEnH3/zOqSoxlc3OJad+m3KSR/67HKJO1Gt6p -jyswhYOLmYLKs3wREIidjmws8wVvy4CFFrft5Gj7trYxin0= ------END CERTIFICATE----- diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/server-key.pem b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/server-key.pem deleted file mode 100644 index d1627f4d4a..0000000000 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_WolfSSL_Windows_Simulator/server-key.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEAwJUI4VdB8nFtt9JFQScBZcZFrvK8JDC4lc4vTtb2HIi8fJ/7 -qGd//lycUXX3isoH5zUvj+G9e8AvfKtkqBf8yl17uuAh5XIuby6G2JVz2qwbU7lf -P9cZDSVP4WNjUYsLZD+tQ7ilHFw0s64AoGPF9n8LWWh4c6aMGKkCba/DGQEuuBDj -xsxAtGmjRjNph27Euxem8+jdrXO8ey8htf1mUQy9VLPhbV8cvCNz0QkDiRTSELlk -wyrQoZZKvOHUGlvHoMDBY3gPRDcwMpaAMiOVoXe6E9KXc+JdJclqDcM5YKS0sGlC -Qgnp2Ai8MyCzWCKnquvE4eZhg8XSlt/Z0E+t1wIDAQABAoIBAQCa0DQPUmIFUAHv -n+1kbsLE2hryhNeSEEiSxOlq64t1bMZ5OPLJckqGZFSVd8vDmp231B2kAMieTuTd -x7pnFsF0vKnWlI8rMBr77d8hBSPZSjm9mGtlmrjcxH3upkMVLj2+HSJgKnMw1T7Y -oqyGQy7E9WReP4l1DxHYUSVOn9iqo85gs+KK2X4b8GTKmlsFC1uqy+XjP24yIgXz -0PrvdFKB4l90073/MYNFdfpjepcu1rYZxpIm5CgGUFAOeC6peA0Ul7QS2DFAq6EB -QcIw+AdfFuRhd9Jg8p+N6PS662PeKpeB70xs5lU0USsoNPRTHMRYCj+7r7X3SoVD -LTzxWFiBAoGBAPIsVHY5I2PJEDK3k62vvhl1loFk5rW4iUJB0W3QHBv4G6xpyzY8 -ZH3c9Bm4w2CxV0hfUk9ZOlV/MsAZQ1A/rs5vF/MOn0DKTq0VO8l56cBZOHNwnAp8 -yTpIMqfYSXUKhcLC/RVz2pkJKmmanwpxv7AEpox6Wm9IWlQ7xrFTF9/nAoGBAMuT -3ncVXbdcXHzYkKmYLdZpDmOzo9ymzItqpKISjI57SCyySzfcBhh96v52odSh6T8N -zRtfr1+elltbD6F8r7ObkNtXczrtsCNErkFPHwdCEyNMy/r0FKTV9542fFufqDzB -hV900jkt/9CE3/uzIHoumxeu5roLrl9TpFLtG8SRAoGBAOyY2rvV/vlSSn0CVUlv -VW5SL4SjK7OGYrNU0mNS2uOIdqDvixWl0xgUcndex6MEH54ZYrUbG57D8rUy+UzB -qusMJn3UX0pRXKRFBnBEp1bA1CIUdp7YY1CJkNPiv4GVkjFBhzkaQwsYpVMfORpf -H0O8h2rfbtMiAP4imHBOGhkpAoGBAIpBVihRnl/Ungs7mKNU8mxW1KrpaTOFJAza -1AwtxL9PAmk4fNTm3Ezt1xYRwz4A58MmwFEC3rt1nG9WnHrzju/PisUr0toGakTJ -c/5umYf4W77xfOZltU9s8MnF/xbKixsX4lg9ojerAby/QM5TjI7t7+5ZneBj5nxe -9Y5L8TvBAoGATUX5QIzFW/QqGoq08hysa+kMVja3TnKW1eWK0uL/8fEYEz2GCbjY -dqfJHHFSlDBD4PF4dP1hG0wJzOZoKnGtHN9DvFbbpaS+NXCkXs9P/ABVmTo9I89n -WvUi+LUp0EQR6zUuRr79jhiyX6i/GTKh9dwD5nyaHwx8qbAOITc78bA= ------END RSA PRIVATE KEY----- From 3c5fbc769b5a42a9d6a89df9f12d6f19640fb9ca Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Tue, 6 Feb 2024 20:30:21 +0800 Subject: [PATCH 12/21] Update unit test to address vTaskDelete and vTaskSuspend change for SMP (#1178) * Update the unit test to address the problem task self void state change --- .../smp/config_assert/config_assert_utest.c | 12 ------------ ...multiple_priorities_no_timeslice_mock_utest.c | 16 ---------------- 2 files changed, 28 deletions(-) diff --git a/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c b/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c index 58a524b1c1..1b70c461cc 100644 --- a/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c +++ b/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c @@ -395,10 +395,6 @@ void test_vTaskDelete_assert_scheduler_suspended_eq_1( void ) listLIST_ITEM_CONTAINER_ExpectAnyArgsAndReturn( NULL ); vListInsertEnd_ExpectAnyArgs(); vPortCurrentTaskDying_ExpectAnyArgs(); - vFakePortExitCriticalSection_Expect(); - - /* Critical section for check task is running. */ - vFakePortEnterCriticalSection_Expect(); vFakePortGetCoreID_ExpectAndReturn( 1 ); EXPECT_ASSERT_BREAK( vTaskDelete( xTaskToDelete ) ); @@ -446,15 +442,7 @@ void test_vTaskSuspend_assert_schedulersuspended_ne_zero( void ) uxListRemove_ExpectAnyArgsAndReturn( pdTRUE ); listLIST_ITEM_CONTAINER_ExpectAnyArgsAndReturn( NULL ); vListInsertEnd_ExpectAnyArgs(); - vFakePortExitCriticalSection_Expect(); - - /* Reset the next expected unblock time if scheduler is running. */ - vFakePortEnterCriticalSection_Expect(); listLIST_IS_EMPTY_ExpectAnyArgsAndReturn( pdTRUE ); - vFakePortExitCriticalSection_Expect(); - - /* Check task run state in critical section. */ - vFakePortEnterCriticalSection_Expect(); vFakePortGetCoreID_ExpectAndReturn( 1 ); EXPECT_ASSERT_BREAK( vTaskSuspend( xTaskToSuspend ) ); diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c index 3fb5783ce3..f6f59d73aa 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c @@ -239,10 +239,6 @@ void test_coverage_vTaskSuspend_scheduler_running_false( void ) vListInsertEnd_ExpectAnyArgs(); vFakePortExitCriticalSection_Expect(); - /* Enter critical section to check task run state. */ - vFakePortEnterCriticalSection_Expect(); - vFakePortExitCriticalSection_Expect(); - /* API call. */ vTaskSuspend( &xTaskTCBs[ 0 ] ); @@ -281,10 +277,6 @@ void test_coverage_vTaskSuspend_running_state_below_range( void ) vListInsertEnd_ExpectAnyArgs(); vFakePortExitCriticalSection_Expect(); - /* Enter critical section to check task run state. */ - vFakePortEnterCriticalSection_Expect(); - vFakePortExitCriticalSection_Expect(); - /* API call. */ vTaskSuspend( &xTaskTCBs[ 0 ] ); @@ -322,10 +314,6 @@ void test_coverage_vTaskSuspend_running_state_above_range( void ) vListInsertEnd_ExpectAnyArgs(); vFakePortExitCriticalSection_Expect(); - /* Enter critical section to check task run state. */ - vFakePortEnterCriticalSection_Expect(); - vFakePortExitCriticalSection_Expect(); - /* API call. */ vTaskSuspend( &xTaskTCBs[ 0 ] ); @@ -545,10 +533,6 @@ void test_coverage_vTaskDelete_task_not_running( void ) vFakePortExitCriticalSection_Expect(); - /* Critical section for check task is running. */ - vFakePortEnterCriticalSection_Expect(); - vFakePortExitCriticalSection_Expect(); - /* API Call */ vTaskDelete( xTaskToDelete ); From b31b3d4eb33e815b7aef8e88831a14387751ed69 Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Tue, 6 Feb 2024 21:08:05 +0800 Subject: [PATCH 13/21] Update kernel submodule to address vTaskDelete and vTaskSuspend change (#1179) --- FreeRTOS/Source | 2 +- manifest.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FreeRTOS/Source b/FreeRTOS/Source index 1de764ba87..57a5ed7f67 160000 --- a/FreeRTOS/Source +++ b/FreeRTOS/Source @@ -1 +1 @@ -Subproject commit 1de764ba879a36fe3e155dece2d11b1116b64360 +Subproject commit 57a5ed7f675e828fe020c33e636e094fa1354ea8 diff --git a/manifest.yml b/manifest.yml index 7031d693c5..98f114c28d 100644 --- a/manifest.yml +++ b/manifest.yml @@ -5,7 +5,7 @@ license: "MIT" dependencies: - name: "FreeRTOS-Kernel" - version: "1de764ba8" + version: "57a5ed7f6" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git" From ce28d945163e6b17b2652b2b58a3dd9fdd2804a6 Mon Sep 17 00:00:00 2001 From: Darian <32921628+Dazza0@users.noreply.github.com> Date: Wed, 7 Feb 2024 10:51:43 +0800 Subject: [PATCH 14/21] Update unit tests due to task notification changes (#1177) This commit updates the CMock unit tests according to the changes introduced to https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/982. Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> --- .../smp/config_assert/config_assert_utest.c | 1 + ...tiple_priorities_no_timeslice_mock_utest.c | 52 ++++--------------- FreeRTOS/Test/CMock/tasks/tasks_1_utest.c | 24 +++++++-- 3 files changed, 32 insertions(+), 45 deletions(-) diff --git a/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c b/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c index 1b70c461cc..b738b1554b 100644 --- a/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c +++ b/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c @@ -583,6 +583,7 @@ void test_prvGetExpectedIdleTime_assert_nextUnblock_lt_xTickCount( void ) /* vTaskSuspendAll */ vFakePortAssertIfISR_Expect(); + vFakePortGetCoreID_ExpectAndReturn( 0 ); ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); vFakePortGetTaskLock_Expect(); vFakePortGetISRLock_Expect(); diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c index f6f59d73aa..53079d74a2 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c @@ -619,46 +619,6 @@ void test_coverage_vTaskPreemptionDisable_null_handle( void ) TEST_ASSERT_EQUAL( pdTRUE, pxCurrentTCBs[ 0 ]->xPreemptionDisable ); } -/** - * @brief This test ensures that when we call vTaskSuspendAll and we task of the - * current core has a critical nesting count of 1 only the scheduler is - * suspended - * - * Coverage - * @code{c} - * vTaskSuspendAll(); - * - * if( portGET_CRITICAL_NESTING_COUNT() == 0U ) - * - * @endcode - * - * configNUMBER_OF_CORES > 1 - */ -void test_coverage_vTaskSuspendAll_critical_nesting_ne_zero( void ) -{ - TCB_t xTask = { 0 }; - - xTask.uxCriticalNesting = 1; - pxCurrentTCBs[ 0 ] = &xTask; - xSchedulerRunning = pdTRUE; - uxSchedulerSuspended = 0U; - - /* Test Expectations */ - vFakePortAssertIfISR_Expect(); - ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); - vFakePortGetTaskLock_Expect(); - vFakePortGetCoreID_ExpectAndReturn( 0 ); - vFakePortGetISRLock_Expect(); - vFakePortReleaseISRLock_Expect(); - vFakePortClearInterruptMask_Expect( 0 ); - - /* API Call */ - vTaskSuspendAll(); - - /* Test Verifications */ - TEST_ASSERT_EQUAL( 1, uxSchedulerSuspended ); -} - /** * @brief This test ensures that when we call prvGetExpectedIdleTime and the top * ready priority is greater than the idle task, we return zero, @@ -840,12 +800,17 @@ void test_coverage_prvGetExpectedIdleTime_ready_list_eq_1( void ) /* vTaskSuspendAll */ vFakePortAssertIfISR_Expect(); + vFakePortGetCoreID_ExpectAndReturn( 0 ); ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); vFakePortGetTaskLock_Expect(); + /* prvCheckForRunStateChange */ + vFakePortAssertIfISR_Expect(); + vFakePortGetCoreID_ExpectAndReturn( 0 ); + /* End of prvCheckForRunStateChange */ vFakePortGetISRLock_Expect(); vFakePortReleaseISRLock_Expect(); vFakePortClearInterruptMask_Expect( 0 ); - + /* End of vTaskSuspendAll */ ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); vFakePortGetCoreID_ExpectAndReturn( 0 ); @@ -941,11 +906,16 @@ void test_coverage_prvGetExpectedIdleTime_ready_list_eq_2( void ) /* vTaskSuspendAll */ vFakePortAssertIfISR_Stub( port_assert_if_isr_cb ); + vFakePortGetCoreID_ExpectAndReturn( 0 ); ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); vFakePortGetTaskLock_Expect(); + /* prvCheckForRunStateChange */ + vFakePortGetCoreID_ExpectAndReturn( 0 ); + /* End of prvCheckForRunStateChange */ vFakePortGetISRLock_Expect(); vFakePortReleaseISRLock_Expect(); vFakePortClearInterruptMask_Expect( 0 ); + /* End of vTaskSuspendAll */ ulFakePortSetInterruptMask_ExpectAndReturn( 0 ); diff --git a/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c b/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c index 8a376d8e10..b931400b33 100644 --- a/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c +++ b/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c @@ -4928,6 +4928,8 @@ void test_ulTaskGenericNotifyTake_success( void ) task_handle = create_task(); task_handle->ulNotifiedValue[ uxIndexToWait ] = 0; /* Expectations */ + /* xTaskResumeAll */ + listLIST_IS_EMPTY_ExpectAndReturn( &xPendingReadyList, pdTRUE ); /* API Call */ ret_gen_notify_take = ulTaskGenericNotifyTake( uxIndexToWait, pdFALSE, @@ -4948,6 +4950,8 @@ void test_ulTaskGenericNotifyTake_success2( void ) task_handle = create_task(); task_handle->ulNotifiedValue[ uxIndexToWait ] = 2; /* Expectations */ + /* xTaskResumeAll */ + listLIST_IS_EMPTY_ExpectAndReturn( &xPendingReadyList, pdTRUE ); /* API Call */ ret_gen_notify_take = ulTaskGenericNotifyTake( uxIndexToWait, pdFALSE, @@ -4968,6 +4972,8 @@ void test_ulTaskGenericNotifyTake_success_clear_count( void ) task_handle = create_task(); task_handle->ulNotifiedValue[ uxIndexToWait ] = 5; /* Expectations */ + /* xTaskResumeAll */ + listLIST_IS_EMPTY_ExpectAndReturn( &xPendingReadyList, pdTRUE ); /* API Call */ ret_gen_notify_take = ulTaskGenericNotifyTake( uxIndexToWait, pdTRUE, @@ -4993,7 +4999,8 @@ void test_ulTaskGenericNotifyTake_success_yield( void ) uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, 1 ); listSET_LIST_ITEM_VALUE_Expect( &ptcb->xStateListItem, xTickCount + 9 ); vListInsert_Expect( pxDelayedTaskList, &ptcb->xStateListItem ); - listLIST_IS_EMPTY_ExpectAnyArgsAndReturn( pdTRUE ); + /* xTaskResumeAll */ + listLIST_IS_EMPTY_ExpectAndReturn( &xPendingReadyList, pdTRUE ); /* API Call */ ret_gen_notify_take = ulTaskGenericNotifyTake( uxIndexToWait, pdFALSE, @@ -5607,16 +5614,21 @@ void test_xTaskGenericNotifyWait_success_notif_received( void ) TaskHandle_t task_handle; + /* Setup */ task_handle = create_task(); ptcb = task_handle; ptcb->ucNotifyState[ uxIndexToWait ] = 2; /* taskNOTIFICATION_RECEIVED */ ptcb->ulNotifiedValue[ uxIndexToWait ] = 5; - + /* Expectations */ + /* xTaskResumeAll */ + listLIST_IS_EMPTY_ExpectAndReturn( &xPendingReadyList, pdTRUE ); + /* API Call */ ret = xTaskGenericNotifyWait( uxIndexToWait, ulBitsToClearOnEntry, ulBitsToClearOnExit, &pullNotificationValue, xTicksToWait ); + /* Validations */ TEST_ASSERT_EQUAL( pdTRUE, ret ); TEST_ASSERT_EQUAL( 5, pullNotificationValue ); ASSERT_PORT_YIELD_WITHIN_API_NOT_CALLED(); @@ -5667,12 +5679,14 @@ void test_xTaskGenericNotifyWait_success_notif_not_received_no_wait( void ) TaskHandle_t task_handle; + /* Setup */ task_handle = create_task(); ptcb = task_handle; ptcb->ucNotifyState[ uxIndexToWait ] = 1; /* taskWAITING_NOTIFICATION */ ptcb->ulNotifiedValue[ uxIndexToWait ] = 5; /* Expectations */ - + /* xTaskResumeAll */ + listLIST_IS_EMPTY_ExpectAndReturn( &xPendingReadyList, pdTRUE ); /* API Call */ ret = xTaskGenericNotifyWait( uxIndexToWait, ulBitsToClearOnEntry, @@ -5695,12 +5709,14 @@ void test_xTaskGenericNotifyWait_success_notif_not_received_pull_null( void ) TaskHandle_t task_handle; + /* Setup */ task_handle = create_task(); ptcb = task_handle; ptcb->ucNotifyState[ uxIndexToWait ] = 1; /* taskWAITING_NOTIFICATION */ ptcb->ulNotifiedValue[ uxIndexToWait ] = 5; /* Expectations */ - + /* xTaskResumeAll */ + listLIST_IS_EMPTY_ExpectAndReturn( &xPendingReadyList, pdTRUE ); /* API Call */ ret = xTaskGenericNotifyWait( uxIndexToWait, ulBitsToClearOnEntry, From 5be0af160b6589e2f6cbb570c13ab26e795ed10c Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Wed, 7 Feb 2024 14:12:40 +0800 Subject: [PATCH 15/21] Update kernel submodule for task notify change (#1182) --- FreeRTOS/Source | 2 +- manifest.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FreeRTOS/Source b/FreeRTOS/Source index 57a5ed7f67..7284d84dc8 160000 --- a/FreeRTOS/Source +++ b/FreeRTOS/Source @@ -1 +1 @@ -Subproject commit 57a5ed7f675e828fe020c33e636e094fa1354ea8 +Subproject commit 7284d84dc88c5aaf2dc8337044177728b8bdae2d diff --git a/manifest.yml b/manifest.yml index 98f114c28d..42150fba4d 100644 --- a/manifest.yml +++ b/manifest.yml @@ -5,7 +5,7 @@ license: "MIT" dependencies: - name: "FreeRTOS-Kernel" - version: "57a5ed7f6" + version: "7284d84dc" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git" From 9cb29445cd58ed76478694a1a9b92b6ac633b983 Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Thu, 8 Feb 2024 00:22:56 +0800 Subject: [PATCH 16/21] Add SMP suspend scheduler on target test (#1184) * Add SMP suspend scheduler on target test * Code review suggestion Signed-off-by: Gaurav Aggarwal --------- Signed-off-by: Gaurav Aggarwal Co-authored-by: Gaurav Aggarwal --- .../smp/suspend_scheduler/CMakeLists.txt | 33 +++ .../suspend_scheduler_test_runner.c | 73 +++++ .../smp/suspend_scheduler/suspend_scheduler.c | 258 ++++++++++++++++++ .../tests/smp/suspend_scheduler/test_config.h | 58 ++++ 4 files changed, 422 insertions(+) create mode 100644 FreeRTOS/Test/Target/boards/pico/tests/smp/suspend_scheduler/CMakeLists.txt create mode 100644 FreeRTOS/Test/Target/boards/pico/tests/smp/suspend_scheduler/suspend_scheduler_test_runner.c create mode 100644 FreeRTOS/Test/Target/tests/smp/suspend_scheduler/suspend_scheduler.c create mode 100644 FreeRTOS/Test/Target/tests/smp/suspend_scheduler/test_config.h diff --git a/FreeRTOS/Test/Target/boards/pico/tests/smp/suspend_scheduler/CMakeLists.txt b/FreeRTOS/Test/Target/boards/pico/tests/smp/suspend_scheduler/CMakeLists.txt new file mode 100644 index 0000000000..9d2a199a42 --- /dev/null +++ b/FreeRTOS/Test/Target/boards/pico/tests/smp/suspend_scheduler/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.13) + +project(example C CXX ASM) +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) + +set(TEST_INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/../../../../../tests/smp/suspend_scheduler) +set(TEST_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../../tests/smp/suspend_scheduler) + +add_library(suspend_scheduler INTERFACE) +target_sources(suspend_scheduler INTERFACE + ${BOARD_LIBRARY_DIR}/main.c + ${CMAKE_CURRENT_LIST_DIR}/suspend_scheduler_test_runner.c + ${TEST_SOURCE_DIR}/suspend_scheduler.c) + +target_include_directories(suspend_scheduler INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../../.. + ${TEST_INCLUDE_PATHS} + ) + +target_link_libraries(suspend_scheduler INTERFACE + FreeRTOS-Kernel + FreeRTOS-Kernel-Heap4 + ${BOARD_LINK_LIBRARIES}) + +add_executable(test_suspend_scheduler) +enable_board_functions(test_suspend_scheduler) +target_link_libraries(test_suspend_scheduler suspend_scheduler) +target_include_directories(test_suspend_scheduler PUBLIC + ${BOARD_INCLUDE_PATHS}) +target_compile_definitions(test_suspend_scheduler PRIVATE + ${BOARD_DEFINES} +) diff --git a/FreeRTOS/Test/Target/boards/pico/tests/smp/suspend_scheduler/suspend_scheduler_test_runner.c b/FreeRTOS/Test/Target/boards/pico/tests/smp/suspend_scheduler/suspend_scheduler_test_runner.c new file mode 100644 index 0000000000..e090edbe74 --- /dev/null +++ b/FreeRTOS/Test/Target/boards/pico/tests/smp/suspend_scheduler/suspend_scheduler_test_runner.c @@ -0,0 +1,73 @@ +/* + * FreeRTOS V202212.00 + * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +/** + * @file suspend_scheduler_test_runner.c + * @brief The implementation of main function to start test runner task. + * + * Procedure: + * - Initialize environment. + * - Run the test case. + */ + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Unit testing support functions. */ +#include "unity.h" + +/* Pico includes. */ +#include "pico/multicore.h" +#include "pico/stdlib.h" + +/*-----------------------------------------------------------*/ + +static void prvTestRunnerTask( void * pvParameters ); + +/*-----------------------------------------------------------*/ + +static void prvTestRunnerTask( void * pvParameters ) +{ + ( void ) pvParameters; + + /* Run test case. */ + vRunSuspendSchedulerTest(); + + vTaskDelete( NULL ); +} +/*-----------------------------------------------------------*/ + +void vRunTest( void ) +{ + xTaskCreate( prvTestRunnerTask, + "testRunner", + configMINIMAL_STACK_SIZE, + NULL, + configMAX_PRIORITIES - 1, + NULL ); +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Test/Target/tests/smp/suspend_scheduler/suspend_scheduler.c b/FreeRTOS/Test/Target/tests/smp/suspend_scheduler/suspend_scheduler.c new file mode 100644 index 0000000000..7ce6a11eaa --- /dev/null +++ b/FreeRTOS/Test/Target/tests/smp/suspend_scheduler/suspend_scheduler.c @@ -0,0 +1,258 @@ +/* + * FreeRTOS V202212.00 + * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +/** + * @file suspend_scheduler.c + * @brief Context switch shall not happen when the scheduler is suspended. + * + * Procedure: + * - Create 1 low priority task, T0. + * - Create n - 1 medium priority tasks, T1 ~ T(n - 1). + * - Suspend the scheduler in test runner task. + * - Increase T0's priority to high priority. + * - Verify that T0 is not running. + * - Resume the scheduler in test runner. + * - Verify that T0 is running. + * Expected: + * - T0 must not run even when its priority is raised when the scheduler is + * suspended. + */ + +/* Standard includes. */ +#include + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Unit testing support functions. */ +#include "unity.h" + +/*-----------------------------------------------------------*/ + +/** + * @brief Time to wait for other cores to run. + */ +#define TEST_BUSY_LOOPING_COUNT ( 10000 ) + +/** + * @brief Nop operation for busy looping. + */ +#ifdef portNOP + #define TEST_NOP portNOP +#else + #define TEST_NOP() __asm volatile ( "nop" ) +#endif + +/*-----------------------------------------------------------*/ + +/** + * @brief Task function for task T0. + */ +static void prvPriorityChangeTask( void * pvParameters ); + +/** + * @brief Task function for tasks T1~Tn-1 to occupy cores. + */ +static void prvBusyRunningTask( void * pvParameters ); + +/** + * @brief Test case "Suspend Scheduler". + */ +void Test_SuspendScheduler( void ); +/*-----------------------------------------------------------*/ + +#if ( configNUMBER_OF_CORES < 2 ) + #error This test is for FreeRTOS SMP and therefore, requires at least 2 cores. +#endif /* if ( configNUMBER_OF_CORES < 2 ) */ + +#if ( configRUN_MULTIPLE_PRIORITIES != 1 ) + #error test_config.h must be included at the end of FreeRTOSConfig.h. +#endif /* if ( configRUN_MULTIPLE_PRIORITIES != 1 ) */ + +#if ( configMAX_PRIORITIES <= 3 ) + #error configMAX_PRIORITIES must be larger than 3 to avoid scheduling idle tasks unexpectedly. +#endif /* if ( configMAX_PRIORITIES <= 3 ) */ +/*-----------------------------------------------------------*/ + +/** + * @brief Handles of the tasks created in this test. + */ +static TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES ]; + +/** + * @brief A flag to indicate that the task T0 got a chance to run. + */ +static volatile BaseType_t xTaskT0IsRunning = pdFALSE; +/*-----------------------------------------------------------*/ + +static void prvPriorityChangeTask( void * pvParameters ) +{ + /* pvParameters is not used in this task. */ + ( void ) pvParameters; + + /* Set the flag to indicate that the test task is running. */ + xTaskT0IsRunning = pdTRUE; + + /* Busy looping here to occupy the core. */ + for( ; ; ) + { + TEST_NOP(); + } +} +/*-----------------------------------------------------------*/ + +static void prvBusyRunningTask( void * pvParameters ) +{ + /* pvParameters is not used in this task. */ + ( void ) pvParameters; + + /* Busy looping here to occupy the core. */ + for( ; ; ) + { + TEST_NOP(); + } +} +/*-----------------------------------------------------------*/ + +void Test_SuspendScheduler( void ) +{ + uint32_t i; + BaseType_t xTaskT0RunningStatus; + BaseType_t xTaskCreationResult; + + /* Create ( configNUMBER_OF_CORES - 1 ) busy running tasks with medium + * priority. */ + for( i = 0; i < ( configNUMBER_OF_CORES - 1 ); i++ ) + { + xTaskCreationResult = xTaskCreate( prvBusyRunningTask, + "BusyRun", + configMINIMAL_STACK_SIZE, + NULL, + configMAX_PRIORITIES - 2, + &( xTaskHandles[ i ] ) ); + + TEST_ASSERT_EQUAL_MESSAGE( pdPASS, xTaskCreationResult, "Task creation failed." ); + } + + /* Create the task T0 with lower priority. */ + xTaskCreationResult = xTaskCreate( prvPriorityChangeTask, + "TestTask", + configMINIMAL_STACK_SIZE, + NULL, + configMAX_PRIORITIES - 3, + &( xTaskHandles[ configNUMBER_OF_CORES - 1 ] ) ); + + TEST_ASSERT_EQUAL_MESSAGE( pdPASS, xTaskCreationResult, "Task creation failed." ); + + /* Busy loop here to wait for other cores. */ + for( i = 0; i < TEST_BUSY_LOOPING_COUNT; i++ ) + { + TEST_NOP(); + } + + /* Verify that the task T0 is not running. The TestRunner task and tasks + * T1 ~ T(n - 1) have higher priority than T0 and therefore, the scheduler + * won't select T0 to run. */ + TEST_ASSERT_EQUAL( pdFALSE, xTaskT0IsRunning ); + + /* Raise the priority of task T0 when the scheduler is suspended. T0 now has + * higher priority than other running tasks. However, T0 should not start + * running until the scheduler is resumed. */ + vTaskSuspendAll(); + { + /* Raise the task T0's priority. */ + vTaskPrioritySet( xTaskHandles[ configNUMBER_OF_CORES - 1 ], configMAX_PRIORITIES - 1 ); + + /* Busy looping here to wait for other cores. */ + for( i = 0; i < TEST_BUSY_LOOPING_COUNT; i++ ) + { + TEST_NOP(); + } + + /* Verify the status later to prevent test framework jump to tearDown function. */ + xTaskT0RunningStatus = xTaskT0IsRunning; + } + ( void ) xTaskResumeAll(); + + /* Verify that the task T0 was not scheduled when the scheduler was + * suspended. */ + TEST_ASSERT_EQUAL( pdFALSE, xTaskT0RunningStatus ); + + /* Busy looping here to wait for other cores. */ + for( i = 0; i < TEST_BUSY_LOOPING_COUNT; i++ ) + { + TEST_NOP(); + } + + /* Verify that the task T0 is scheduled after resuming the scheduler. */ + TEST_ASSERT_EQUAL( pdTRUE, xTaskT0IsRunning ); +} +/*-----------------------------------------------------------*/ + +/* Runs before every test, put init calls here. */ +void setUp( void ) +{ + uint32_t i; + + xTaskT0IsRunning = pdFALSE; + + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + xTaskHandles[ i ] = NULL; + } +} +/*-----------------------------------------------------------*/ + +/* Runs after every test, put clean-up calls here. */ +void tearDown( void ) +{ + uint32_t i; + + /* Delete all the tasks. */ + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + if( xTaskHandles[ i ] != NULL ) + { + vTaskDelete( xTaskHandles[ i ] ); + xTaskHandles[ i ] = NULL; + } + } +} +/*-----------------------------------------------------------*/ + +/** + * @brief Entry point for test runner to run suspend scheduler test. + */ +void vRunSuspendSchedulerTest( void ) +{ + UNITY_BEGIN(); + + RUN_TEST( Test_SuspendScheduler ); + + UNITY_END(); +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Test/Target/tests/smp/suspend_scheduler/test_config.h b/FreeRTOS/Test/Target/tests/smp/suspend_scheduler/test_config.h new file mode 100644 index 0000000000..532e6155c8 --- /dev/null +++ b/FreeRTOS/Test/Target/tests/smp/suspend_scheduler/test_config.h @@ -0,0 +1,58 @@ +/* + * FreeRTOS V202212.00 + * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +#ifndef TEST_CONFIG_H +#define TEST_CONFIG_H + +/* This file must be included at the end of the FreeRTOSConfig.h. It contains + * any FreeRTOS specific configurations that the test requires. */ + +#ifdef configRUN_MULTIPLE_PRIORITIES + #undef configRUN_MULTIPLE_PRIORITIES +#endif /* ifdef configRUN_MULTIPLE_PRIORITIES */ + +#ifdef configUSE_TIME_SLICING + #undef configUSE_TIME_SLICING +#endif /* ifdef configUSE_TIME_SLICING */ + +#ifdef configUSE_PREEMPTION + #undef configUSE_PREEMPTION +#endif /* ifdef configUSE_PREEMPTION */ + +#define configRUN_MULTIPLE_PRIORITIES 1 +#define configUSE_TIME_SLICING 1 +#define configUSE_PREEMPTION 1 + +/*-----------------------------------------------------------*/ + +/** + * @brief Entry point for test runner to run suspend scheduler test. + */ +void vRunSuspendSchedulerTest( void ); + +/*-----------------------------------------------------------*/ + +#endif /* ifndef TEST_CONFIG_H */ From 3878dd96579fa3431caf0db512f9334daa350610 Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Thu, 8 Feb 2024 00:59:39 +0800 Subject: [PATCH 17/21] Add SMP one task enter suspendall on target test (#1183) * Add SMP one task enter suspendall on target test * Fix format and spelling * Code review suggestions Signed-off-by: Gaurav Aggarwal --------- Signed-off-by: Gaurav Aggarwal Co-authored-by: Gaurav Aggarwal Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> --- .../CMakeLists.txt | 33 +++ ...ly_one_task_enter_suspendall_test_runner.c | 73 +++++ .../only_one_task_enter_suspendall.c | 250 ++++++++++++++++++ .../test_config.h | 59 +++++ 4 files changed, 415 insertions(+) create mode 100644 FreeRTOS/Test/Target/boards/pico/tests/smp/only_one_task_enter_suspendall/CMakeLists.txt create mode 100644 FreeRTOS/Test/Target/boards/pico/tests/smp/only_one_task_enter_suspendall/only_one_task_enter_suspendall_test_runner.c create mode 100644 FreeRTOS/Test/Target/tests/smp/only_one_task_enter_suspendall/only_one_task_enter_suspendall.c create mode 100644 FreeRTOS/Test/Target/tests/smp/only_one_task_enter_suspendall/test_config.h diff --git a/FreeRTOS/Test/Target/boards/pico/tests/smp/only_one_task_enter_suspendall/CMakeLists.txt b/FreeRTOS/Test/Target/boards/pico/tests/smp/only_one_task_enter_suspendall/CMakeLists.txt new file mode 100644 index 0000000000..e7f45851b4 --- /dev/null +++ b/FreeRTOS/Test/Target/boards/pico/tests/smp/only_one_task_enter_suspendall/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.13) + +project(example C CXX ASM) +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) + +set(TEST_INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/../../../../../tests/smp/only_one_task_enter_suspendall) +set(TEST_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../../tests/smp/only_one_task_enter_suspendall) + +add_library(only_one_task_enter_suspendall INTERFACE) +target_sources(only_one_task_enter_suspendall INTERFACE + ${BOARD_LIBRARY_DIR}/main.c + ${CMAKE_CURRENT_LIST_DIR}/only_one_task_enter_suspendall_test_runner.c + ${TEST_SOURCE_DIR}/only_one_task_enter_suspendall.c) + +target_include_directories(only_one_task_enter_suspendall INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../../.. + ${TEST_INCLUDE_PATHS} + ) + +target_link_libraries(only_one_task_enter_suspendall INTERFACE + FreeRTOS-Kernel + FreeRTOS-Kernel-Heap4 + ${BOARD_LINK_LIBRARIES}) + +add_executable(test_only_one_task_enter_suspendall) +enable_board_functions(test_only_one_task_enter_suspendall) +target_link_libraries(test_only_one_task_enter_suspendall only_one_task_enter_suspendall) +target_include_directories(test_only_one_task_enter_suspendall PUBLIC + ${BOARD_INCLUDE_PATHS}) +target_compile_definitions(test_only_one_task_enter_suspendall PRIVATE + ${BOARD_DEFINES} +) diff --git a/FreeRTOS/Test/Target/boards/pico/tests/smp/only_one_task_enter_suspendall/only_one_task_enter_suspendall_test_runner.c b/FreeRTOS/Test/Target/boards/pico/tests/smp/only_one_task_enter_suspendall/only_one_task_enter_suspendall_test_runner.c new file mode 100644 index 0000000000..277f6284a7 --- /dev/null +++ b/FreeRTOS/Test/Target/boards/pico/tests/smp/only_one_task_enter_suspendall/only_one_task_enter_suspendall_test_runner.c @@ -0,0 +1,73 @@ +/* + * FreeRTOS V202212.00 + * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +/** + * @file only_one_task_enter_suspendall_test_runner.c + * @brief The implementation of main function to start test runner task. + * + * Procedure: + * - Initialize environment. + * - Run the test case. + */ + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Unit testing support functions. */ +#include "unity.h" + +/* Pico includes. */ +#include "pico/multicore.h" +#include "pico/stdlib.h" + +/*-----------------------------------------------------------*/ + +static void prvTestRunnerTask( void * pvParameters ); + +/*-----------------------------------------------------------*/ + +static void prvTestRunnerTask( void * pvParameters ) +{ + ( void ) pvParameters; + + /* Run test case. */ + vRunOnlyOneTaskEnterSuspendAll(); + + vTaskDelete( NULL ); +} +/*-----------------------------------------------------------*/ + +void vRunTest( void ) +{ + xTaskCreate( prvTestRunnerTask, + "testRunner", + configMINIMAL_STACK_SIZE, + NULL, + configMAX_PRIORITIES - 1, + NULL ); +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Test/Target/tests/smp/only_one_task_enter_suspendall/only_one_task_enter_suspendall.c b/FreeRTOS/Test/Target/tests/smp/only_one_task_enter_suspendall/only_one_task_enter_suspendall.c new file mode 100644 index 0000000000..2ecd971332 --- /dev/null +++ b/FreeRTOS/Test/Target/tests/smp/only_one_task_enter_suspendall/only_one_task_enter_suspendall.c @@ -0,0 +1,250 @@ +/* + * FreeRTOS V202212.00 + * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +/** + * @file only_one_task_enter_suspendall.c + * @brief Only one task shall be able to enter the section protected by + * vTaskSuspendAll/xTaskResumeAll + * + * Procedure: + * - Create ( num of cores ) tasks. + * - All tasks increment a shared counter for TASK_INCREASE_COUNTER_TIMES + * times in the section protected by vTaskSuspendAll/xTaskResumeAll. + * Expected: + * - All tasks have correct value of counter after incrementing. + */ + +/* Standard includes. */ +#include + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Unit testing support functions. */ +#include "unity.h" +/*-----------------------------------------------------------*/ + +/** + * @brief Number of times each task increments the shared counter. + */ +#define TASK_INCREASE_COUNTER_TIMES ( 10000 ) + +/** + * @brief Timeout value to stop test. + */ +#define TEST_TIMEOUT_MS ( 1000 ) +/*-----------------------------------------------------------*/ + +/** + * @brief Test case "Only one task enters the section protected by + * vTaskSuspendAll/xTaskResumeAll". + */ +void Test_OnlyOneTaskEnterSuspendAll( void ); + +/** + * @brief Task function to increment the shared counter and then block. + */ +static void prvTaskIncCounter( void * pvParameters ); +/*-----------------------------------------------------------*/ + +#if ( configNUMBER_OF_CORES < 2 ) + #error This test is for FreeRTOS SMP and therefore, requires at least 2 cores. +#endif /* if ( configNUMBER_OF_CORES < 2 ) */ + +#if ( configMAX_PRIORITIES <= 2 ) + #error configMAX_PRIORITIES must be larger than 2 to avoid scheduling idle tasks unexpectedly. +#endif /* if ( configMAX_PRIORITIES <= 2 ) */ +/*-----------------------------------------------------------*/ + +/** + * @brief Handles of the tasks created in this test. + */ +static TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES ]; + +/** + * @brief Indexes of the tasks created in this test. + */ +static uint32_t xTaskIndexes[ configNUMBER_OF_CORES ]; + +/** + * @brief Flags to indicate if tasks T0~Tn-1 detect an error or not. + */ +static BaseType_t xTestResults[ configNUMBER_OF_CORES ] = { pdFAIL }; + +/** + * @brief Flags to indicate tasks T0~Tn-1 started running. + */ +static volatile BaseType_t xTaskRunning[ configNUMBER_OF_CORES ] = { pdFALSE }; + +/** + * @brief Shared counter for all tasks to increment. + */ +static volatile uint32_t xSharedCounter = 0; +/*-----------------------------------------------------------*/ + +static void prvTaskIncCounter( void * pvParameters ) +{ + uint32_t currentTaskIdx = *( ( uint32_t * ) pvParameters ); + BaseType_t xAllTaskReady = pdFALSE; + BaseType_t xTestResult = pdPASS; + uint32_t xLocalCounter = 0; + uint32_t i; + + /* Wait for all tasks to start running. */ + xTaskRunning[ currentTaskIdx ] = pdTRUE; + + while( xAllTaskReady == pdFALSE ) + { + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + if( xTaskRunning[ i ] != pdTRUE ) + { + break; + } + } + + if( i == configNUMBER_OF_CORES ) + { + xAllTaskReady = pdTRUE; + } + } + + /* Increment the shared counter in a loop. The expectation is that only one + * task increments the counter at a time as it is incremented in the section + * protected by vTaskSuspendAll/xTaskResumeAll. */ + vTaskSuspendAll(); + { + xLocalCounter = xSharedCounter; + + for( i = 0; i < TASK_INCREASE_COUNTER_TIMES; i++ ) + { + /* Increment the local variable xLocalCounter and shared variable + * xSharedCounter. */ + xSharedCounter++; + xLocalCounter++; + + /* If the implementation of vTaskSuspendAll is not correct and + * multiple tasks are able to enter the section protected by + * vTaskSuspendAll/xTaskResumeAll, shared counter will be + * incremented by multiple tasks and as a result, local counter + * xLocalCounterwon't be equal to the shared counter + * xSharedCounter. */ + if( xSharedCounter != xLocalCounter ) + { + xTestResult = pdFAIL; + break; + } + } + } + ( void ) xTaskResumeAll(); + + xTestResults[ currentTaskIdx ] = xTestResult; + + /* Blocking the test task. */ + vTaskDelay( portMAX_DELAY ); +} +/*-----------------------------------------------------------*/ + +void Test_OnlyOneTaskEnterSuspendAll( void ) +{ + uint32_t i; + + BaseType_t xTaskCreationResult; + + /* Create configNUMBER_OF_CORES test tasks. */ + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + xTaskIndexes[ i ] = i; + xTaskCreationResult = xTaskCreate( prvTaskIncCounter, + "IncCounter", + configMINIMAL_STACK_SIZE, + &( xTaskIndexes[ i ] ), + configMAX_PRIORITIES - 2, + &( xTaskHandles[ i ] ) ); + + TEST_ASSERT_EQUAL_MESSAGE( pdPASS, xTaskCreationResult, "Task creation failed." ); + } + + /* Delay for other cores to run tasks. */ + vTaskDelay( pdMS_TO_TICKS( TEST_TIMEOUT_MS ) ); + + /* Validate that none of the test tasks detected error. */ + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + TEST_ASSERT_EQUAL_MESSAGE( pdPASS, xTestResults[ i ], "Critical section test task failed." ); + } + + /* Verify the shared counter value. */ + TEST_ASSERT_EQUAL_UINT32( configNUMBER_OF_CORES * TASK_INCREASE_COUNTER_TIMES, xSharedCounter ); +} +/*-----------------------------------------------------------*/ + +/* Runs before every test, put init calls here. */ +void setUp( void ) +{ + uint32_t i; + + xSharedCounter = 0; + + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + xTaskIndexes[ i ] = i; + xTaskHandles[ i ] = NULL; + } +} +/*-----------------------------------------------------------*/ + +/* Runs after every test, put clean-up calls here. */ +void tearDown( void ) +{ + uint32_t i; + + /* Delete all the tasks. */ + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + if( xTaskHandles[ i ] != NULL ) + { + vTaskDelete( xTaskHandles[ i ] ); + xTaskHandles[ i ] = NULL; + } + } +} +/*-----------------------------------------------------------*/ + +/** + * @brief Entry point for test runner to run "only one task enter suspend all" + * test. + */ +void vRunOnlyOneTaskEnterSuspendAll( void ) +{ + UNITY_BEGIN(); + + RUN_TEST( Test_OnlyOneTaskEnterSuspendAll ); + + UNITY_END(); +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Test/Target/tests/smp/only_one_task_enter_suspendall/test_config.h b/FreeRTOS/Test/Target/tests/smp/only_one_task_enter_suspendall/test_config.h new file mode 100644 index 0000000000..41056d03ea --- /dev/null +++ b/FreeRTOS/Test/Target/tests/smp/only_one_task_enter_suspendall/test_config.h @@ -0,0 +1,59 @@ +/* + * FreeRTOS V202212.00 + * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +#ifndef TEST_CONFIG_H +#define TEST_CONFIG_H + +/* This file must be included at the end of the FreeRTOSConfig.h. It contains + * any FreeRTOS specific configurations that the test requires. */ + +#ifdef configRUN_MULTIPLE_PRIORITIES + #undef configRUN_MULTIPLE_PRIORITIES +#endif /* ifdef configRUN_MULTIPLE_PRIORITIES */ + +#ifdef configUSE_TIME_SLICING + #undef configUSE_TIME_SLICING +#endif /* ifdef configUSE_TIME_SLICING */ + +#ifdef configUSE_PREEMPTION + #undef configUSE_PREEMPTION +#endif /* ifdef configUSE_PREEMPTION */ + +#define configRUN_MULTIPLE_PRIORITIES 1 +#define configUSE_TIME_SLICING 1 +#define configUSE_PREEMPTION 1 + +/*-----------------------------------------------------------*/ + +/** + * @brief Entry point for test runner to run "only one task enter suspend all" + * test. + */ +void vRunOnlyOneTaskEnterSuspendAll( void ); + +/*-----------------------------------------------------------*/ + +#endif /* ifndef TEST_CONFIG_H */ From 2f85ed9bf63aa52d162004ddc619f70e039762ff Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Thu, 8 Feb 2024 13:37:39 +0800 Subject: [PATCH 18/21] Add SMP schedule equal priority on target test (#1170) * Add SMP schedule equal priority on target test * Remove unnecessary config * Fix spelling format and header * Code review suggestions Signed-off-by: Gaurav Aggarwal --------- Signed-off-by: Gaurav Aggarwal Co-authored-by: Gaurav Aggarwal Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> --- .../schedule_equal_priority/CMakeLists.txt | 33 +++ .../schedule_equal_priority_test_runner.c | 73 +++++++ .../schedule_equal_priority.c | 189 ++++++++++++++++++ .../smp/schedule_equal_priority/test_config.h | 53 +++++ 4 files changed, 348 insertions(+) create mode 100644 FreeRTOS/Test/Target/boards/pico/tests/smp/schedule_equal_priority/CMakeLists.txt create mode 100644 FreeRTOS/Test/Target/boards/pico/tests/smp/schedule_equal_priority/schedule_equal_priority_test_runner.c create mode 100644 FreeRTOS/Test/Target/tests/smp/schedule_equal_priority/schedule_equal_priority.c create mode 100644 FreeRTOS/Test/Target/tests/smp/schedule_equal_priority/test_config.h diff --git a/FreeRTOS/Test/Target/boards/pico/tests/smp/schedule_equal_priority/CMakeLists.txt b/FreeRTOS/Test/Target/boards/pico/tests/smp/schedule_equal_priority/CMakeLists.txt new file mode 100644 index 0000000000..ae70e497d4 --- /dev/null +++ b/FreeRTOS/Test/Target/boards/pico/tests/smp/schedule_equal_priority/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.13) + +project(example C CXX ASM) +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) + +set(TEST_INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/../../../../../tests/smp/schedule_equal_priority) +set(TEST_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../../tests/smp/schedule_equal_priority) + +add_library(schedule_equal_priority INTERFACE) +target_sources(schedule_equal_priority INTERFACE + ${BOARD_LIBRARY_DIR}/main.c + ${CMAKE_CURRENT_LIST_DIR}/schedule_equal_priority_test_runner.c + ${TEST_SOURCE_DIR}/schedule_equal_priority.c) + +target_include_directories(schedule_equal_priority INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../../.. + ${TEST_INCLUDE_PATHS} + ) + +target_link_libraries(schedule_equal_priority INTERFACE + FreeRTOS-Kernel + FreeRTOS-Kernel-Heap4 + ${BOARD_LINK_LIBRARIES}) + +add_executable(test_schedule_equal_priority) +enable_board_functions(test_schedule_equal_priority) +target_link_libraries(test_schedule_equal_priority schedule_equal_priority) +target_include_directories(test_schedule_equal_priority PUBLIC + ${BOARD_INCLUDE_PATHS}) +target_compile_definitions(test_schedule_equal_priority PRIVATE + ${BOARD_DEFINES} +) diff --git a/FreeRTOS/Test/Target/boards/pico/tests/smp/schedule_equal_priority/schedule_equal_priority_test_runner.c b/FreeRTOS/Test/Target/boards/pico/tests/smp/schedule_equal_priority/schedule_equal_priority_test_runner.c new file mode 100644 index 0000000000..cc5e28543e --- /dev/null +++ b/FreeRTOS/Test/Target/boards/pico/tests/smp/schedule_equal_priority/schedule_equal_priority_test_runner.c @@ -0,0 +1,73 @@ +/* + * FreeRTOS V202212.00 + * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +/** + * @file schedule_equal_priority_test_runner.c + * @brief The implementation of main function to start test runner task. + * + * Procedure: + * - Initialize environment. + * - Run the test case. + */ + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Unit testing support functions. */ +#include "unity.h" + +/* Pico includes. */ +#include "pico/multicore.h" +#include "pico/stdlib.h" + +/*-----------------------------------------------------------*/ + +static void prvTestRunnerTask( void * pvParameters ); + +/*-----------------------------------------------------------*/ + +static void prvTestRunnerTask( void * pvParameters ) +{ + ( void ) pvParameters; + + /* Run test case. */ + vRunScheduleEqualPriorityTest(); + + vTaskDelete( NULL ); +} +/*-----------------------------------------------------------*/ + +void vRunTest( void ) +{ + xTaskCreate( prvTestRunnerTask, + "testRunner", + configMINIMAL_STACK_SIZE, + NULL, + configMAX_PRIORITIES - 1, + NULL ); +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Test/Target/tests/smp/schedule_equal_priority/schedule_equal_priority.c b/FreeRTOS/Test/Target/tests/smp/schedule_equal_priority/schedule_equal_priority.c new file mode 100644 index 0000000000..785950b7a1 --- /dev/null +++ b/FreeRTOS/Test/Target/tests/smp/schedule_equal_priority/schedule_equal_priority.c @@ -0,0 +1,189 @@ +/* + * FreeRTOS V202212.00 + * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +/** + * @file schedule_equal_priority.c + * @brief The scheduler shall schedule tasks of equal priority in a round robin fashion. + * + * Procedure: + * - Create ( num of cores + 1 ) tasks ( T0~Tn ). Priority T0 = T1 = ... = Tn-1 = Tn. + * - All tasks are running in busy loop. + * Expected: + * - Equal priority tasks are scheduled in a round robin fashion when configUSE_TIME_SLICING + * is set to 1. Verify that all the test tasks get chance to run. + */ + +/* Standard includes. */ +#include + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Unit testing support functions. */ +#include "unity.h" +/*-----------------------------------------------------------*/ + +/** + * @brief Timeout value to stop test. + */ +#define TEST_TIMEOUT_TICKS ( ( configNUMBER_OF_CORES + 1U ) * 2U ) + +/** + * @brief Nop operation for busy looping. + */ +#ifndef portNOP + #define TEST_NOP() __asm volatile ( "nop" ) +#else + #define TEST_NOP portNOP +#endif +/*-----------------------------------------------------------*/ + +#if ( configNUMBER_OF_CORES < 2 ) + #error This test is for FreeRTOS SMP and therefore, requires at least 2 cores. +#endif /* if configNUMBER_OF_CORES != 2 */ + +#if ( configUSE_TIME_SLICING != 1 ) + #error configUSE_TIME_SLICING must be enabled by including test_config.h in FreeRTOSConfig.h. +#endif /* if configUSE_TIME_SLICING != 1 */ + +#if ( configMAX_PRIORITIES <= 2 ) + #error configMAX_PRIORITIES must be larger than 2 to avoid scheduling idle tasks unexpectedly. +#endif /* if ( configMAX_PRIORITIES <= 2 ) */ +/*-----------------------------------------------------------*/ + +/** + * @brief Test case "schedule equal priority tasks.". + */ +void Test_ScheduleEqualPriority( void ); + +/** + * @brief Function that implements a never blocking FreeRTOS task. + */ +static void prvEverRunningTask( void * pvParameters ); +/*-----------------------------------------------------------*/ + +/** + * @brief Handles of the tasks created in this test. + */ +static TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ]; + +/** + * @brief Flags to indicate that all ever running tasks get a chance to run. + */ +static BaseType_t xTaskRun[ configNUMBER_OF_CORES + 1 ]; +/*-----------------------------------------------------------*/ + +static void prvEverRunningTask( void * pvParameters ) +{ + BaseType_t * pxTaskRun = ( ( BaseType_t * ) pvParameters ); + + /* Set the flag for testRunner to check whether all tasks have run. */ + if( pxTaskRun != NULL ) + { + *pxTaskRun = pdTRUE; + } + + for( ; ; ) + { + /* Always running, put asm here to avoid optimization by compiler. */ + TEST_NOP(); + } +} +/*-----------------------------------------------------------*/ + +void Test_ScheduleEqualPriority( void ) +{ + uint32_t i; + BaseType_t xTaskCreationResult; + + /* Create ( configNUMBER_OF_CORES + 1 ) low priority tasks. */ + for( i = 0; i < ( configNUMBER_OF_CORES + 1 ); i++ ) + { + xTaskCreationResult = xTaskCreate( prvEverRunningTask, + "EverRun", + configMINIMAL_STACK_SIZE, + &( xTaskRun[ i ] ), + configMAX_PRIORITIES - 2, + &( xTaskHandles[ i ] ) ); + + TEST_ASSERT_EQUAL_MESSAGE( pdPASS, xTaskCreationResult, "Task creation failed." ); + } + + /* TEST_TIMEOUT_TICKS is long enough to run each task. */ + vTaskDelay( TEST_TIMEOUT_TICKS ); + + for( i = 0; i < ( configNUMBER_OF_CORES + 1 ); i++ ) + { + /* After timeout, all tasks must have been scheduled at least once and + * have set their corresponding flag to pdTRUE. */ + TEST_ASSERT_EQUAL( pdTRUE, xTaskRun[ i ] ); + } +} +/*-----------------------------------------------------------*/ + +/* Runs before every test, put init calls here. */ +void setUp( void ) +{ + uint32_t i; + + for( i = 0; i < ( configNUMBER_OF_CORES + 1 ); i++ ) + { + xTaskRun[ i ] = pdFALSE; + xTaskHandles[ i ] = NULL; + } +} +/*-----------------------------------------------------------*/ + +/* Runs after every test, put clean-up calls here. */ +void tearDown( void ) +{ + uint32_t i; + + /* Delete all the tasks. */ + for( i = 0; i < ( configNUMBER_OF_CORES + 1 ); i++ ) + { + if( xTaskHandles[ i ] != NULL ) + { + vTaskDelete( xTaskHandles[ i ] ); + xTaskHandles[ i ] = NULL; + } + } +} +/*-----------------------------------------------------------*/ + +/** + * @brief Entry point for test runner to run schedule equal priority test. + */ +void vRunScheduleEqualPriorityTest( void ) +{ + UNITY_BEGIN(); + + RUN_TEST( Test_ScheduleEqualPriority ); + + UNITY_END(); +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Test/Target/tests/smp/schedule_equal_priority/test_config.h b/FreeRTOS/Test/Target/tests/smp/schedule_equal_priority/test_config.h new file mode 100644 index 0000000000..28f8dbe708 --- /dev/null +++ b/FreeRTOS/Test/Target/tests/smp/schedule_equal_priority/test_config.h @@ -0,0 +1,53 @@ +/* + * FreeRTOS V202212.00 + * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +#ifndef TEST_CONFIG_H +#define TEST_CONFIG_H + +/* This file must be included at the end of the FreeRTOSConfig.h. It contains + * any FreeRTOS specific configurations that the test requires. */ + +#ifdef configUSE_TIME_SLICING + #undef configUSE_TIME_SLICING +#endif /* ifdef configUSE_TIME_SLICING */ + +#ifdef configUSE_PREEMPTION + #undef configUSE_PREEMPTION +#endif /* ifdef configUSE_PREEMPTION */ + +#define configUSE_TIME_SLICING 1 +#define configUSE_PREEMPTION 1 + +/*-----------------------------------------------------------*/ + +/** + * @brief Entry point for test runner to run schedule equal priority test. + */ +void vRunScheduleEqualPriorityTest( void ); + +/*-----------------------------------------------------------*/ + +#endif /* ifndef TEST_CONFIG_H */ From 5fc7a750a0d603c1c68d554226d91d44ba922173 Mon Sep 17 00:00:00 2001 From: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> Date: Sat, 10 Feb 2024 15:14:46 +0530 Subject: [PATCH 19/21] update CMakeLists.txt for Posix GCC Demo (#1185) --- FreeRTOS/Demo/Posix_GCC/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FreeRTOS/Demo/Posix_GCC/CMakeLists.txt b/FreeRTOS/Demo/Posix_GCC/CMakeLists.txt index 446e8f10ce..8abeb4ef87 100644 --- a/FreeRTOS/Demo/Posix_GCC/CMakeLists.txt +++ b/FreeRTOS/Demo/Posix_GCC/CMakeLists.txt @@ -42,7 +42,8 @@ target_include_directories( freertos_config INTERFACE ./ ./Trace_Recorder_Configuration - ${FREERTOS_PLUS_TRACE_PATH}/Include + ${FREERTOS_PLUS_TRACE_PATH}/include + ${FREERTOS_PLUS_TRACE_PATH}/kernelports/FreeRTOS/include ) # Select the heap port @@ -60,7 +61,7 @@ target_compile_options( freertos_kernel $ ) -file( GLOB FREERTOS_PLUS_TRACE_SOURCES ${FREERTOS_PLUS_TRACE_PATH}/*.c ) +file( GLOB FREERTOS_PLUS_TRACE_SOURCES ${FREERTOS_PLUS_TRACE_PATH}/*.c ${FREERTOS_PLUS_TRACE_PATH}/kernelports/FreeRTOS/*.c ) add_executable( posix_demo code_coverage_additions.c From 6a8e2ba7dcae694084d25eb831c3d87eddb71870 Mon Sep 17 00:00:00 2001 From: RichardBarry <3073890+RichardBarry@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:53:12 -0800 Subject: [PATCH 20/21] The zc702 Configuration QEMU.launch file contained an absolute path. This commit makes it project relative. (#761) Co-authored-by: none <> Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> --- .../RTOSDemo/zc702 Configuration QEMU.launch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/zc702 Configuration QEMU.launch b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/zc702 Configuration QEMU.launch index 3b8bdebbbd..77ba94a495 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/zc702 Configuration QEMU.launch +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/zc702 Configuration QEMU.launch @@ -29,7 +29,7 @@ - + From 48867dce4a284f515b523faf0798a14c4a82d381 Mon Sep 17 00:00:00 2001 From: jasonpcarroll <23126711+jasonpcarroll@users.noreply.github.com> Date: Sun, 18 Feb 2024 08:57:01 -0800 Subject: [PATCH 21/21] Update urllib3 dependency to 2.0.7 to address vulnerability (#1109) * Update urllib3 dependency to 2.0.7 to address vulnerability * Set urllib3 dependency to >= 2.0.7 --------- Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> Co-authored-by: Nikhil Kamath <110539926+amazonKamath@users.noreply.github.com> Co-authored-by: Soren Ptak --- .github/scripts/common/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/common/requirements.txt b/.github/scripts/common/requirements.txt index 130809087e..c5a9cb27c5 100644 --- a/.github/scripts/common/requirements.txt +++ b/.github/scripts/common/requirements.txt @@ -10,5 +10,5 @@ gitdb idna requests smmap -urllib3 +urllib3 >= 2.0.7 wrapt