Merge branch 'main' into qemu_demo_m4_mpu

pull/868/head
Rahul Kar 10 months ago committed by GitHub
commit 5e92d2fff7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2,7 +2,7 @@ name: CI Checks
env:
bashPass: \033[32;1mPASSED -
bashWarn: \033[33;1mWARNING -
bashInfo: \033[33;1mINFO -
bashFail: \033[31;1mFAILED -
bashEnd: \033[0m
@ -151,7 +151,7 @@ jobs:
retention-days: 2
proof_ci:
if: ${{ github.event.pull_request }}
if: ${{ github.event.pull_request }} || ${{ github.event.workflow }}
runs-on: cbmc_ubuntu-latest_16-core
steps:
- uses: actions/checkout@v3
@ -159,9 +159,9 @@ jobs:
stepName: Install Dependencies
run: |
# ${{ env.stepName }}
echo -e "::group::${{ env.stepName }}"
echo -e "::group:: ${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
git submodule update --init --checkout --recursive --depth 1
sudo apt-get update
sudo apt-get update -y
sudo apt-get install --yes --no-install-recommends gcc-multilib
echo -e "::endgroup::"
echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}"

@ -2,12 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fleet Provisioning Demo", "fleet_provisioning_demo.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fleet Provisioning Demo", "fleet_provisioning_demo.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MbedTLS", "..\..\..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj", "{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}"

@ -2,6 +2,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31205.134
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ota_Over_Mqtt_Demo", "Ota_Over_Mqtt_Demo.vcxproj", "{4BE4E103-5BF4-4A85-9656-EC20852A2B8E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Statically Linked Libraries", "Statically Linked Libraries", "{9799AFF4-25E2-43CD-8829-C066177E3748}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
@ -12,8 +14,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\..\..\Visu
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MbedTLS", "..\..\..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj", "{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ota_Over_Mqtt_Demo", "Ota_Over_Mqtt_Demo.vcxproj", "{4BE4E103-5BF4-4A85-9656-EC20852A2B8E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32

@ -315,4 +315,6 @@ extern void vLoggingPrintf( const char * pcFormatString,
#define ipconfigBUFFER_PADDING ( 14U )
#endif /* INTPTR_MAX == INT64_MAX */
#define ipconfigETHERNET_DRIVER_FILTERS_PACKETS ( 1 )
#endif /* FREERTOS_IP_CONFIG_H */

@ -2,12 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS_Plus_TCP_Minimal", "FreeRTOS_Plus_TCP_Minimal.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS_Plus_TCP_Minimal", "FreeRTOS_Plus_TCP_Minimal.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Statically Linked Libraries", "Statically Linked Libraries", "{190A6643-3DE4-49DC-96AA-7867C5E0A835}"

@ -2,12 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoreHTTP_Mutual_Auth", "CoreHTTP_Mutual_Auth.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoreHTTP_Mutual_Auth", "CoreHTTP_Mutual_Auth.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coreHTTP", "..\..\..\VisualStudio_StaticProjects\coreHTTP\coreHTTP.vcxproj", "{EE39FA0F-CEFB-4C29-A571-05A28FDD47FD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"

@ -2,12 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoreHTTP_Plaintext", "CoreHTTP_Plaintext.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoreHTTP_Plaintext", "CoreHTTP_Plaintext.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coreHTTP", "..\..\..\VisualStudio_StaticProjects\coreHTTP\coreHTTP.vcxproj", "{EE39FA0F-CEFB-4C29-A571-05A28FDD47FD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"

@ -2,12 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoreHTTP_S3_Download", "CoreHTTP_S3_Download.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoreHTTP_S3_Download", "CoreHTTP_S3_Download.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coreHTTP", "..\..\..\VisualStudio_StaticProjects\coreHTTP\coreHTTP.vcxproj", "{EE39FA0F-CEFB-4C29-A571-05A28FDD47FD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"

@ -2,12 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoreHTTP_S3_Download_Multithreaded", "CoreHTTP_S3_Download_Multithreaded.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoreHTTP_S3_Download_Multithreaded", "CoreHTTP_S3_Download_Multithreaded.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coreHTTP", "..\..\..\VisualStudio_StaticProjects\coreHTTP\coreHTTP.vcxproj", "{EE39FA0F-CEFB-4C29-A571-05A28FDD47FD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"

@ -2,12 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoreHTTP_S3_Upload", "CoreHTTP_S3_Upload.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoreHTTP_S3_Upload", "CoreHTTP_S3_Upload.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coreHTTP", "..\..\..\VisualStudio_StaticProjects\coreHTTP\coreHTTP.vcxproj", "{EE39FA0F-CEFB-4C29-A571-05A28FDD47FD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"

@ -2,12 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "corePKCS11_MQTT_Mutual_Auth", "corePKCS11_MQTT_Mutual_Auth.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "corePKCS11_MQTT_Mutual_Auth", "corePKCS11_MQTT_Mutual_Auth.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MbedTLS", "..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj", "{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}"

@ -2,12 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CorePKCS11_Demos", "CorePKCS11_Demos.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CorePKCS11_Demos", "CorePKCS11_Demos.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MbedTLS", "..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj", "{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}"

@ -2,12 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coreSNTP_Demo", "coreSNTP_Demo.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coreSNTP_Demo", "coreSNTP_Demo.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MbedTLS", "..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj", "{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}"

@ -1 +1 @@
Subproject commit b41e57e7b28d714a494cc470f16a8f5fea2b9e18
Subproject commit f940d75a1393ba976edfcce118d4d97dc234322d

@ -309,6 +309,7 @@ extern void vLoggingPrintf( const char * pcFormatString,
#define ipconfigBUFFER_PADDING ( 14U )
#endif /* INTPTR_MAX == INT64_MAX */
#define ipconfigETHERNET_DRIVER_FILTERS_PACKETS ( 1 )
#define configMAC

@ -42,7 +42,6 @@
#define configUSE_TRACE_FACILITY 0
#define configGENERATE_RUN_TIME_STATS 0
#define configUSE_TICKLESS_IDLE 0
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 1
@ -51,6 +50,7 @@
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 60 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 12 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
#define configUSE_CO_ROUTINES 0
@ -76,7 +76,7 @@
#define configTASK_NOTIFICATION_ARRAY_ENTRIES 3
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
* to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
@ -96,18 +96,20 @@ to exclude the API function. */
#define INCLUDE_xTaskGetHandle 1
/* This demo makes use of one or more example stats formatting functions. These
format the raw data provided by the uxTaskGetSystemState() function in to human
readable ASCII form. See the notes in the implementation of vTaskList() within
FreeRTOS/Source/tasks.c for limitations. */
* format the raw data provided by the uxTaskGetSystemState() function in to human
* readable ASCII form. See the notes in the implementation of vTaskList() within
* FreeRTOS/Source/tasks.c for limitations. */
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
#define configKERNEL_INTERRUPT_PRIORITY ( 255 ) /* All eight bits as QEMU doesn't model the priority bits. */
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
* See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( 4 )
/* Use the Cortex-M3 optimised task selection rather than the generic C code
version. */
* version. */
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
/* The Win32 target is capable of running all the tests tasks at the same
@ -115,12 +117,13 @@ version. */
#define configRUN_ADDITIONAL_TESTS 1
/* The test that checks the trigger level on stream buffers requires an
allowable margin of error on slower processors (slower than the Win32
machine on which the test is developed). */
* allowable margin of error on slower processors (slower than the Win32
* machine on which the test is developed). */
#define configSTREAM_BUFFER_TRIGGER_LEVEL_TEST_MARGIN 4
#ifndef __IASMARM__ /* Prevent C code being included in IAR asm files. */
void vAssertCalled( const char *pcFileName, uint32_t ulLine );
void vAssertCalled( const char * pcFileName,
uint32_t ulLine );
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ );
#endif

@ -25,11 +25,6 @@
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>CommonDemoSource</name>
<type>2</type>
<locationURI>FREERTOS_ROOT/Demo/Common/Minimal</locationURI>
</link>
<link>
<name>FreeRTOS_kernel</name>
<type>2</type>
@ -40,35 +35,50 @@
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>Source/Blinky_Demo</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>Source/FreeRTOSConfig.h</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/FreeRTOSConfig.h</locationURI>
</link>
<link>
<name>Source/IntQueueTimer.c</name>
<name>Source/Full_Demo</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>Source/main.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.c</locationURI>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main.c</locationURI>
</link>
<link>
<name>Source/IntQueueTimer.h</name>
<name>Source/Blinky_Demo/main_blinky.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.h</locationURI>
<locationURI>PARENT-2-PROJECT_LOC/main_blinky.c</locationURI>
</link>
<link>
<name>Source/main.c</name>
<name>Source/Full_Demo/CommonDemoSource</name>
<type>2</type>
<locationURI>FREERTOS_ROOT/Demo/Common/Minimal</locationURI>
</link>
<link>
<name>Source/Full_Demo/IntQueueTimer.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main.c</locationURI>
<locationURI>PARENT-2-PROJECT_LOC/IntQueueTimer.c</locationURI>
</link>
<link>
<name>Source/main_blinky.c</name>
<name>Source/Full_Demo/IntQueueTimer.h</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_blinky.c</locationURI>
<locationURI>PARENT-2-PROJECT_LOC/IntQueueTimer.h</locationURI>
</link>
<link>
<name>Source/main_full.c</name>
<name>Source/Full_Demo/main_full.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_full.c</locationURI>
<locationURI>PARENT-2-PROJECT_LOC/main_full.c</locationURI>
</link>
</linkedResources>
<filteredResources>

@ -12,7 +12,7 @@ MAKE = make
CFLAGS += $(INCLUDE_DIRS) -nostartfiles -ffreestanding -mthumb -mcpu=cortex-m3 \
-Wall -Wextra -g3 -O0 -ffunction-sections -fdata-sections \
-Wall -Wextra -g3 -Os -ffunction-sections -fdata-sections \
-MMD -MP -MF"$(@:%.o=%.d)" -MT $@
#
@ -79,6 +79,7 @@ SOURCE_FILES += (DEMO_PROJECT)/main.c
SOURCE_FILES += (DEMO_PROJECT)/main_blinky.c
SOURCE_FILES += (DEMO_PROJECT)/main_full.c
SOURCE_FILES += ./startup_gcc.c
SOURCE_FILES += ./RegTest.c
# Lightweight print formatting to use in place of the heavier GCC equivalent.
SOURCE_FILES += ./printf-stdarg.c

@ -0,0 +1,187 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 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
*
*/
/*
* "Reg test" tasks - These fill the registers with known values, then check
* that each register maintains its expected value for the lifetime of the
* task. Each task uses a different set of values. The reg test tasks execute
* with a very low priority, so get preempted very frequently. A register
* containing an unexpected value is indicative of an error in the context
* switching mechanism.
*/
void vRegTest1Implementation( void ) __attribute__ ((naked));
void vRegTest2Implementation( void ) __attribute__ ((naked));
void vRegTest1Implementation( void )
{
__asm volatile
(
".extern ulRegTest1LoopCounter \n"
/* Fill the core registers with known values. */
"mov r0, #100 \n"
"mov r1, #101 \n"
"mov r2, #102 \n"
"mov r3, #103 \n"
"mov r4, #104 \n"
"mov r5, #105 \n"
"mov r6, #106 \n"
"mov r7, #107 \n"
"mov r8, #108 \n"
"mov r9, #109 \n"
"mov r10, #110 \n"
"mov r11, #111 \n"
"mov r12, #112 \n"
"reg1_loop: \n"
"cmp r0, #100 \n"
"bne reg1_error_loop \n"
"cmp r1, #101 \n"
"bne reg1_error_loop \n"
"cmp r2, #102 \n"
"bne reg1_error_loop \n"
"cmp r3, #103 \n"
"bne reg1_error_loop \n"
"cmp r4, #104 \n"
"bne reg1_error_loop \n"
"cmp r5, #105 \n"
"bne reg1_error_loop \n"
"cmp r6, #106 \n"
"bne reg1_error_loop \n"
"cmp r7, #107 \n"
"bne reg1_error_loop \n"
"cmp r8, #108 \n"
"bne reg1_error_loop \n"
"cmp r9, #109 \n"
"bne reg1_error_loop \n"
"cmp r10, #110 \n"
"bne reg1_error_loop \n"
"cmp r11, #111 \n"
"bne reg1_error_loop \n"
"cmp r12, #112 \n"
"bne reg1_error_loop \n"
/* Everything passed, increment the loop counter. */
"push { r0-r1 } \n"
"ldr r0, =ulRegTest1LoopCounter \n"
"ldr r1, [r0] \n"
"adds r1, r1, #1 \n"
"str r1, [r0] \n"
"pop { r0-r1 } \n"
/* Start again. */
"b reg1_loop \n"
"reg1_error_loop: \n"
/* If this line is hit then there was an error in a core register value.
The loop ensures the loop counter stops incrementing. */
"b reg1_error_loop \n"
"nop \n"
); /* __asm volatile. */
}
/*-----------------------------------------------------------*/
void vRegTest2Implementation( void )
{
__asm volatile
(
".extern ulRegTest2LoopCounter \n"
/* Set all the core registers to known values. */
"mov r0, #-1 \n"
"mov r1, #1 \n"
"mov r2, #2 \n"
"mov r3, #3 \n"
"mov r4, #4 \n"
"mov r5, #5 \n"
"mov r6, #6 \n"
"mov r7, #7 \n"
"mov r8, #8 \n"
"mov r9, #9 \n"
"mov r10, #10 \n"
"mov r11, #11 \n"
"mov r12, #12 \n"
"reg2_loop : \n"
"cmp r0, #-1 \n"
"bne reg2_error_loop \n"
"cmp r1, #1 \n"
"bne reg2_error_loop \n"
"cmp r2, #2 \n"
"bne reg2_error_loop \n"
"cmp r3, #3 \n"
"bne reg2_error_loop \n"
"cmp r4, #4 \n"
"bne reg2_error_loop \n"
"cmp r5, #5 \n"
"bne reg2_error_loop \n"
"cmp r6, #6 \n"
"bne reg2_error_loop \n"
"cmp r7, #7 \n"
"bne reg2_error_loop \n"
"cmp r8, #8 \n"
"bne reg2_error_loop \n"
"cmp r9, #9 \n"
"bne reg2_error_loop \n"
"cmp r10, #10 \n"
"bne reg2_error_loop \n"
"cmp r11, #11 \n"
"bne reg2_error_loop \n"
"cmp r12, #12 \n"
"bne reg2_error_loop \n"
/* Increment the loop counter to indicate this test is still functioning
correctly. */
"push { r0-r1 } \n"
"ldr r0, =ulRegTest2LoopCounter \n"
"ldr r1, [r0] \n"
"adds r1, r1, #1 \n"
"str r1, [r0] \n"
/* Yield to increase test coverage. */
"movs r0, #0x01 \n"
"ldr r1, =0xe000ed04 \n" /*NVIC_INT_CTRL */
"lsl r0, r0, #28 \n" /* Shift to PendSV bit */
"str r0, [r1] \n"
"dsb \n"
"pop { r0-r1 } \n"
/* Start again. */
"b reg2_loop \n"
"reg2_error_loop: \n"
/* If this line is hit then there was an error in a core register value.
This loop ensures the loop counter variable stops incrementing. */
"b reg2_error_loop \n"
); /* __asm volatile */
}
/*-----------------------------------------------------------*/

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<fileVersion>3</fileVersion>
<fileVersion>4</fileVersion>
<configuration>
<name>Debug</name>
<toolchain>
@ -11,7 +11,7 @@
<name>General</name>
<archiveVersion>3</archiveVersion>
<data>
<version>33</version>
<version>36</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
@ -70,7 +70,7 @@
</option>
<option>
<name>OGLastSavedByProductVersion</name>
<state>9.10.2.39304</state>
<state>9.50.1.69462</state>
</option>
<option>
<name>OGChipSelectEditMenu</name>
@ -98,7 +98,7 @@
</option>
<option>
<name>GBECoreSlave</name>
<version>30</version>
<version>33</version>
<state>38</state>
</option>
<option>
@ -115,7 +115,7 @@
</option>
<option>
<name>CoreVariant</name>
<version>30</version>
<version>33</version>
<state>38</state>
</option>
<option>
@ -138,7 +138,7 @@
</option>
<option>
<name>GFPUCoreSlave2</name>
<version>30</version>
<version>33</version>
<state>38</state>
</option>
<option>
@ -199,13 +199,30 @@
<name>OG_32_64Device</name>
<state>0</state>
</option>
<option>
<name>BuildFilesPath</name>
<state>Debug</state>
</option>
<option>
<name>PointerAuthentication</name>
<state>0</state>
</option>
<option>
<name>FPU64</name>
<state>1</state>
</option>
<option>
<name>OG_32_64DeviceCoreSlave</name>
<version>33</version>
<state>38</state>
</option>
</data>
</settings>
<settings>
<name>ICCARM</name>
<archiveVersion>2</archiveVersion>
<data>
<version>37</version>
<version>38</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
@ -451,13 +468,21 @@
<name>CCStackProtection</name>
<state>0</state>
</option>
<option>
<name>CCPointerAutentiction</name>
<state>0</state>
</option>
<option>
<name>CCBranchTargetIdentification</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>AARM</name>
<archiveVersion>2</archiveVersion>
<data>
<version>11</version>
<version>12</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
@ -617,6 +642,10 @@
<name>PreInclude</name>
<state></state>
</option>
<option>
<name>A_32_64Device</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
@ -659,19 +688,11 @@
<buildSequence>inputOutputBased</buildSequence>
</data>
</settings>
<settings>
<name>BUILDACTION</name>
<archiveVersion>1</archiveVersion>
<data>
<prebuild></prebuild>
<postbuild></postbuild>
</data>
</settings>
<settings>
<name>ILINK</name>
<archiveVersion>0</archiveVersion>
<data>
<version>25</version>
<version>27</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
@ -1023,6 +1044,22 @@
<name>IlinkDemangle</name>
<state>0</state>
</option>
<option>
<name>IlinkWrapperFileEnable</name>
<state>0</state>
</option>
<option>
<name>IlinkWrapperFile</name>
<state></state>
</option>
<option>
<name>IlinkProcessor</name>
<state>1</state>
</option>
<option>
<name>IlinkFpuProcessor</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
@ -1046,6 +1083,11 @@
</option>
</data>
</settings>
<settings>
<name>BUILDACTION</name>
<archiveVersion>2</archiveVersion>
<data />
</settings>
</configuration>
<group>
<name>Blinky Demo</name>
@ -1208,6 +1250,9 @@
<file>
<name>$PROJ_DIR$\..\..\main_full.c</name>
</file>
<file>
<name>$PROJ_DIR$\RegTest.S</name>
</file>
</group>
<group>
<name>System files</name>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<fileVersion>3</fileVersion>
<fileVersion>4</fileVersion>
<configuration>
<name>Debug</name>
<toolchain>
@ -9,9 +9,9 @@
<debug>1</debug>
<settings>
<name>C-STAT</name>
<archiveVersion>515</archiveVersion>
<archiveVersion>518</archiveVersion>
<data>
<version>515</version>
<version>518</version>
<cstatargs>
<useExtraArgs>0</useExtraArgs>
<extraArgs></extraArgs>
@ -25,7 +25,7 @@
<outputDir>Debug\C-STAT</outputDir>
</cstatargs>
<cstat_settings>
<cstat_version>2.3.1</cstat_version>
<cstat_version>2.6.0</cstat_version>
<checks_tree>
<package enabled="true" name="STDCHECKS">
<group enabled="true" name="ARR">
@ -356,6 +356,7 @@
<check enabled="true" name="CERT-ERR30-C_b" />
<check enabled="true" name="CERT-ERR30-C_c" />
<check enabled="true" name="CERT-ERR30-C_d" />
<check enabled="true" name="CERT-ERR30-C_e" />
<check enabled="true" name="CERT-ERR32-C" />
<check enabled="true" name="CERT-ERR33-C_a" />
<check enabled="true" name="CERT-ERR33-C_b" />
@ -798,6 +799,7 @@
<check enabled="false" name="MISRAC2012-Dir-4.11_h" />
<check enabled="false" name="MISRAC2012-Dir-4.11_i" />
<check enabled="false" name="MISRAC2012-Dir-4.12" />
<check enabled="false" name="MISRAC2012-Dir-4.13_a" />
<check enabled="true" name="MISRAC2012-Dir-4.13_b" />
<check enabled="true" name="MISRAC2012-Dir-4.13_c" />
<check enabled="true" name="MISRAC2012-Dir-4.13_d" />
@ -817,6 +819,7 @@
<check enabled="true" name="MISRAC2012-Dir-4.14_j" />
<check enabled="true" name="MISRAC2012-Dir-4.14_l" />
<check enabled="true" name="MISRAC2012-Dir-4.14_m" />
<check enabled="false" name="MISRAC2012-Dir-4.15" />
</group>
<group enabled="true" name="MISRAC2012-Rule-1">
<check enabled="true" name="MISRAC2012-Rule-1.3_a" />
@ -830,6 +833,7 @@
<check enabled="true" name="MISRAC2012-Rule-1.3_i" />
<check enabled="true" name="MISRAC2012-Rule-1.3_j" />
<check enabled="true" name="MISRAC2012-Rule-1.3_k" />
<check enabled="true" name="MISRAC2012-Rule-1.3_l" />
<check enabled="true" name="MISRAC2012-Rule-1.3_m" />
<check enabled="true" name="MISRAC2012-Rule-1.3_n" />
<check enabled="true" name="MISRAC2012-Rule-1.3_o" />
@ -840,7 +844,15 @@
<check enabled="true" name="MISRAC2012-Rule-1.3_t" />
<check enabled="true" name="MISRAC2012-Rule-1.3_u" />
<check enabled="true" name="MISRAC2012-Rule-1.3_v" />
<check enabled="true" name="MISRAC2012-Rule-1.3_w" />
<check enabled="true" name="MISRAC2012-Rule-1.4_a" />
<check enabled="true" name="MISRAC2012-Rule-1.4_b" />
<check enabled="false" name="MISRAC2012-Rule-1.5_a" />
<check enabled="true" name="MISRAC2012-Rule-1.5_b" />
<check enabled="true" name="MISRAC2012-Rule-1.5_c" />
<check enabled="true" name="MISRAC2012-Rule-1.5_d" />
<check enabled="true" name="MISRAC2012-Rule-1.5_e" />
<check enabled="true" name="MISRAC2012-Rule-1.5_f" />
<check enabled="false" name="MISRAC2012-Rule-1.5_g" />
</group>
<group enabled="true" name="MISRAC2012-Rule-2">
<check enabled="true" name="MISRAC2012-Rule-2.1_a" />
@ -876,6 +888,7 @@
<group enabled="true" name="MISRAC2012-Rule-6">
<check enabled="true" name="MISRAC2012-Rule-6.1" />
<check enabled="true" name="MISRAC2012-Rule-6.2" />
<check enabled="true" name="MISRAC2012-Rule-6.3" />
</group>
<group enabled="true" name="MISRAC2012-Rule-7">
<check enabled="true" name="MISRAC2012-Rule-7.1" />
@ -883,6 +896,7 @@
<check enabled="true" name="MISRAC2012-Rule-7.3" />
<check enabled="true" name="MISRAC2012-Rule-7.4_a" />
<check enabled="true" name="MISRAC2012-Rule-7.4_b" />
<check enabled="true" name="MISRAC2012-Rule-7.5" />
</group>
<group enabled="true" name="MISRAC2012-Rule-8">
<check enabled="true" name="MISRAC2012-Rule-8.1" />
@ -900,6 +914,9 @@
<check enabled="true" name="MISRAC2012-Rule-8.12" />
<check enabled="false" name="MISRAC2012-Rule-8.13" />
<check enabled="true" name="MISRAC2012-Rule-8.14" />
<check enabled="false" name="MISRAC2012-Rule-8.15" />
<check enabled="false" name="MISRAC2012-Rule-8.16" />
<check enabled="false" name="MISRAC2012-Rule-8.17" />
</group>
<group enabled="true" name="MISRAC2012-Rule-9">
<check enabled="true" name="MISRAC2012-Rule-9.1_a" />
@ -922,6 +939,7 @@
<check enabled="true" name="MISRAC2012-Rule-10.1_R6" />
<check enabled="true" name="MISRAC2012-Rule-10.1_R7" />
<check enabled="true" name="MISRAC2012-Rule-10.1_R8" />
<check enabled="false" name="MISRAC2012-Rule-10.1_R10" />
<check enabled="true" name="MISRAC2012-Rule-10.2" />
<check enabled="true" name="MISRAC2012-Rule-10.3" />
<check enabled="true" name="MISRAC2012-Rule-10.4_a" />
@ -946,6 +964,7 @@
<check enabled="false" name="MISRAC2012-Rule-12.1" />
<check enabled="true" name="MISRAC2012-Rule-12.2" />
<check enabled="false" name="MISRAC2012-Rule-12.3" />
<check enabled="false" name="MISRAC2012-Rule-12.4" />
<check enabled="true" name="MISRAC2012-Rule-12.5" />
</group>
<group enabled="true" name="MISRAC2012-Rule-13">
@ -1002,6 +1021,11 @@
<check enabled="true" name="MISRAC2012-Rule-17.6" />
<check enabled="true" name="MISRAC2012-Rule-17.7" />
<check enabled="false" name="MISRAC2012-Rule-17.8" />
<check enabled="false" name="MISRAC2012-Rule-17.9" />
<check enabled="false" name="MISRAC2012-Rule-17.10" />
<check enabled="false" name="MISRAC2012-Rule-17.11" />
<check enabled="false" name="MISRAC2012-Rule-17.12" />
<check enabled="true" name="MISRAC2012-Rule-17.13" />
</group>
<group enabled="true" name="MISRAC2012-Rule-18">
<check enabled="true" name="MISRAC2012-Rule-18.1_a" />
@ -1018,6 +1042,7 @@
<check enabled="true" name="MISRAC2012-Rule-18.6_d" />
<check enabled="true" name="MISRAC2012-Rule-18.7" />
<check enabled="true" name="MISRAC2012-Rule-18.8" />
<check enabled="true" name="MISRAC2012-Rule-18.9" />
</group>
<group enabled="true" name="MISRAC2012-Rule-19">
<check enabled="true" name="MISRAC2012-Rule-19.1" />
@ -1048,6 +1073,7 @@
<check enabled="true" name="MISRAC2012-Rule-21.11" />
<check enabled="false" name="MISRAC2012-Rule-21.12_a" />
<check enabled="false" name="MISRAC2012-Rule-21.12_b" />
<check enabled="true" name="MISRAC2012-Rule-21.12_c" />
<check enabled="true" name="MISRAC2012-Rule-21.13" />
<check enabled="true" name="MISRAC2012-Rule-21.14" />
<check enabled="true" name="MISRAC2012-Rule-21.15" />
@ -1063,6 +1089,10 @@
<check enabled="true" name="MISRAC2012-Rule-21.19_a" />
<check enabled="true" name="MISRAC2012-Rule-21.19_b" />
<check enabled="true" name="MISRAC2012-Rule-21.20" />
<check enabled="true" name="MISRAC2012-Rule-21.21" />
<check enabled="false" name="MISRAC2012-Rule-21.22" />
<check enabled="false" name="MISRAC2012-Rule-21.23" />
<check enabled="false" name="MISRAC2012-Rule-21.24" />
</group>
<group enabled="true" name="MISRAC2012-Rule-22">
<check enabled="true" name="MISRAC2012-Rule-22.1_a" />
@ -1081,6 +1111,16 @@
<check enabled="true" name="MISRAC2012-Rule-22.9" />
<check enabled="true" name="MISRAC2012-Rule-22.10" />
</group>
<group enabled="true" name="MISRAC2012-Rule-23">
<check enabled="false" name="MISRAC2012-Rule-23.1" />
<check enabled="false" name="MISRAC2012-Rule-23.2" />
<check enabled="false" name="MISRAC2012-Rule-23.3" />
<check enabled="true" name="MISRAC2012-Rule-23.4" />
<check enabled="false" name="MISRAC2012-Rule-23.5" />
<check enabled="false" name="MISRAC2012-Rule-23.6" />
<check enabled="false" name="MISRAC2012-Rule-23.7" />
<check enabled="true" name="MISRAC2012-Rule-23.8" />
</group>
</package>
<package enabled="false" name="MISRAC++2008">
<group enabled="true" name="MISRAC++2008-0-1">
@ -1423,7 +1463,7 @@
<group>
<name>Blinky Demo</name>
<file>
<name>$PROJ_DIR$\main_blinky.c</name>
<name>$PROJ_DIR$\..\..\main_blinky.c</name>
</file>
</group>
<group>
@ -1431,25 +1471,25 @@
<group>
<name>include</name>
<file>
<name>$PROJ_DIR$\..\..\Source\include\event_groups.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\event_groups.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\message_buffer.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\message_buffer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\queue.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\queue.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\semphr.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\semphr.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\stream_buffer.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\stream_buffer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\task.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\task.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\timers.h</name>
<name>$PROJ_DIR$\..\..\..\..\Source\include\timers.h</name>
</file>
</group>
<group>
@ -1459,37 +1499,37 @@
<group>
<name>ARM_CM3</name>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CM3\port.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\portable\IAR\ARM_CM3\port.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CM3\portasm.s</name>
<name>$PROJ_DIR$\..\..\..\..\Source\portable\IAR\ARM_CM3\portasm.s</name>
</file>
</group>
</group>
<group>
<name>MemMang</name>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_4.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\portable\MemMang\heap_4.c</name>
</file>
</group>
</group>
<file>
<name>$PROJ_DIR$\..\..\Source\event_groups.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\event_groups.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\list.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\list.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\queue.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\queue.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\stream_buffer.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\stream_buffer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\tasks.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\tasks.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\timers.c</name>
<name>$PROJ_DIR$\..\..\..\..\Source\timers.c</name>
</file>
</group>
<group>
@ -1497,89 +1537,92 @@
<group>
<name>Standard Demo Tasks</name>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\AbortDelay.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\AbortDelay.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\BlockQ.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\BlockQ.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\blocktim.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\blocktim.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\countsem.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\countsem.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\death.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\death.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\dynamic.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\EventGroupsDemo.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\EventGroupsDemo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\GenQTest.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\GenQTest.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\integer.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\integer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\IntQueue.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\IntQueue.c</name>
</file>
<file>
<name>$PROJ_DIR$\IntQueueTimer.c</name>
<name>$PROJ_DIR$\..\..\IntQueueTimer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\IntSemTest.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\IntSemTest.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\MessageBufferAMP.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\MessageBufferAMP.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\MessageBufferDemo.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\MessageBufferDemo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\PollQ.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\PollQ.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\QPeek.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\QPeek.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\QueueOverwrite.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\QueueOverwrite.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\QueueSet.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\QueueSet.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\QueueSetPolling.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\QueueSetPolling.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\recmutex.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\recmutex.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\semtest.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\semtest.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\StaticAllocation.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\StaticAllocation.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\StreamBufferDemo.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\StreamBufferDemo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\StreamBufferInterrupt.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\StreamBufferInterrupt.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\TaskNotify.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\TaskNotify.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\TaskNotifyArray.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\TaskNotifyArray.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\TimerDemo.c</name>
<name>$PROJ_DIR$\..\..\..\Common\Minimal\TimerDemo.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\main_full.c</name>
<name>$PROJ_DIR$\..\..\main_full.c</name>
</file>
<file>
<name>$PROJ_DIR$\RegTest.S</name>
</file>
</group>
<group>
@ -1589,9 +1632,9 @@
</file>
</group>
<file>
<name>$PROJ_DIR$\FreeRTOSConfig.h</name>
<name>$PROJ_DIR$\..\..\FreeRTOSConfig.h</name>
</file>
<file>
<name>$PROJ_DIR$\main.c</name>
<name>$PROJ_DIR$\..\..\main.c</name>
</file>
</project>

@ -0,0 +1,181 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 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
*
*/
#include <FreeRTOSConfig.h>
RSEG CODE:CODE(2)
thumb
EXTERN ulRegTest1LoopCounter
EXTERN ulRegTest2LoopCounter
PUBLIC vRegTest1Implementation
PUBLIC vRegTest2Implementation
/*-----------------------------------------------------------*/
vRegTest1Implementation
/* Fill the core registers with known values. */
mov r0, #100
mov r1, #101
mov r2, #102
mov r3, #103
mov r4, #104
mov r5, #105
mov r6, #106
mov r7, #107
mov r8, #108
mov r9, #109
mov r10, #110
mov r11, #111
mov r12, #112
reg1_loop:
cmp r0, #100
bne reg1_error_loop
cmp r1, #101
bne reg1_error_loop
cmp r2, #102
bne reg1_error_loop
cmp r3, #103
bne reg1_error_loop
cmp r4, #104
bne reg1_error_loop
cmp r5, #105
bne reg1_error_loop
cmp r6, #106
bne reg1_error_loop
cmp r7, #107
bne reg1_error_loop
cmp r8, #108
bne reg1_error_loop
cmp r9, #109
bne reg1_error_loop
cmp r10, #110
bne reg1_error_loop
cmp r11, #111
bne reg1_error_loop
cmp r12, #112
bne reg1_error_loop
/* Everything passed, increment the loop counter. */
push { r0-r1 }
ldr r0, =ulRegTest1LoopCounter
ldr r1, [r0]
adds r1, r1, #1
str r1, [r0]
pop { r0-r1 }
/* Start again. */
b reg1_loop
reg1_error_loop:
/* If this line is hit then there was an error in a core register value.
The loop ensures the loop counter stops incrementing. */
b reg1_error_loop
/*-----------------------------------------------------------*/
vRegTest2Implementation
/* Set all the core registers to known values. */
mov r0, #-1
mov r1, #1
mov r2, #2
mov r3, #3
mov r4, #4
mov r5, #5
mov r6, #6
mov r7, #7
mov r8, #8
mov r9, #9
mov r10, #10
mov r11, #11
mov r12, #12
reg2_loop:
cmp r0, #-1
bne reg2_error_loop
cmp r1, #1
bne reg2_error_loop
cmp r2, #2
bne reg2_error_loop
cmp r3, #3
bne reg2_error_loop
cmp r4, #4
bne reg2_error_loop
cmp r5, #5
bne reg2_error_loop
cmp r6, #6
bne reg2_error_loop
cmp r7, #7
bne reg2_error_loop
cmp r8, #8
bne reg2_error_loop
cmp r9, #9
bne reg2_error_loop
cmp r10, #10
bne reg2_error_loop
cmp r11, #11
bne reg2_error_loop
cmp r12, #12
bne reg2_error_loop
/* Increment the loop counter to indicate this test is still functioning
correctly. */
push { r0-r1 }
ldr r0, =ulRegTest2LoopCounter
ldr r1, [r0]
adds r1, r1, #1
str r1, [r0]
/* Yield to increase test coverage. */
movs r0, #0x01
ldr r1, =0xe000ed04 /*NVIC_INT_CTRL */
lsl r0, r0, #28 /* Shift to PendSV bit */
str r0, [r1]
dsb
pop { r0-r1 }
/* Start again. */
b reg2_loop
reg2_error_loop:
/* If this line is hit then there was an error in a core register value.
This loop ensures the loop counter variable stops incrementing. */
b reg2_error_loop
/*-----------------------------------------------------------*/
END

@ -43,7 +43,7 @@
* Use the following commands to start the application running in a way that
* enables the debugger to connect, omit the "-s -S" to run the project without
* the debugger:
* qemu-system-arm -machine mps2-an385 -cpu cortex-m3 -kernel [path-to]/RTOSDemo.out -nographic -serial stdio -semihosting -semihosting-config enable=on,target=native -s -S
* qemu-system-arm -machine mps2-an385 -cpu cortex-m3 -kernel [path-to]/RTOSDemo.out -monitor none -nographic -serial stdio -s -S
*/
/* FreeRTOS includes. */

@ -109,14 +109,40 @@
* constant is different depending on the compiler in use. */
#define mainMESSAGE_BUFFER_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) )
#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) )
/* Parameters that are passed into the register check tasks solely for the
* purpose of ensuring parameters are passed into tasks correctly. */
#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 )
#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 )
/*-----------------------------------------------------------*/
/*
* Register check tasks, and the tasks used to write over and check the contents
* of the FPU registers, as described at the top of this file. The nature of
* these files necessitates that they are written in an assembly file, but the
* entry points are kept in the C file for the convenience of checking the task
* parameter.
*/
static void prvRegTestTaskEntry1( void * pvParameters );
extern void vRegTest1Implementation( void );
static void prvRegTestTaskEntry2( void * pvParameters );
extern void vRegTest2Implementation( void );
/* The task that checks the operation of all the other standard demo tasks, as
* described at the top of this file. */
static void prvCheckTask( void * pvParameters );
/*-----------------------------------------------------------*/
/* The following two variables are used to communicate the status of the
* register test tasks to the check task. If the variables keep incrementing,
* then the register test tasks have not discovered any errors. If a variable
* stops incrementing, then an error has been found. */
volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;
/*-----------------------------------------------------------*/
void main_full( void )
{
/* Start the standard demo tasks. */
@ -144,6 +170,15 @@ void main_full( void )
vStartStreamBufferInterruptDemo();
vStartInterruptSemaphoreTasks();
/* Create the register check tasks, as described at the top of this file */
xTaskCreate( prvRegTestTaskEntry1, /* Function that implements the task. */
"Reg1", /* Human readable name for the task - not used by the kernel but helps debugging. */
configMINIMAL_STACK_SIZE, /* Size of stack to allocate for the task - in words not bytes. */
mainREG_TEST_TASK_1_PARAMETER, /* A parameter passed into the task to check parameter passing is working correctly. */
tskIDLE_PRIORITY, /* Priority assigned to the task - must be between 0 (tskIDLE_PRIORITY) and (configMAX_PRIORITIES - 1). */
NULL ); /* Can be used to pass a handle to the create task out of the xTaskCreate() function. */
xTaskCreate( prvRegTestTaskEntry2, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );
/* The suicide tasks must be created last as they need to know how many
* tasks were running prior to their creation in order to ascertain whether
* or not the correct/expected number of tasks are running at any given time. */
@ -168,6 +203,8 @@ void main_full( void )
static void prvCheckTask( void * pvParameters )
{
static const char * pcMessage = "PASS";
unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;
const TickType_t xTaskPeriod = pdMS_TO_TICKS( 5000UL );
TickType_t xPreviousWakeTime;
extern uint32_t ulNestCount;
@ -279,6 +316,19 @@ static void prvCheckTask( void * pvParameters )
{
pcMessage = "xAreInterruptSemaphoreTasksStillRunning() returned false";
}
else if( ulLastRegTest1Value == ulRegTest1LoopCounter )
{
/* Check that the register test 1 task is still running. */
pcMessage = "Error in RegTest 1";
}
else if( ulLastRegTest2Value == ulRegTest2LoopCounter )
{
/* Check that the register test 2 task is still running. */
pcMessage = "Error in RegTest 2";
}
ulLastRegTest1Value = ulRegTest1LoopCounter;
ulLastRegTest2Value = ulRegTest2LoopCounter;
/* It is normally not good to call printf() from an embedded system,
* although it is ok in this simulated case. */
@ -319,3 +369,40 @@ void vFullDemoTickHookFunction( void )
vInterruptSemaphorePeriodicTest();
}
/*-----------------------------------------------------------*/
static void prvRegTestTaskEntry1( void * pvParameters )
{
/* Although the regtest task is written in assembler, its entry point is
* written in C for convenience of checking the task parameter is being passed
* in correctly. */
if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )
{
/* Start the part of the test that is written in assembler. */
vRegTest1Implementation();
}
/* The following line will only execute if the task parameter is found to
* be incorrect. The check task will detect that the regtest loop counter is
* not being incremented and flag an error. */
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/
static void prvRegTestTaskEntry2( void * pvParameters )
{
/* Although the regtest task is written in assembler, its entry point is
* written in C for convenience of checking the task parameter is being passed
* in correctly. */
if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )
{
/* Start the part of the test that is written in assembler. */
vRegTest2Implementation();
}
/* The following line will only execute if the task parameter is found to
* be incorrect. The check task will detect that the regtest loop counter is
* not being incremented and flag an error. */
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/

@ -177,7 +177,7 @@
if( xTaskAbortDelay( xBlockingTask ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Reset the priority to the normal controlling priority. */
@ -288,7 +288,7 @@
if( xReturned != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
/*-----------------------------------------------------------*/
@ -379,7 +379,7 @@
if( ulReturn != 0 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -393,7 +393,7 @@
if( ulReturn != 0 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -406,7 +406,7 @@
if( ulReturn != 0 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -442,7 +442,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -456,7 +456,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -469,7 +469,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -517,7 +517,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -531,7 +531,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -544,7 +544,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -584,7 +584,7 @@
if( xReturn != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Note the time before the delay so the length of the delay is known. */
@ -595,7 +595,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -609,7 +609,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -622,7 +622,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -660,7 +660,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -674,7 +674,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -687,7 +687,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -710,7 +710,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -724,7 +724,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -737,7 +737,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -755,7 +755,7 @@
/* The actual block time should not be less than the expected block time. */
if( xActualBlockTime < xExpectedBlockTime )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* The actual block time can be greater than the expected block time, as it
@ -763,7 +763,7 @@
* acceptable margin. */
if( xActualBlockTime > ( xExpectedBlockTime + xAllowableMargin ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
/*-----------------------------------------------------------*/
@ -785,7 +785,7 @@
xReturn = pdFAIL;
}
if( xErrorOccurred == pdTRUE )
if( xErrorOccurred != pdFALSE )
{
xReturn = pdFAIL;
}

@ -184,13 +184,13 @@ static void prvTakeAndGiveInTheSameOrder( void )
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Take the semaphore that is shared with the slave. */
if( xSemaphoreTake( xMasterSlaveMutex, intsemNO_BLOCK ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* This task now has the mutex. Unsuspend the slave so it too
@ -209,7 +209,7 @@ static void prvTakeAndGiveInTheSameOrder( void )
* task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Now wait a little longer than the time between ISR gives to also
@ -218,7 +218,7 @@ static void prvTakeAndGiveInTheSameOrder( void )
if( xSemaphoreTake( xISRMutex, ( xInterruptGivePeriod * 2 ) ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
xOkToGiveMutex = pdFALSE;
@ -227,13 +227,13 @@ static void prvTakeAndGiveInTheSameOrder( void )
* already held. */
if( xSemaphoreTake( xISRMutex, intsemNO_BLOCK ) != pdFAIL )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Should still be at the priority of the slave task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Give back the ISR semaphore to ensure the priority is not
@ -241,12 +241,12 @@ static void prvTakeAndGiveInTheSameOrder( void )
* attempting to obtain) is still held. */
if( xSemaphoreGive( xISRMutex ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Finally give back the shared mutex. This time the higher priority
@ -255,12 +255,12 @@ static void prvTakeAndGiveInTheSameOrder( void )
* suspended state again. */
if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
#if ( INCLUDE_eTaskGetState == 1 )
@ -286,13 +286,13 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Take the semaphore that is shared with the slave. */
if( xSemaphoreTake( xMasterSlaveMutex, intsemNO_BLOCK ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* This task now has the mutex. Unsuspend the slave so it too
@ -311,7 +311,7 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Now wait a little longer than the time between ISR gives to also
@ -320,7 +320,7 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
if( xSemaphoreTake( xISRMutex, ( xInterruptGivePeriod * 2 ) ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
xOkToGiveMutex = pdFALSE;
@ -329,13 +329,13 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* already held. */
if( xSemaphoreTake( xISRMutex, intsemNO_BLOCK ) != pdFAIL )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Should still be at the priority of the slave task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Give back the shared semaphore to ensure the priority is not disinherited
@ -343,7 +343,7 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* before this task runs again. */
if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Should still be at the priority of the slave task as this task still
@ -351,19 +351,19 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* mechanism. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Give back the ISR semaphore, which should result in the priority being
* disinherited as it was the last mutex held. */
if( xSemaphoreGive( xISRMutex ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Reset the mutex ready for the next round. */
@ -387,12 +387,12 @@ static void vInterruptMutexSlaveTask( void * pvParameters )
* state. */
if( xSemaphoreTake( xMasterSlaveMutex, portMAX_DELAY ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
}
}
@ -410,7 +410,7 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
/* Expect to start with the counting semaphore empty. */
if( uxQueueMessagesWaiting( ( QueueHandle_t ) xISRCountingSemaphore ) != 0 )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Wait until it is expected that the interrupt will have filled the
@ -422,12 +422,12 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
/* Now it is expected that the counting semaphore is full. */
if( uxQueueMessagesWaiting( ( QueueHandle_t ) xISRCountingSemaphore ) != intsemMAX_COUNT )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
if( uxQueueSpacesAvailable( ( QueueHandle_t ) xISRCountingSemaphore ) != 0 )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
ulCountingSemaphoreLoops++;
@ -444,7 +444,7 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
if( xCount != intsemMAX_COUNT )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Now raise the priority of this task so it runs immediately that the
@ -457,7 +457,7 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
xSemaphoreTake( xISRCountingSemaphore, portMAX_DELAY );
xOkToGiveCountingSemaphore = pdFALSE;
/* Reset the priority so as not to disturbed other tests too much. */
/* Reset the priority so as not to disturb other tests too much. */
vTaskPrioritySet( NULL, tskIDLE_PRIORITY );
ulCountingSemaphoreLoops++;
@ -506,25 +506,32 @@ void vInterruptSemaphorePeriodicTest( void )
BaseType_t xAreInterruptSemaphoreTasksStillRunning( void )
{
static uint32_t ulLastMasterLoopCounter = 0, ulLastCountingSemaphoreLoops = 0;
BaseType_t xReturn;
/* If the demo tasks are running then it is expected that the loop counters
* will have changed since this function was last called. */
if( ulLastMasterLoopCounter == ulMasterLoops )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
ulLastMasterLoopCounter = ulMasterLoops;
if( ulLastCountingSemaphoreLoops == ulCountingSemaphoreLoops )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
ulLastCountingSemaphoreLoops = ulCountingSemaphoreLoops++;
/* Errors detected in the task itself will have latched xErrorDetected
* to true. */
if( xErrorDetected != pdFALSE )
{
xReturn = pdFALSE;
}
else
{
xReturn = pdTRUE;
}
return ( BaseType_t ) !xErrorDetected;
return xReturn;
}

@ -362,7 +362,7 @@
* items it is possible for the queue to hold at any one time, which equals the
* queue length (in items, not bytes) multiplied by the size of each item. In this
* case the queue will hold staticQUEUE_LENGTH_IN_ITEMS 64-bit items. See
* https://www.FreeRTOS.org/Embedded-RTOS-Queues.html */
* http://www.freertos.org/Embedded-RTOS-Queues.html */
static uint8_t ucQueueStorageArea[ staticQUEUE_LENGTH_IN_ITEMS * sizeof( uint64_t ) ];
/* Create the queue. xQueueCreateStatic() has two more parameters than the
@ -440,7 +440,7 @@
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Ensure the semaphore passes a few sanity checks as a valid semaphore. */
@ -466,7 +466,7 @@
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Ensure the semaphore passes a few sanity checks as a valid semaphore. */
@ -535,7 +535,7 @@
* function expects it to be unavailable. */
if( xSemaphoreTake( xSemaphore, staticDONT_BLOCK ) == pdFAIL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvSanityCheckCreatedSemaphore( xSemaphore, staticBINARY_SEMAPHORE_MAX_COUNT );
@ -563,12 +563,12 @@
if( *puxVariableToIncrement == staticMAX_TIMER_CALLBACK_EXECUTIONS )
{
/* This is called from a timer callback so must not block. See
* https://www.FreeRTOS.org/FreeRTOS-timers-xTimerStop.html */
* http://www.FreeRTOS.org/FreeRTOS-timers-xTimerStop.html */
xReturned = xTimerStop( xExpiredTimer, staticDONT_BLOCK );
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
}
@ -615,7 +615,7 @@
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
vTaskDelay( xTimerPeriod * staticMAX_TIMER_CALLBACK_EXECUTIONS );
@ -624,7 +624,7 @@
* times, and then stopped itself. */
if( uxVariableToIncrement != staticMAX_TIMER_CALLBACK_EXECUTIONS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Finished with the timer, delete it. */
@ -634,7 +634,7 @@
* command will have been sent even without a block time being used. */
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Just to show the check task that this task is still executing. */
@ -658,21 +658,21 @@
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
vTaskDelay( xTimerPeriod * staticMAX_TIMER_CALLBACK_EXECUTIONS );
if( uxVariableToIncrement != staticMAX_TIMER_CALLBACK_EXECUTIONS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
xReturned = xTimerDelete( xTimer, staticDONT_BLOCK );
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
#endif /* if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) */
@ -757,13 +757,13 @@
/* Check the task was created correctly, then delete the task. */
if( xCreatedTask == NULL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else if( eTaskGetState( xCreatedTask ) != eSuspended )
{
/* The created task had a higher priority so should have executed and
* suspended itself by now. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{
@ -787,14 +787,14 @@
if( eTaskGetState( xCreatedTask ) != eSuspended )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
configASSERT( xReturned == pdPASS );
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
vTaskDelete( xCreatedTask );
@ -856,7 +856,7 @@
if( xEventBits != ( EventBits_t ) 0 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Some some bits, then read them back to check they are as expected. */
@ -866,7 +866,7 @@
if( xEventBits != xFirstTestBits )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
xEventGroupSetBits( xEventGroup, xSecondTestBits );
@ -875,7 +875,7 @@
if( xEventBits != ( xFirstTestBits | xSecondTestBits ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Finally try clearing some bits too and check that operation proceeds as
@ -886,7 +886,7 @@
if( xEventBits != xSecondTestBits )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
/*-----------------------------------------------------------*/
@ -907,12 +907,12 @@
if( ( ( TickType_t ) ( xTaskGetTickCount() - xTickCount ) ) < xShortBlockTime )
{
/* Did not block on the semaphore as long as expected. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
if( xReturned != pdFAIL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Should be possible to 'give' the semaphore up to a maximum of uxMaxCount
@ -923,7 +923,7 @@
if( xReturned == pdFAIL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -932,7 +932,7 @@
if( xReturned != pdFAIL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
configASSERT( uxSemaphoreGetCount( xSemaphore ) == uxMaxCount );
@ -945,7 +945,7 @@
if( xReturned == pdFAIL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -957,12 +957,12 @@
if( ( ( TickType_t ) ( xTaskGetTickCount() - xTickCount ) ) < xShortBlockTime )
{
/* Did not block on the semaphore as long as expected. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
if( xReturned != pdFAIL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 );
@ -983,7 +983,7 @@
if( xReturned != errQUEUE_EMPTY )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Now it should be possible to write to the queue staticQUEUE_LENGTH_IN_ITEMS
@ -994,7 +994,7 @@
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -1003,7 +1003,7 @@
if( xReturned != errQUEUE_FULL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Now read back from the queue to ensure the data read back matches that
@ -1014,12 +1014,12 @@
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
if( ullRead != ull )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -1028,7 +1028,7 @@
if( xReturned != errQUEUE_EMPTY )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
}
@ -1046,7 +1046,7 @@
if( xReturned != pdFAIL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Now it should be possible to take the mutex a number of times. */
@ -1056,7 +1056,7 @@
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -1068,7 +1068,7 @@
if( xReturned != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -1077,7 +1077,7 @@
if( xReturned != pdFAIL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
/*-----------------------------------------------------------*/
@ -1089,7 +1089,7 @@
if( uxCycleCounter == uxLastCycleCounter )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{

@ -152,7 +152,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* anything on the queue. */
if( xQueueReceive( xTestQueue, &xData, xTimeToBlock ) != errQUEUE_EMPTY )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* How long were we blocked for? */
@ -161,7 +161,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
if( xBlockedTime < xTimeToBlock )
{
/* Should not have blocked for less than we requested. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) )
@ -169,7 +169,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
/* Should not have blocked for longer than we requested,
* although we would not necessarily run as soon as we were
* unblocked so a margin is allowed. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -183,7 +183,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
#if configUSE_PREEMPTION == 0
@ -203,7 +203,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* anything on the queue. */
if( xQueueSend( xTestQueue, &xItem, xTimeToBlock ) != errQUEUE_FULL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* How long were we blocked for? */
@ -212,7 +212,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
if( xBlockedTime < xTimeToBlock )
{
/* Should not have blocked for less than we requested. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) )
@ -220,7 +220,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
/* Should not have blocked for longer than we requested,
* although we would not necessarily run as soon as we were
* unblocked so a margin is allowed. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -256,7 +256,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* but not execute as this task has higher priority. */
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Now fill the queue again before the other task gets a chance to
@ -264,13 +264,13 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* full ourselves, and the other task have set xRunIndicator. */
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
if( xRunIndicator == bktRUN_INDICATOR )
{
/* The other task should not have executed. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Raise the priority of the other task so it executes and blocks
@ -283,7 +283,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{
/* The other task should not have executed outside of the
* queue function. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Set the priority back down. */
@ -311,7 +311,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -334,7 +334,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* wake but not execute as this task has higher priority. */
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Now empty the queue again before the other task gets a chance to
@ -342,13 +342,13 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* empty ourselves, and the other task would be suspended. */
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
if( xRunIndicator == bktRUN_INDICATOR )
{
/* The other task should not have executed. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Raise the priority of the other task so it executes and blocks
@ -361,7 +361,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{
/* The other task should not have executed outside of the
* queue function. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY );
@ -411,7 +411,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
if( xQueueSend( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_FULL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* How long were we inside the send function? */
@ -420,7 +420,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
if( xBlockedTime < bktTIME_TO_BLOCK )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* We should of not blocked for much longer than bktALLOWABLE_MARGIN
@ -428,7 +428,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
* soon as we unblocked. */
if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Suspend ready for test 3. */
@ -447,7 +447,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
if( xQueueReceive( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_EMPTY )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
@ -455,7 +455,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
if( xBlockedTime < bktTIME_TO_BLOCK )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* We should of not blocked for much longer than bktALLOWABLE_MARGIN
@ -463,7 +463,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
* as we unblocked. */
if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
xRunIndicator = bktRUN_INDICATOR;
@ -493,7 +493,7 @@ static void prvBasicDelayTests( void )
* to the other tests in this file. */
if( ( xPostTime - xPreTime ) > ( bktTIME_TO_BLOCK + xAllowableMargin ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Now crude tests to check the vTaskDelayUntil() functionality. */
@ -510,7 +510,7 @@ static void prvBasicDelayTests( void )
if( ( xTaskGetTickCount() - xExpectedUnblockTime ) > ( bktTIME_TO_BLOCK + xAllowableMargin ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
xPrimaryCycles++;
@ -522,7 +522,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdTRUE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Now delay a few ticks so repeating the above block period will not block for
@ -532,7 +532,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdTRUE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* This time block for longer than xPeriod before calling xTaskDelayUntil() so
@ -542,7 +542,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Catch up. */
@ -550,7 +550,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdTRUE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Again block for slightly longer than a period so ensure the time is in the
@ -560,7 +560,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Reset to the original task priority ready for the other tests. */
@ -585,7 +585,7 @@ BaseType_t xAreBlockTimeTestTasksStillRunning( void )
xReturn = pdFAIL;
}
if( xErrorOccurred == pdTRUE )
if( xErrorOccurred != pdFALSE )
{
xReturn = pdFAIL;
}

@ -144,7 +144,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* polling task. */
if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
for( ux = 0; ux < recmuMAX_COUNT; ux++ )
@ -161,7 +161,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* flag will be set here. */
if( xSemaphoreTakeRecursive( xMutex, recmu15ms_DELAY ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Ensure the other task attempting to access the mutex (and the
@ -185,7 +185,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* as it too has a lower priority than this task. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
#if ( configUSE_PREEMPTION == 0 )
@ -197,7 +197,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* should no longer be the mutex owner, so the next give should fail. */
if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Keep count of the number of cycles this task has performed so a
@ -232,7 +232,7 @@ static void prvRecursiveMutexBlockingTask( void * pvParameters )
{
/* Did not expect to execute until the controlling task was
* suspended. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{
@ -240,7 +240,7 @@ static void prvRecursiveMutexBlockingTask( void * pvParameters )
* the polling task to obtain the mutex. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
xBlockingIsSuspended = pdTRUE;
@ -252,13 +252,13 @@ static void prvRecursiveMutexBlockingTask( void * pvParameters )
{
/* We should not leave the xSemaphoreTakeRecursive() function
* until the mutex was obtained. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* The controlling and blocking tasks should be in lock step. */
if( uxControllingCycles != ( UBaseType_t ) ( uxBlockingCycles + 1 ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Keep count of the number of cycles this task has performed so a
@ -290,7 +290,7 @@ static void prvRecursiveMutexPollingTask( void * pvParameters )
/* Is the blocking task suspended? */
if( ( xBlockingIsSuspended != pdTRUE ) || ( xControllingIsSuspended != pdTRUE ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{
@ -321,7 +321,7 @@ static void prvRecursiveMutexPollingTask( void * pvParameters )
* be suspended. */
if( ( xBlockingIsSuspended == pdTRUE ) || ( xControllingIsSuspended == pdTRUE ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
#if ( INCLUDE_uxTaskPriorityGet == 1 )
@ -341,7 +341,7 @@ static void prvRecursiveMutexPollingTask( void * pvParameters )
/* Release the mutex, disinheriting the higher priority again. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
#if ( INCLUDE_uxTaskPriorityGet == 1 )
@ -371,7 +371,7 @@ BaseType_t xAreRecursiveMutexTasksStillRunning( void )
/* Is the controlling task still cycling? */
if( uxLastControllingCycles == uxControllingCycles )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{
@ -381,7 +381,7 @@ BaseType_t xAreRecursiveMutexTasksStillRunning( void )
/* Is the blocking task still cycling? */
if( uxLastBlockingCycles == uxBlockingCycles )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{
@ -391,14 +391,14 @@ BaseType_t xAreRecursiveMutexTasksStillRunning( void )
/* Is the polling task still cycling? */
if( uxLastPollingCycles == uxPollingCycles )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{
uxLastPollingCycles = uxPollingCycles;
}
if( xErrorOccurred == pdTRUE )
if( xErrorOccurred != pdFALSE )
{
xReturn = pdFAIL;
}

@ -12,8 +12,17 @@ endif()
if( COVERAGE_TEST )
set( COVERAGE_TEST 1 )
set( NO_TRACING 1 )
add_compile_options( -DprojCOVERAGE_TEST=1 )
add_compile_options( -DprojENABLE_TRACING=0 )
else()
if( NO_TRACING )
set( NO_TRACING 1 )
add_compile_options( -DprojENABLE_TRACING=0 )
else()
set( NO_TRACING 0 )
add_compile_options( -DprojENABLE_TRACING=1 )
endif()
set( COVERAGE_TEST 0 )
add_compile_options( -DprojCOVERAGE_TEST=0 )
endif()
@ -58,7 +67,7 @@ add_subdirectory( ${FREERTOS_KERNEL_PATH} ${CMAKE_CURRENT_BINARY_DIR}/FreeRTOS-K
target_compile_options( freertos_kernel
PRIVATE
# Trace macro cast pointer to int to store memory management event
$<IF:${COVERAGE_TEST},,-Wno-pointer-to-int-cast>
$<IF:${NO_TRACING},,-Wno-pointer-to-int-cast>
)
file( GLOB FREERTOS_PLUS_TRACE_SOURCES ${FREERTOS_PLUS_TRACE_PATH}/*.c ${FREERTOS_PLUS_TRACE_PATH}/kernelports/FreeRTOS/*.c )
@ -70,7 +79,7 @@ add_executable( posix_demo
main_blinky.c
main_full.c
run-time-stats-utils.c
$<$<NOT:${COVERAGE_TEST}>:${FREERTOS_PLUS_TRACE_SOURCES}>
$<$<NOT:${NO_TRACING}>:${FREERTOS_PLUS_TRACE_SOURCES}>
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/AbortDelay.c
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/BlockQ.c
${CMAKE_CURRENT_LIST_DIR}/../Common/Minimal/blocktim.c

@ -128,6 +128,10 @@ extern void vAssertCalled( const char * const pcFileName,
#error projCOVERAGE_TEST should be defined to 1 or 0 on the command line.
#endif
#ifndef projENABLE_TRACING
#error projENABLE_TRACING should be defined to 1 or 0 on the command line.
#endif
#if ( projCOVERAGE_TEST == 1 )
/* Insert NOPs in empty decision paths to ensure both true and false paths
@ -154,7 +158,9 @@ extern void vAssertCalled( const char * const pcFileName,
#define configUSE_MALLOC_FAILED_HOOK 1
/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */
#if( projENABLE_TRACING == 1 )
#include "trcRecorder.h"
#endif /* if ( projENABLE_TRACING == 1 ) */
#endif /* if ( projCOVERAGE_TEST == 1 ) */
/* networking definitions */

@ -75,8 +75,14 @@ endif
ifeq ($(COVERAGE_TEST),1)
CPPFLAGS += -DprojCOVERAGE_TEST=1
CPPFLAGS += -DprojENABLE_TRACING=0
CFLAGS += -Werror
else
ifeq ($(NO_TRACING),1)
CPPFLAGS += -DprojENABLE_TRACING=0
else
CPPFLAGS += -DprojENABLE_TRACING=1
endif
CPPFLAGS += -DprojCOVERAGE_TEST=0
# Trace library.
SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/kernelports/FreeRTOS/trcKernelPort.c

@ -143,6 +143,8 @@ static BaseType_t prvStaticAllocationsWithNullBuffers( void )
}
/*-----------------------------------------------------------*/
#if( configUSE_TRACE_FACILITY == 1 )
static BaseType_t prvTraceUtils( void )
{
EventGroupHandle_t xEventGroup;
@ -202,8 +204,8 @@ static BaseType_t prvTraceUtils( void )
xReturn = pdFAIL;
}
/* Exercise the task trace utilities. Value of 100 is arbitrary, just want
* to check the value that is set is also read back. */
/* Exercise the task trace utilities. Value of 100 is arbitrary, just
* want to check the value that is set is also read back. */
uxValue = 100;
xTaskHandle = xTaskGetCurrentTaskHandle();
vTaskSetTaskNumber( xTaskHandle, uxValue );
@ -221,8 +223,8 @@ static BaseType_t prvTraceUtils( void )
/* Timer trace util functions are exercised in prvTimerQuery(). */
/* Exercise the stream buffer utilities. Try creating with a trigger level
* of 0, it should then get capped to 1. */
/* Exercise the stream buffer utilities. Try creating with a trigger
* level of 0, it should then get capped to 1. */
xStreamBuffer = xStreamBufferCreate( sizeof( uint32_t ), 0 );
if( xStreamBuffer != NULL )
@ -266,6 +268,8 @@ static BaseType_t prvTraceUtils( void )
return xReturn;
}
#endif /* #if( configUSE_TRACE_FACILITY == 1 ) */
/*-----------------------------------------------------------*/
static BaseType_t prvPeekTimeout( void )
@ -370,6 +374,8 @@ static BaseType_t prvQueueQueryFromISR( void )
}
/*-----------------------------------------------------------*/
#if( configUSE_TRACE_FACILITY == 1)
static BaseType_t prvTaskQueryFunctions( void )
{
static TaskStatus_t xStatus, * pxStatusArray;
@ -469,7 +475,7 @@ static BaseType_t prvTaskQueryFunctions( void )
xReturn = pdFAIL;
}
/* Basic santity check of array contents. */
/* Basic sanity check of array contents. */
for( ux = 0; ux < uxReturned; ux++ )
{
if( pxStatusArray[ ux ].eCurrentState >= ( UBaseType_t ) eInvalid )
@ -492,6 +498,8 @@ static BaseType_t prvTaskQueryFunctions( void )
return xReturn;
}
#endif /* #if( configUSE_TRACE_FACILITY == 1) */
/*-----------------------------------------------------------*/
static BaseType_t prvDummyTagFunction( void * pvParameter )
@ -609,12 +617,16 @@ static BaseType_t prvTimerQuery( void )
xReturn = pdFAIL;
}
#if( configUSE_TRACE_FACILITY == 1 )
{
vTimerSetTimerNumber( xTimer, uxTimerNumber );
if( uxTimerGetTimerNumber( xTimer ) != uxTimerNumber )
{
xReturn = pdFAIL;
}
}
#endif /* #if( configUSE_TRACE_FACILITY == 1 ) */
xTimerDelete( xTimer, portMAX_DELAY );
}
@ -632,10 +644,16 @@ BaseType_t xRunCodeCoverageTestAdditions( void )
BaseType_t xReturn = pdPASS;
xReturn &= prvStaticAllocationsWithNullBuffers();
#if( configUSE_TRACE_FACILITY == 1 )
{
xReturn &= prvTraceUtils();
xReturn &= prvTaskQueryFunctions();
}
#endif
xReturn &= prvPeekTimeout();
xReturn &= prvQueueQueryFromISR();
xReturn &= prvTaskQueryFunctions();
xReturn &= prvTaskTags();
xReturn &= prvTimerQuery();

@ -68,7 +68,7 @@
/* Local includes. */
#include "console.h"
#if ( projCOVERAGE_TEST != 1 )
#if ( projENABLE_TRACING == 1 )
#include <trcRecorder.h>
#endif
@ -139,13 +139,6 @@ static void handle_sigint( int signal );
* in a different file. */
StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
/* Notes if the trace is running or not. */
#if ( projCOVERAGE_TEST == 1 )
static BaseType_t xTraceRunning = pdFALSE;
#else
static BaseType_t xTraceRunning = pdTRUE;
#endif
static clockid_t cid = CLOCK_THREAD_CPUTIME_ID;
/*-----------------------------------------------------------*/
@ -155,8 +148,7 @@ int main( void )
/* SIGINT is not blocked by the posix port */
signal( SIGINT, handle_sigint );
/* Do not include trace code when performing a code coverage analysis. */
#if ( projCOVERAGE_TEST != 1 )
#if ( projENABLE_TRACING == 1 )
{
/* Initialise the trace recorder. Use of the trace recorder is optional.
* See http://www.FreeRTOS.org/trace for more information. */
@ -168,9 +160,9 @@ int main( void )
#if ( TRACE_ON_ENTER == 1 )
printf( "\r\nThe trace will be dumped to disk if Enter is hit.\r\n" );
#endif
#endif /* if ( TRACE_ON_ENTER == 1 ) */
}
#endif /* if ( projCOVERAGE_TEST != 1 ) */
#endif /* if ( projENABLE_TRACING == 1 ) */
console_init();
#if ( mainSELECTED_APPLICATION == BLINKY_DEMO )
@ -281,10 +273,11 @@ void traceOnEnter()
if( xReturn > 0 )
{
if( xTraceRunning == pdTRUE )
#if ( projENABLE_TRACING == 1 )
{
prvSaveTraceFile();
}
#endif /* if ( projENABLE_TRACING == 1 ) */
/* clear the buffer */
char buffer[ 1 ];
@ -334,10 +327,11 @@ void vAssertCalled( const char * const pcFileName,
{
xPrinted = pdTRUE;
if( xTraceRunning == pdTRUE )
#if ( projENABLE_TRACING == 1 )
{
prvSaveTraceFile();
}
#endif /* if ( projENABLE_TRACING == 0 ) */
}
/* You can step out of this function to debug the assertion by using
@ -353,10 +347,8 @@ void vAssertCalled( const char * const pcFileName,
}
/*-----------------------------------------------------------*/
#if ( projENABLE_TRACING == 1 )
static void prvSaveTraceFile( void )
{
/* Tracing is not used when code coverage analysis is being performed. */
#if ( projCOVERAGE_TEST != 1 )
{
FILE * pxOutputFile;
@ -375,8 +367,7 @@ static void prvSaveTraceFile( void )
printf( "\r\nFailed to create trace dump file\r\n" );
}
}
#endif /* if ( projCOVERAGE_TEST != 1 ) */
}
#endif /* if ( projENABLE_TRACING == 1 ) */
/*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an

@ -737,6 +737,8 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
xErrorCount++;
}
#if( configUSE_TRACE_FACILITY == 1 )
{
/* Also with the vTaskGetInfo() function. */
vTaskGetInfo( xTimerTaskHandle, /* The task being queried. */
&xTaskInfo, /* The structure into which information on the task will be written. */
@ -753,6 +755,8 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
pcStatusMessage = "Error: vTaskGetInfo() returned incorrect information about the timer task";
xErrorCount++;
}
}
#endif /* #if( configUSE_TRACE_FACILITY == 1 ) */
/* Other tests that should only be performed once follow. The test task
* is not created on each iteration because to do so would cause the death

@ -405,6 +405,16 @@ static void prvCheckTask( void * pvParameters )
}
/*-----------------------------------------------------------*/
static void prvEndSchedulerTask( void * pvParameters )
{
( void ) pvParameters;
/* Calling vTaskEndScheduler in an application created task. */
vTaskEndScheduler();
}
/*-----------------------------------------------------------*/
static void prvTestTask( void * pvParameters )
{
const unsigned long ulMSToSleep = 5;
@ -428,6 +438,7 @@ void vFullDemoIdleFunction( void )
{
const unsigned long ulMSToSleep = 15;
void * pvAllocated;
BaseType_t xReturn;
/* Sleep to reduce CPU load, but don't sleep indefinitely in case there are
* tasks waiting to be terminated by the idle task. */
@ -484,7 +495,10 @@ void vFullDemoIdleFunction( void )
if( ( xTaskGetTickCount() - configINITIAL_TICK_COUNT ) >= xMaxRunTime )
{
vTaskEndScheduler();
/* Creating another task to end the scheduler to prevent deleting idle
* task itself in vTaskEndScheduler. */
xReturn = xTaskCreate( prvEndSchedulerTask, "TestEnd", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
configASSERT( xReturn == pdPASS );
}
}
#endif /* if ( projCOVERAGE_TEST == 1 ) */

@ -1 +1 @@
Subproject commit 7284d84dc88c5aaf2dc8337044177728b8bdae2d
Subproject commit 30f6061f48e2d54625d31e72ada6f5c474fba99f

@ -72,11 +72,19 @@ Each of the leaf directories under `proofs` is a proof of the memory
safety of a single entry point in FreeRTOS. The scripts that you ran in the
previous step will have left a Makefile in each of those directories. To
run a proof, change into the directory for that proof and run `make`.
The proofs may take some time to run; they eventually write their output to
`cbmc.txt`, which should have the text `VERIFICATION SUCCESSFUL` at the end.
The proofs may take some time to run.
The make command will also generate a report in html and json format which makes
understanding the failures easier.
### Proof results
The `make` command above generates a report in HTML and JSON format. Taking
[TaskCreate](./proofs/Task/TaskCreate) as an example:
* HTML report is generated at `./proofs/Task/TaskCreate/html/html`.
* JSON report is generated at `./proofs/Task/TaskCreate/html/json`.
You can open `./proofs/Task/TaskCreate/html/html/index.html` in any browser to view
the HTML report. You should see `None` under the `Errors` section in case of a
successful run.
### Proof directory structure

@ -2949,6 +2949,9 @@ void test_xtaskGetHandle_success( void )
/* prvSearchForNameWithinSingleList */
listCURRENT_LIST_LENGTH_ExpectAndReturn( &pxReadyTasksLists[ configMAX_PRIORITIES - 1 ],
1 );
listGET_LIST_ITEM_OWNER_ExpectAndReturn( &list_item, ptcb );
/* vTaskResumeAll */
listLIST_IS_EMPTY_ExpectAndReturn( &xPendingReadyList, pdTRUE );
@ -2965,19 +2968,26 @@ void test_xtaskGetHandle_success_2elements( void )
task_handle = create_task();
task_handle2 = create_task();
strcpy( task_handle2->pcTaskName, "task2" );
ptcb = task_handle;
INITIALIZE_LIST_2E( pxReadyTasksLists[ configMAX_PRIORITIES - 1 ],
list_item, list_item2,
ptcb, task_handle2 );
/* Expectations */
/* prvSearchForNameWithinSingleList */
listCURRENT_LIST_LENGTH_ExpectAndReturn( &pxReadyTasksLists[ configMAX_PRIORITIES - 1 ],
1 );
2 );
listGET_LIST_ITEM_OWNER_ExpectAndReturn( &list_item, task_handle );
listGET_LIST_ITEM_OWNER_ExpectAndReturn( &list_item2, task_handle2 );
/* vTaskResumeAll */
listLIST_IS_EMPTY_ExpectAndReturn( &xPendingReadyList, pdTRUE );
/* API Call */
ret_task_handle = xTaskGetHandle( "create_task" );
ret_task_handle = xTaskGetHandle( "task2" );
/* Validations */
TEST_ASSERT_EQUAL_PTR( task_handle2, ret_task_handle );
}
@ -2989,6 +2999,7 @@ void test_xtaskGetHandle_success_2elements_set_index( void )
task_handle = create_task();
task_handle2 = create_task();
strcpy( task_handle2->pcTaskName, "task2" );
ptcb = task_handle;
INITIALIZE_LIST_2E( pxReadyTasksLists[ configMAX_PRIORITIES - 1 ],
list_item, list_item2,
@ -2999,15 +3010,20 @@ void test_xtaskGetHandle_success_2elements_set_index( void )
/* advance index */
pxReadyTasksLists[ configMAX_PRIORITIES - 1 ].pxIndex =
pxReadyTasksLists[ configMAX_PRIORITIES - 1 ].pxIndex->pxNext;
/* Expectations */
/* prvSearchForNameWithinSingleList */
listCURRENT_LIST_LENGTH_ExpectAndReturn( &pxReadyTasksLists[ configMAX_PRIORITIES - 1 ],
1 );
listGET_LIST_ITEM_OWNER_ExpectAndReturn( &list_item, task_handle );
listGET_LIST_ITEM_OWNER_ExpectAndReturn( &list_item2, task_handle2 );
/* vTaskResumeAll */
listLIST_IS_EMPTY_ExpectAndReturn( &xPendingReadyList, pdTRUE );
/* API Call */
ret_task_handle = xTaskGetHandle( "create_task" );
ret_task_handle = xTaskGetHandle( "task2" );
/* Validations */
TEST_ASSERT_EQUAL_PTR( task_handle2, ret_task_handle );
}
@ -3028,6 +3044,10 @@ void test_xtaskGetHandle_fail_no_task_found( void )
listCURRENT_LIST_LENGTH_ExpectAndReturn(
&pxReadyTasksLists[ configMAX_PRIORITIES - 1 ],
2 );
listGET_LIST_ITEM_OWNER_ExpectAndReturn( &list_item, task_handle );
listGET_LIST_ITEM_OWNER_ExpectAndReturn( &list_item2, task_handle2 );
int i = configMAX_PRIORITIES - 1;
do
@ -3041,6 +3061,7 @@ void test_xtaskGetHandle_fail_no_task_found( void )
listCURRENT_LIST_LENGTH_ExpectAndReturn( pxOverflowDelayedTaskList, 0 );
listCURRENT_LIST_LENGTH_ExpectAndReturn( &xSuspendedTaskList, 0 );
listCURRENT_LIST_LENGTH_ExpectAndReturn( &xTasksWaitingTermination, 0 );
/* vTaskResumeAll */
listLIST_IS_EMPTY_ExpectAndReturn( &xPendingReadyList, pdTRUE );

@ -105,7 +105,7 @@
#define configTICK_CORE 1
#define configRUN_MULTIPLE_PRIORITIES 1
#define configUSE_CORE_AFFINITY 1
#define configUSE_MINIMAL_IDLE_HOOK 0
#define configUSE_PASSIVE_IDLE_HOOK 0
#define configUSE_TASK_PREEMPTION_DISABLE 0
/* RP2040 specific */

@ -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/disable_multiple_priorities)
set(TEST_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../../tests/smp/disable_multiple_priorities)
add_library(disable_multiple_priorities INTERFACE)
target_sources(disable_multiple_priorities INTERFACE
${BOARD_LIBRARY_DIR}/main.c
${CMAKE_CURRENT_LIST_DIR}/disable_multiple_priorities_test_runner.c
${TEST_SOURCE_DIR}/disable_multiple_priorities.c)
target_include_directories(disable_multiple_priorities INTERFACE
${CMAKE_CURRENT_LIST_DIR}/../../..
${TEST_INCLUDE_PATHS}
)
target_link_libraries(disable_multiple_priorities INTERFACE
FreeRTOS-Kernel
FreeRTOS-Kernel-Heap4
${BOARD_LINK_LIBRARIES})
add_executable(test_disable_multiple_priorities)
enable_board_functions(test_disable_multiple_priorities)
target_link_libraries(test_disable_multiple_priorities disable_multiple_priorities)
target_include_directories(test_disable_multiple_priorities PUBLIC
${BOARD_INCLUDE_PATHS})
target_compile_definitions(test_disable_multiple_priorities PRIVATE
${BOARD_DEFINES}
)

@ -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 disable_multiple_priorities_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. */
vRunDisableMultiplePrioritiesTest();
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/
void vRunTest( void )
{
xTaskCreate( prvTestRunnerTask,
"testRunner",
configMINIMAL_STACK_SIZE,
NULL,
configMAX_PRIORITIES - 1,
NULL );
}
/*-----------------------------------------------------------*/

@ -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/disable_preemption)
set(TEST_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../../tests/smp/disable_preemption)
add_library(disable_preemption INTERFACE)
target_sources(disable_preemption INTERFACE
${BOARD_LIBRARY_DIR}/main.c
${CMAKE_CURRENT_LIST_DIR}/disable_preemption_test_runner.c
${TEST_SOURCE_DIR}/disable_preemption.c)
target_include_directories(disable_preemption INTERFACE
${CMAKE_CURRENT_LIST_DIR}/../../..
${TEST_INCLUDE_PATHS}
)
target_link_libraries(disable_preemption INTERFACE
FreeRTOS-Kernel
FreeRTOS-Kernel-Heap4
${BOARD_LINK_LIBRARIES})
add_executable(test_disable_preemption)
enable_board_functions(test_disable_preemption)
target_link_libraries(test_disable_preemption disable_preemption)
target_include_directories(test_disable_preemption PUBLIC
${BOARD_INCLUDE_PATHS})
target_compile_definitions(test_disable_preemption PRIVATE
${BOARD_DEFINES}
)

@ -0,0 +1,75 @@
/*
* 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 disable_preemption_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. */
vRunDisablePreemptionTest();
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/
void vRunTest( void )
{
xTaskCreate( prvTestRunnerTask,
"testRunner",
configMINIMAL_STACK_SIZE,
NULL,
configMAX_PRIORITIES - 1,
NULL );
}
/*-----------------------------------------------------------*/

@ -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_affinity)
set(TEST_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../../tests/smp/schedule_affinity)
add_library(schedule_affinity INTERFACE)
target_sources(schedule_affinity INTERFACE
${BOARD_LIBRARY_DIR}/main.c
${CMAKE_CURRENT_LIST_DIR}/schedule_affinity_test_runner.c
${TEST_SOURCE_DIR}/schedule_affinity.c)
target_include_directories(schedule_affinity INTERFACE
${CMAKE_CURRENT_LIST_DIR}/../../..
${TEST_INCLUDE_PATHS}
)
target_link_libraries(schedule_affinity INTERFACE
FreeRTOS-Kernel
FreeRTOS-Kernel-Heap4
${BOARD_LINK_LIBRARIES})
add_executable(test_schedule_affinity)
enable_board_functions(test_schedule_affinity)
target_link_libraries(test_schedule_affinity schedule_affinity)
target_include_directories(test_schedule_affinity PUBLIC
${BOARD_INCLUDE_PATHS})
target_compile_definitions(test_schedule_affinity PRIVATE
${BOARD_DEFINES}
)

@ -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_affinity_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. */
vRunScheduleAffinityTest();
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/
void vRunTest( void )
{
xTaskCreate( prvTestRunnerTask,
"testRunner",
configMINIMAL_STACK_SIZE,
NULL,
configMAX_PRIORITIES - 1,
NULL );
}
/*-----------------------------------------------------------*/

@ -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_highest_priority)
set(TEST_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../../tests/smp/schedule_highest_priority)
add_library(schedule_highest_priority INTERFACE)
target_sources(schedule_highest_priority INTERFACE
${BOARD_LIBRARY_DIR}/main.c
${CMAKE_CURRENT_LIST_DIR}/schedule_highest_priority_test_runner.c
${TEST_SOURCE_DIR}/schedule_highest_priority.c)
target_include_directories(schedule_highest_priority INTERFACE
${CMAKE_CURRENT_LIST_DIR}/../../..
${TEST_INCLUDE_PATHS}
)
target_link_libraries(schedule_highest_priority INTERFACE
FreeRTOS-Kernel
FreeRTOS-Kernel-Heap4
${BOARD_LINK_LIBRARIES})
add_executable(test_schedule_highest_priority)
enable_board_functions(test_schedule_highest_priority)
target_link_libraries(test_schedule_highest_priority schedule_highest_priority)
target_include_directories(test_schedule_highest_priority PUBLIC
${BOARD_INCLUDE_PATHS})
target_compile_definitions(test_schedule_highest_priority PRIVATE
${BOARD_DEFINES}
)

@ -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_highest_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. */
vRunScheduleHighestPriorityTest();
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/
void vRunTest( void )
{
xTaskCreate( prvTestRunnerTask,
"testRunner",
configMINIMAL_STACK_SIZE,
NULL,
configMAX_PRIORITIES - 1,
NULL );
}
/*-----------------------------------------------------------*/

@ -0,0 +1,244 @@
/*
* 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 disable_multiple_priorities.c
* @brief The user shall be able to configure the scheduler to not run a
* lower priority task and a higher priority task simultaneously.
*
* Procedure:
* - Create ( num of cores ) test tasks ( T0~Tn-1 ). Priority T0 > T1 > ... > Tn-2 > Tn-1.
* - Verify the following conditions:
* - for each task Ti in [T0..Tn-1]:
* - Tasks T0~Ti-1 are in suspended state.
* - Task Ti is running.
* - Tasks Ti+1~Tn-1 are in ready state.
* - Suspend task Ti.
* Expected:
* - Only one task is running at the same time since all the test test tasks
* are of different priorities.
*/
/* Standard includes. */
#include <stdint.h>
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Unit testing support functions. */
#include "unity.h"
/*-----------------------------------------------------------*/
/**
* @brief Timeout value to stop test.
*/
#define TEST_TIMEOUT_MS ( 1000 )
/*-----------------------------------------------------------*/
#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 != 0 )
#error configRUN_MULTIPLE_PRIORITIES must be disabled by including test_config.h in FreeRTOSConfig.h.
#endif /* if configRUN_MULTIPLE_PRIORITIES != 0 */
#if ( configUSE_CORE_AFFINITY != 0 )
#error configUSE_CORE_AFFINITY must be disabled by including test_config.h in FreeRTOSConfig.h.
#endif /* if configUSE_CORE_AFFINITY != 0 */
#if ( configMAX_PRIORITIES <= ( configNUMBER_OF_CORES + 2 ) )
#error This test creates tasks with different priority, requires configMAX_PRIORITIES to be larger than configNUMBER_OF_CORES.
#endif /* if ( configMAX_PRIORITIES <= ( configNUMBER_OF_CORES + 2 ) ) */
/*-----------------------------------------------------------*/
/**
* @brief Test case "Disable Multiple Priorities".
*/
void Test_DisableMultiplePriorities( void );
/**
* @brief Task function that verifies that it is the only running task.
*/
static void prvCheckRunningTask( void * pvParameters );
/*-----------------------------------------------------------*/
/**
* @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 Test results.
*/
static BaseType_t xTestResults[ configNUMBER_OF_CORES ] = { pdFAIL };
/*-----------------------------------------------------------*/
static void prvCheckRunningTask( void * pvParameters )
{
uint32_t i = 0;
uint32_t currentTaskIdx = *( ( uint32_t * ) pvParameters );
eTaskState taskState;
BaseType_t xTestResult = pdPASS;
for( i = 0; i < configNUMBER_OF_CORES; i++ )
{
/* All the test tasks are created by the test runner task which runs
* at the highest priority. The test runs with multiple priorities
* disabled. Therefore, xTaskHandles[ i ] can not be NULL because none
* of the test tasks can run until the test runner task has created all
* the tasks and then blocked itself by calling vTaskDelay. Return
* pdFAIL in xTestResults to indicate test failure if any of the test
* task is not created yet. */
if( xTaskHandles[ i ] == NULL )
{
xTestResult = pdFAIL;
}
else
{
taskState = eTaskGetState( xTaskHandles[ i ] );
if( i > currentTaskIdx )
{
/* Tasks with index greater than current task are of lower
* priority than the current task and must be in the ready
* state. */
if( taskState != eReady )
{
xTestResult = pdFAIL;
}
}
else if( i == currentTaskIdx )
{
/* Current task must be running. */
if( taskState != eRunning )
{
xTestResult = pdFAIL;
}
}
else
{
/* Tasks with index smaller than current task are of higher
* priority than the current task and must be in the suspended
* state. */
if( taskState != eSuspended )
{
xTestResult = pdFAIL;
}
}
}
if( xTestResult != pdPASS )
{
break;
}
}
xTestResults[ currentTaskIdx ] = xTestResult;
/* Suspend the test task itself. */
vTaskSuspend( NULL );
}
/*-----------------------------------------------------------*/
void Test_DisableMultiplePriorities( void )
{
uint32_t i;
BaseType_t xTaskCreationResult;
/* Create configNUMBER_OF_CORES low priority tasks. */
for( i = 0; i < configNUMBER_OF_CORES; i++ )
{
xTaskCreationResult = xTaskCreate( prvCheckRunningTask,
"CheckRunning",
configMINIMAL_STACK_SIZE * 2,
&xTaskIndexes[ i ],
configMAX_PRIORITIES - 2 - i,
&xTaskHandles[ i ] );
TEST_ASSERT_EQUAL_MESSAGE( pdPASS, xTaskCreationResult, "Task creation failed." );
}
/* Waiting for all the test tasks. */
vTaskDelay( pdMS_TO_TICKS( TEST_TIMEOUT_MS ) );
/* Verify test results for all the tasks. */
for( i = 0; i < configNUMBER_OF_CORES; i++ )
{
TEST_ASSERT_EQUAL_MESSAGE( pdPASS, xTestResults[ i ], "Task test result is pdFAIL" );
}
}
/*-----------------------------------------------------------*/
/* Runs before every test, put init calls here. */
void setUp( void )
{
uint32_t i;
/* Initialize variables. */
for( i = 0; i < configNUMBER_OF_CORES; i++ )
{
xTaskHandles[ i ] = NULL;
xTaskIndexes[ i ] = i;
}
}
/*-----------------------------------------------------------*/
/* 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 disable multiple priorities test.
*/
void vRunDisableMultiplePrioritiesTest( void )
{
UNITY_BEGIN();
RUN_TEST( Test_DisableMultiplePriorities );
UNITY_END();
}
/*-----------------------------------------------------------*/

@ -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
*
*/
#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_CORE_AFFINITY
#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 */
#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 0
#define configUSE_CORE_AFFINITY 0
#define configUSE_MINIMAL_IDLE_HOOK 0
#define configUSE_TASK_PREEMPTION_DISABLE 0
#define configUSE_TIME_SLICING 1
#define configUSE_PREEMPTION 1
/*-----------------------------------------------------------*/
/**
* @brief Entry point for test runner to run disable multiple priorities test.
*/
void vRunDisableMultiplePrioritiesTest( void );
/*-----------------------------------------------------------*/
#endif /* ifndef TEST_CONFIG_H */

@ -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 disable_preemption.c
* @brief The scheduler shall not preempt a task for which preemption is disabled.
*
* Procedure:
* - Create ( num of cores + 1 ) tasks ( T0~Tn ) with priorities T0 > T1 > ... Tn.
* T0 has the highest priority and Tn has the lowest priority.
* - T0~Tn-1 suspend themselves.
* - Tn disables preemption for itself and then resumes ( T0~Tn-1 ). Test
* runner validates that Tn is still running.
* - Test runner enables preemption of Tn. Test runner validates that Tn is
* no longer running.
* Expected:
* - Tn will not be switched out when it has disabled preemption for itself.
* - Tn will be preempted when the test runner enables preemption for it.
*/
/* Standard includes. */
#include <stdint.h>
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Unit testing support functions. */
#include "unity.h"
/*-----------------------------------------------------------*/
/**
* @brief Timeout value to stop test.
*/
#define TEST_TIMEOUT_MS ( 1000 )
/**
* @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_TASK_PREEMPTION_DISABLE != 1 )
#error configUSE_TASK_PREEMPTION_DISABLE must be enabled by including test_config.h in FreeRTOSConfig.h.
#endif /* if configUSE_TASK_PREEMPTION_DISABLE != 1 */
#if ( configMAX_PRIORITIES <= ( configNUMBER_OF_CORES + 2 ) )
#error configMAX_PRIORITIES must be larger than ( configNUMBER_OF_CORES + 2 ) to avoid scheduling idle tasks unexpectedly.
#endif /* if ( configMAX_PRIORITIES <= ( configNUMBER_OF_CORES + 2 ) ) */
/*-----------------------------------------------------------*/
/**
* @brief Test case "Disable Preemption".
*/
void Test_DisablePreemption( void );
/**
* @brief Disable preemption test task.
*/
static void prvTestPreemptionDisableTask( void * pvParameters );
/*-----------------------------------------------------------*/
/**
* @brief Handles of the tasks created in this test.
*/
static TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ];
/**
* @brief Indexes of the tasks created in this test.
*/
static uint32_t xTaskIndexes[ configNUMBER_OF_CORES + 1 ];
/**
* @brief Flags to indicate the test result.
*/
static BaseType_t xTestResult = pdFAIL;
/*-----------------------------------------------------------*/
static void prvTestPreemptionDisableTask( void * pvParameters )
{
uint32_t currentTaskIdx = *( ( uint32_t * ) pvParameters );
uint32_t taskIndex;
eTaskState taskState;
BaseType_t xAllHighPriorityTasksSuspended = pdFALSE;
if( currentTaskIdx < configNUMBER_OF_CORES )
{
/* Tasks with smaller index have higher priority. Higher priority tasks
* suspend themselves and are resumed later by the lowest priority task
* after the lower priority task disables preemption for itself. */
vTaskSuspend( NULL );
}
else
{
/* Wait for all the other higher priority tasks to suspend themselves. */
while( xAllHighPriorityTasksSuspended == pdFALSE )
{
for( taskIndex = 0; taskIndex < configNUMBER_OF_CORES; taskIndex++ )
{
taskState = eTaskGetState( xTaskHandles[ taskIndex ] );
if( taskState != eSuspended )
{
break;
}
}
if( taskIndex == configNUMBER_OF_CORES )
{
xAllHighPriorityTasksSuspended = pdTRUE;
}
}
/* Disable preemption and resume all the other higher priority tasks.
* At this point, the number of higher priority ready tasks is equal
* to the number of cores. Still this lower priority must not be
* switched out because it has disabled preemption for itself. */
vTaskPreemptionDisable( NULL );
for( taskIndex = 0; taskIndex < configNUMBER_OF_CORES; taskIndex++ )
{
vTaskResume( xTaskHandles[ taskIndex ] );
}
/* This task must not be switched out for any other higher priority
* ready task because it has disabled preemption for itself. The
* execution of the next line ensures that this task is not switched out
* even though a higher priority ready task is available. This variable
* is checked in the test runner. */
xTestResult = pdPASS;
}
/* Busy looping here to occupy this core. */
for( ; ; )
{
/* Always running, put nop operation here to avoid optimization by compiler. */
TEST_NOP();
}
}
/*-----------------------------------------------------------*/
void Test_DisablePreemption( void )
{
eTaskState taskState;
uint32_t i;
BaseType_t xTaskCreationResult;
/* Create ( configNUMBER_OF_CORES + 1 ) tasks with desending priorities. */
for( i = 0; i < ( configNUMBER_OF_CORES + 1 ); i++ )
{
xTaskCreationResult = xTaskCreate( prvTestPreemptionDisableTask,
"TestPreemptionDisable",
configMINIMAL_STACK_SIZE * 2,
&( xTaskIndexes[ i ] ),
configMAX_PRIORITIES - 2 - i,
&( xTaskHandles[ i ] ) );
TEST_ASSERT_EQUAL_MESSAGE( pdPASS, xTaskCreationResult, "Task creation failed." );
}
/* TEST_TIMEOUT_MS is long enough to run this test. */
vTaskDelay( pdMS_TO_TICKS( TEST_TIMEOUT_MS ) );
/* Verify the lowest priority task runs after resuming all test tasks. */
TEST_ASSERT_EQUAL( pdPASS, xTestResult );
/* Enable preemption of the lowest priority task. The scheduler must switch
* out this task now as there is a higher priority ready task available. */
vTaskPreemptionEnable( xTaskHandles[ configNUMBER_OF_CORES ] );
/* Verify that the lowest priority task is not running anymore. */
taskState = eTaskGetState( xTaskHandles[ configNUMBER_OF_CORES ] );
TEST_ASSERT_EQUAL( eReady, taskState );
}
/*-----------------------------------------------------------*/
/* Runs before every test, put init calls here. */
void setUp( void )
{
uint32_t i;
for( i = 0; i < ( configNUMBER_OF_CORES + 1 ); 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 + 1 ); i++ )
{
if( xTaskHandles[ i ] != NULL )
{
vTaskDelete( xTaskHandles[ i ] );
xTaskHandles[ i ] = NULL;
}
}
}
/*-----------------------------------------------------------*/
/**
* @brief Entry point for test runner to run disable preemption test.
*/
void vRunDisablePreemptionTest( void )
{
UNITY_BEGIN();
RUN_TEST( Test_DisablePreemption );
UNITY_END();
}
/*-----------------------------------------------------------*/

@ -0,0 +1,63 @@
/*
* 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_TASK_PREEMPTION_DISABLE
#undef configUSE_TASK_PREEMPTION_DISABLE
#endif /* ifdef configUSE_TASK_PREEMPTION_DISABLE */
#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_TASK_PREEMPTION_DISABLE 1
#define configUSE_TIME_SLICING 1
#define configUSE_PREEMPTION 1
/*-----------------------------------------------------------*/
/**
* @brief Entry point for test runner to run disable preemption test.
*/
void vRunDisablePreemptionTest( void );
/*-----------------------------------------------------------*/
#endif /* ifndef TEST_CONFIG_H */

@ -0,0 +1,231 @@
/*
* 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_affinity.c
* @brief The scheduler shall not schedule a task that is pinned to a specific core on any other core.
*
* Procedure:
* - Create 2 * ( num of cores ) tasks ( T0, ..., Tn-1, Tn, ..., T2n-1 ).
* - Pin T0 to core 0, T1 to core 1, and so on.
* - Pin Tn to core 0, Tn+1 to core 1, and so on. Note that this way Tx and
* Tn+x are pinned to the same core.
* - Verify the following conditions:
* - Tx+n is not running when Tx is running.
* - Tx is not running when Tx+n is running.
* - Both Tx and Tx+n can only run on core x.
* Expected:
* - All tasks will only run on the cores that they were pinned to.
*/
/* Standard includes. */
#include <stdint.h>
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Unit testing support functions. */
#include "unity.h"
/*-----------------------------------------------------------*/
/**
* @brief Timeout value to stop test.
*/
#define TEST_TIMEOUT_MS ( 1000 )
/*-----------------------------------------------------------*/
#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 <= ( configNUMBER_OF_CORES + 2 ) )
#error configMAX_PRIORITIES must be larger than ( configNUMBER_OF_CORES + 2 ) to avoid scheduling idle tasks unexpectedly.
#endif /* if ( configMAX_PRIORITIES <= ( configNUMBER_OF_CORES + 2 ) ) */
/*-----------------------------------------------------------*/
/**
* @brief Test case "Schedule Affinity".
*/
void Test_ScheduleAffinity( void );
/**
* @brief The task function that verifies that tasks are pinned to correct core.
*/
static void prvTaskCheckPinCore( void * pvParameters );
/*-----------------------------------------------------------*/
/**
* @brief Handles of the tasks created in this test.
*/
static TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES * 2 ];
/**
* @brief Indexes of the tasks created in this test.
*/
static uint32_t xTaskIndexes[ configNUMBER_OF_CORES * 2 ];
/**
* @brief Test results for tasks T0~T2n-1.
*/
static BaseType_t xTestResults[ configNUMBER_OF_CORES * 2 ] = { pdFAIL };
/**
* @brief Flag to indicate that all tasks in this test are created.
*/
static volatile BaseType_t xAllTasksCreated = pdFALSE;
/*-----------------------------------------------------------*/
static void prvTaskCheckPinCore( void * pvParameters )
{
uint32_t currentTaskIdx = *( ( uint32_t * ) pvParameters );
uint32_t pinToSameCoreTaskIdx;
eTaskState taskState;
BaseType_t testResult = pdPASS;
BaseType_t xCore;
/* Busy looping here to wait for test runner to create all the test tasks.
* Test runner has timeout to prevent infinite blocking here. */
while( xAllTasksCreated == pdFALSE )
{
}
/* Find out the task index which is pinned to the same core. */
if( currentTaskIdx >= configNUMBER_OF_CORES )
{
pinToSameCoreTaskIdx = currentTaskIdx - configNUMBER_OF_CORES;
xCore = pinToSameCoreTaskIdx;
}
else
{
pinToSameCoreTaskIdx = currentTaskIdx + configNUMBER_OF_CORES;
xCore = currentTaskIdx;
}
/* Verify that the task is running on the core it is pinned to. */
taskState = eTaskGetState( xTaskHandles[ currentTaskIdx ] );
if( taskState != eRunning )
{
testResult = pdFAIL;
}
if( xCore != portGET_CORE_ID() )
{
testResult = pdFAIL;
}
/* Verify that the other task pinned to the same core is not running. */
taskState = eTaskGetState( xTaskHandles[ pinToSameCoreTaskIdx ] );
if( taskState == eRunning )
{
testResult = pdFAIL;
}
xTestResults[ currentTaskIdx ] = testResult;
/* Suspend the test task. */
vTaskSuspend( NULL );
}
/*-----------------------------------------------------------*/
void Test_ScheduleAffinity( void )
{
uint32_t i;
BaseType_t xTaskCreationResult;
/* Create ( configNUMBER_OF_CORES * 2 ) low priority tasks. */
for( i = 0; i < ( configNUMBER_OF_CORES * 2 ); i++ )
{
xTaskCreationResult = xTaskCreateAffinitySet( prvTaskCheckPinCore,
"CheckPinCore",
configMINIMAL_STACK_SIZE,
&( xTaskIndexes[ i ] ),
configMAX_PRIORITIES - 2 - ( i % configNUMBER_OF_CORES ),
( 1U << ( i % configNUMBER_OF_CORES ) ),
&( xTaskHandles[ i ] ) );
TEST_ASSERT_EQUAL_MESSAGE( pdPASS, xTaskCreationResult, "Task creation failed." );
}
/* Wait for test tasks finish test. */
xAllTasksCreated = pdTRUE;
vTaskDelay( pdMS_TO_TICKS( TEST_TIMEOUT_MS ) );
/* Verify the test result. */
for( i = 0; i < ( configNUMBER_OF_CORES * 2 ); i++ )
{
TEST_ASSERT_TRUE( xTestResults[ i ] == pdPASS );
}
}
/*-----------------------------------------------------------*/
/* Runs before every test, put init calls here. */
void setUp( void )
{
uint32_t i;
xAllTasksCreated = pdFALSE;
for( i = 0; i < ( configNUMBER_OF_CORES * 2 ); i++ )
{
xTaskIndexes[ i ] = i;
xTaskHandles[ i ] = NULL;
xTestResults[ i ] = pdFAIL;
}
}
/*-----------------------------------------------------------*/
/* Runs after every test, put clean-up calls here. */
void tearDown( void )
{
uint32_t i;
/* Delete all the tasks created in the test. */
for( i = 0; i < ( configNUMBER_OF_CORES * 2 ); i++ )
{
if( xTaskHandles[ i ] != NULL )
{
vTaskDelete( xTaskHandles[ i ] );
xTaskHandles[ i ] = NULL;
}
}
}
/*-----------------------------------------------------------*/
/**
* @brief Entry point for test runner to run schedule affinity test.
*/
void vRunScheduleAffinityTest( void )
{
UNITY_BEGIN();
RUN_TEST( Test_ScheduleAffinity );
UNITY_END();
}
/*-----------------------------------------------------------*/

@ -0,0 +1,63 @@
/*
* 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_CORE_AFFINITY
#undef configUSE_CORE_AFFINITY
#endif /* ifdef configUSE_CORE_AFFINITY */
#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_CORE_AFFINITY 1
#define configUSE_TIME_SLICING 1
#define configUSE_PREEMPTION 1
/*-----------------------------------------------------------*/
/**
* @brief Entry point for test runner to run schedule affinity test.
*/
void vRunScheduleAffinityTest( void );
/*-----------------------------------------------------------*/
#endif /* ifndef TEST_CONFIG_H */

@ -0,0 +1,220 @@
/*
* 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_highest_priority.c
* @brief The scheduler shall correctly schedule the highest priority ready tasks.
*
* Procedure:
* - Create ( num of cores ) tasks ( T0~Tn-1 ). Priority T0 > T1 > ... > Tn-2 > Tn-1.
* - for each task Ti in [T0..Tn-1]:
* - Tasks T0..Ti-1 are running. If any of the task in T0..Ti-1 is not
* running notify the test runner task about error.
* - If i == n -1:
* - Notify test runner task about success.
* Expected:
* - When a task runs, all tasks of higher priority are running.
*/
/* Standard includes. */
#include <stdint.h>
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Unit testing support functions. */
#include "unity.h"
/*-----------------------------------------------------------*/
#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 <= configNUMBER_OF_CORES )
#error This test creates tasks with different priority, requires configMAX_PRIORITIES to be larger than configNUMBER_OF_CORES.
#endif /* #if ( configMAX_PRIORITIES <= configNUMBER_OF_CORES ) */
/*-----------------------------------------------------------*/
/**
* @brief Timeout value to stop test.
*/
#define TEST_TIMEOUT_MS ( 10000U )
/**
* @brief Nop operation for busy looping.
*/
#ifdef portNOP
#define TEST_NOP portNOP
#else
#define TEST_NOP() __asm volatile ( "nop" )
#endif
/*-----------------------------------------------------------*/
/**
* @brief Function that implements a never blocking FreeRTOS task.
*/
static void prvEverRunningTask( void * pvParameters );
/*-----------------------------------------------------------*/
/**
* @brief Handle of the test runner task.
*/
static TaskHandle_t xTestRunnerTaskHandle;
/**
* @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 Ever running task function.
*
* Test runner task is notified with the following values:
* - A value between 0 and ( configNUMBER_OF_CORES -1 ) : Task with the index
* equal to value encountered an error during the test.
* - configNUMBER_OF_CORES : The test finished without any error.
*/
static void prvEverRunningTask( void * pvParameters )
{
uint32_t i;
uint32_t uxCurrentTaskIdx = *( ( uint32_t * ) pvParameters );
eTaskState xTaskState;
/* Tasks with index smaller than the current task are of higher priority and
* must be running when this task is running. */
for( i = 0; i < uxCurrentTaskIdx; i++ )
{
xTaskState = eTaskGetState( xTaskHandles[ i ] );
if( eRunning != xTaskState )
{
/* Notify the test runner task about the error. */
( void ) xTaskNotify( xTestRunnerTaskHandle, uxCurrentTaskIdx, eSetValueWithoutOverwrite );
}
}
/* If current task is the last task, then we finish the check because all
* tasks are checked. */
if( uxCurrentTaskIdx == ( configNUMBER_OF_CORES - 1 ) )
{
/* Notify the test runner task about success. */
( void ) xTaskNotify( xTestRunnerTaskHandle, configNUMBER_OF_CORES, eSetValueWithoutOverwrite );
}
for( ; ; )
{
/* Busy looping in this task. */
TEST_NOP();
}
}
/*-----------------------------------------------------------*/
/**
* @brief Test running task.
*
* It waits for a notification from one of the ever running tasks.
*/
void Test_ScheduleHighestPriority( void )
{
uint32_t ulNotifiedValue;
BaseType_t xReturn;
xReturn = xTaskNotifyWait( 0U, ULONG_MAX, &ulNotifiedValue, pdMS_TO_TICKS( TEST_TIMEOUT_MS ) );
/* Test runner task is notified within TEST_TIMEOUT_MS. */
TEST_ASSERT_EQUAL( pdTRUE, xReturn );
/* The notified value indicates that no error occurred during the test. */
TEST_ASSERT_EQUAL_INT( configNUMBER_OF_CORES, ulNotifiedValue );
}
/*-----------------------------------------------------------*/
/**
* @brief Runs before every test, put init calls here.
*/
void setUp( void )
{
uint32_t i;
BaseType_t xTaskCreationResult;
/* Save the test runner task handle here. It is used to notify test runner
* from ever running tasks. */
xTestRunnerTaskHandle = xTaskGetCurrentTaskHandle();
/* Create configNUMBER_OF_CORES tasks with decending priority. */
for( i = 0; i < configNUMBER_OF_CORES; i++ )
{
xTaskIndexes[ i ] = i;
xTaskCreationResult = xTaskCreate( prvEverRunningTask,
"EverRun",
configMINIMAL_STACK_SIZE * 2,
&( xTaskIndexes[ i ] ),
configMAX_PRIORITIES - 1 - i,
&( xTaskHandles[ i ] ) );
TEST_ASSERT_EQUAL_MESSAGE( pdPASS, xTaskCreationResult, "Task creation failed." );
}
}
/*-----------------------------------------------------------*/
/**
* @brief 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 ] );
}
}
}
/*-----------------------------------------------------------*/
/**
* @brief Entry point for test runner to run highest priority test.
*/
void vRunScheduleHighestPriorityTest( void )
{
UNITY_BEGIN();
RUN_TEST( Test_ScheduleHighestPriority );
UNITY_END();
}
/*-----------------------------------------------------------*/

@ -0,0 +1,63 @@
/*
* 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 */
#ifdef configUSE_TASK_NOTIFICATIONS
#undef configUSE_TASK_NOTIFICATIONS
#endif /* #ifdef configUSE_TASK_NOTIFICATIONS */
#define configRUN_MULTIPLE_PRIORITIES 1
#define configUSE_TIME_SLICING 1
#define configUSE_PREEMPTION 1
#define configUSE_TASK_NOTIFICATIONS 1
/*-----------------------------------------------------------*/
/**
* @brief Entry point for test runner to run highest priority test.
*/
void vRunScheduleHighestPriorityTest( void );
/*-----------------------------------------------------------*/
#endif /* ifndef TEST_CONFIG_H */

@ -5,14 +5,14 @@ license: "MIT"
dependencies:
- name: "FreeRTOS-Kernel"
version: "7284d84dc"
version: "30f6061f4"
repository:
type: "git"
url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git"
path: "FreeRTOS/Source"
- name: "FreeRTOS-Plus-TCP"
version: "V4.0.0"
version: "V4.1.0"
repository:
type: "git"
url: "https://github.com/FreeRTOS/FreeRTOS-Plus-TCP.git"

Loading…
Cancel
Save