From 3d236bd83d3b218c10e5153df64c1d24e4247c17 Mon Sep 17 00:00:00 2001 From: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Tue, 30 Jan 2024 10:44:47 +0530 Subject: [PATCH] Add x64 configuration to Win32-MSVC demo (#1164) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add x64 configuration to Win32-MSVC demo. This was originally contributed in this PR - #1139 --------- Signed-off-by: Gaurav Aggarwal Co-authored-by: José Simões Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> --- .github/workflows/freertos_demos.yml | 36 ++++++++--- .../FreeRTOSConfig.h | 21 ++++--- .../Demo/FreeRTOS_Plus_TCP_Echo_Posix/main.c | 60 +------------------ FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h | 2 +- FreeRTOS/Demo/WIN32-MSVC/WIN32.sln | 7 ++- FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj | 25 ++++---- .../Demo/WIN32-MSVC/WIN32.vcxproj.filters | 3 + FreeRTOS/Demo/WIN32-MSVC/main.c | 19 +++--- FreeRTOS/Source | 2 +- manifest.yml | 2 +- 10 files changed, 76 insertions(+), 101 deletions(-) diff --git a/.github/workflows/freertos_demos.yml b/.github/workflows/freertos_demos.yml index ad610251b3..0a21b618c2 100644 --- a/.github/workflows/freertos_demos.yml +++ b/.github/workflows/freertos_demos.yml @@ -24,7 +24,7 @@ jobs: stepName: Checkout Repository name: ${{ env.stepName }} uses: actions/checkout@v3 - + - env: stepName: Fetch Required Submodule name: ${{ env.stepName }} @@ -62,7 +62,8 @@ jobs: $content = Get-Content -Path 'main.c' -Raw $newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );' $newContent | Set-Content -Path 'main.c' - msbuild WIN32.sln -t:rebuild + msbuild WIN32.sln /p:Platform=Win32 -t:rebuild + msbuild WIN32.sln /p:Platform=x64 -t:rebuild $exitStatus = $? echo "::endgroup::" if($exitStatus -eq 1) { @@ -73,11 +74,21 @@ jobs: } - env: - stepName: Run and monitor WIN32-MSVC Full Demo + stepName: Run and monitor WIN32-MSVC Full Demo - Win32 + name: ${{ env.stepName }} + uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main + with: + exe-path: FreeRTOS/Demo/WIN32-MSVC/Win32/Debug/RTOSDemo.exe + timeout-seconds: 60 + success-line: "No errors - tick count" + retry-attempts: 3 + + - env: + stepName: Run and monitor WIN32-MSVC Full Demo - x64 name: ${{ env.stepName }} uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main with: - exe-path: FreeRTOS/Demo/WIN32-MSVC/Debug/RTOSDemo.exe + exe-path: FreeRTOS/Demo/WIN32-MSVC/x64/Debug/RTOSDemo.exe timeout-seconds: 60 success-line: "No errors - tick count" retry-attempts: 3 @@ -93,7 +104,8 @@ jobs: $content = Get-Content -Path 'main.c' -Raw $newContent = $content -replace '#define\s+mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\s+0', '#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1' $newContent | Set-Content -Path 'main.c' - msbuild WIN32.sln -t:rebuild + msbuild WIN32.sln /p:Platform=Win32 -t:rebuild + msbuild WIN32.sln /p:Platform=x64 -t:rebuild echo "::endgroup::" $exitStatus = $? if($exitStatus -eq 1) { @@ -104,11 +116,21 @@ jobs: } - env: - stepName: Run and monitor WIN32-MSVC Blinky Demo + stepName: Run and monitor WIN32-MSVC Blinky Demo - Win32 + name: ${{ env.stepName }} + uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main + with: + exe-path: FreeRTOS/Demo/WIN32-MSVC/Win32/Debug/RTOSDemo.exe + timeout-seconds: 60 + success-line: "Message received from software timer" + retry-attempts: 3 + + - env: + stepName: Run and monitor WIN32-MSVC Blinky Demo - x64 name: ${{ env.stepName }} uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main with: - exe-path: FreeRTOS/Demo/WIN32-MSVC/Debug/RTOSDemo.exe + exe-path: FreeRTOS/Demo/WIN32-MSVC/x64/Debug/RTOSDemo.exe timeout-seconds: 60 success-line: "Message received from software timer" retry-attempts: 3 diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSConfig.h index 7ec703eb81..0cf89d6ffc 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSConfig.h +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSConfig.h @@ -205,19 +205,22 @@ extern void vAssertCalled( const char * const pcFileName, * 208.67.220.220. Used in ipconfigUSE_DNS is set to 0, or ipconfigUSE_DNS is set * to 1 but a DNS server cannot be contacted.*/ -#define configDNS_SERVER_ADDR0 10 -#define configDNS_SERVER_ADDR1 4 -#define configDNS_SERVER_ADDR2 4 -#define configDNS_SERVER_ADDR3 10 +#define configDNS_SERVER_ADDR0 10 +#define configDNS_SERVER_ADDR1 4 +#define configDNS_SERVER_ADDR2 4 +#define configDNS_SERVER_ADDR3 10 /* Default netmask configuration. Used in ipconfigUSE_DNS is set to 0, or * ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */ -#define configNET_MASK0 255 -#define configNET_MASK1 255 -#define configNET_MASK2 240 -#define configNET_MASK3 0 +#define configNET_MASK0 255 +#define configNET_MASK1 255 +#define configNET_MASK2 240 +#define configNET_MASK3 0 /* The UDP port to which print messages are sent. */ -#define configPRINT_PORT ( 15000 ) +#define configPRINT_PORT ( 15000 ) + +/* Use kernel provided static memory for timer and idle tasks. */ +#define configKERNEL_PROVIDED_STATIC_MEMORY 1 #endif /* FREERTOS_CONFIG_H */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main.c index 66efef40fd..ebaa23fd83 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main.c @@ -83,12 +83,6 @@ void vApplicationIdleHook( void ); void vApplicationStackOverflowHook( TaskHandle_t pxTask, char * pcTaskName ); void vApplicationTickHook( void ); -void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, - StackType_t ** ppxIdleTaskStackBuffer, - uint32_t * pulIdleTaskStackSize ); -void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, - StackType_t ** ppxTimerTaskStackBuffer, - uint32_t * pulTimerTaskStackSize ); /* * Writes trace data to a disk file when the trace recording is stopped. @@ -322,58 +316,6 @@ static void prvSaveTraceFile( void ) } /*-----------------------------------------------------------*/ -/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an - * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is - * used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, - StackType_t ** ppxIdleTaskStackBuffer, - uint32_t * pulIdleTaskStackSize ) -{ -/* If the buffers to be provided to the Idle task are declared inside this - * function then they must be declared static - otherwise they will be allocated on - * the stack and so not exists after this function exits. */ - static StaticTask_t xIdleTaskTCB; - static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - * state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - * Note that, as the array is necessarily of type StackType_t, - * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; -} -/*-----------------------------------------------------------*/ - -/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the - * application must provide an implementation of vApplicationGetTimerTaskMemory() - * to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, - StackType_t ** ppxTimerTaskStackBuffer, - uint32_t * pulTimerTaskStackSize ) -{ -/* If the buffers to be provided to the Timer task are declared inside this - * function then they must be declared static - otherwise they will be allocated on - * the stack and so not exists after this function exits. */ - static StaticTask_t xTimerTaskTCB; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - * task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - * Note that, as the array is necessarily of type StackType_t, - * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; -} - static uint32_t ulEntryTime = 0U; void vTraceTimerReset( void ) @@ -390,3 +332,5 @@ uint32_t uiTraceTimerGetValue( void ) { return( xTaskGetTickCount() - ulEntryTime ); } + +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h b/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h index 40ec37e684..c8d6b31f1b 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h @@ -46,7 +46,7 @@ #define configUSE_DAEMON_TASK_STARTUP_HOOK 1 #define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */ #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */ -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 49 * 1024 ) ) /* This demo tests heap_5 so places multiple blocks within this total heap size. See mainREGION_1_SIZE to mainREGION_3_SIZE definitions in main.c. */ +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 490 * 1024 ) ) /* This demo tests heap_5 so places multiple blocks within this total heap size. See mainREGION_1_SIZE to mainREGION_3_SIZE definitions in main.c. */ #define configMAX_TASK_NAME_LEN ( 12 ) #define configUSE_TRACE_FACILITY 1 #define configUSE_16_BIT_TICKS 0 diff --git a/FreeRTOS/Demo/WIN32-MSVC/WIN32.sln b/FreeRTOS/Demo/WIN32-MSVC/WIN32.sln index 8dda0ce1a4..28f6d4e261 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/WIN32.sln +++ b/FreeRTOS/Demo/WIN32-MSVC/WIN32.sln @@ -1,16 +1,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.34114.132 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.ActiveCfg = Debug|Win32 {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.Build.0 = Debug|Win32 + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|x64.ActiveCfg = Debug|x64 + {C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|x64.Build.0 = Debug|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj b/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj index 0ef5e555ac..50fe3c9f94 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj +++ b/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj @@ -5,17 +5,22 @@ Debug Win32 + + Debug + x64 + {C686325E-3261-42F7-AEB1-DDE5280E1CEB} RTOSDemo + 10.0 - + Application false MultiByte - v142 + v143 @@ -27,8 +32,8 @@ <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ true @@ -43,10 +48,6 @@ WIN32;WIN32_LEAN_AND_MEAN;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0601;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug - .\Debug/WIN32.pch - .\Debug/ - .\Debug/ - .\Debug/ Level4 true EditAndContinue @@ -59,10 +60,9 @@ 0x0c09 - .\Debug/RTOSDemo.exe + $(OutDir)$(TargetName)$(TargetExt) true true - .\Debug/WIN32.pdb Console MachineX86 %(AdditionalDependencies) @@ -73,6 +73,11 @@ .\Debug/WIN32.bsc + + + ..\..\Source\include;..\..\Source\portable\MSVC-MingW;..\Common\Include;..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-Trace\kernelports\FreeRTOS;..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-Trace\kernelports\FreeRTOS\include;..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-Trace\include;.\Trace_Recorder_Configuration;.;%(AdditionalIncludeDirectories) + + diff --git a/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj.filters b/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj.filters index 7049d309c3..64a87bb798 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj.filters +++ b/FreeRTOS/Demo/WIN32-MSVC/WIN32.vcxproj.filters @@ -225,6 +225,9 @@ Demo App Source\FreeRTOS+Trace Recorder\include + + Configuration Files + diff --git a/FreeRTOS/Demo/WIN32-MSVC/main.c b/FreeRTOS/Demo/WIN32-MSVC/main.c index 639102a701..51ee484cfa 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/main.c +++ b/FreeRTOS/Demo/WIN32-MSVC/main.c @@ -86,9 +86,9 @@ * as this demo could easily create one large heap region instead of multiple * smaller heap regions - in which case heap_4.c would be the more appropriate * choice. See http://www.freertos.org/a00111.html for an explanation. */ -#define mainREGION_1_SIZE 8201 -#define mainREGION_2_SIZE 23905 -#define mainREGION_3_SIZE 16807 +#define mainREGION_1_SIZE 82010 +#define mainREGION_2_SIZE 239050 +#define mainREGION_3_SIZE 168070 /* This demo allows for users to perform actions with the keyboard. */ #define mainNO_KEY_PRESS_VALUE -1 @@ -149,7 +149,7 @@ static void prvSaveTraceFile( void ); * FreeRTOS simulator. This thread passes data safely into the FreeRTOS * simulator using a stream buffer. */ -static DWORD WINAPI prvWindowsKeyboardInputThread( void * pvParam ); +static int32_t WINAPI prvWindowsKeyboardInputThread( void * pvParam ); /* * Interrupt handler for when keyboard input is received. @@ -349,12 +349,7 @@ void vAssertCalled( unsigned long ulLine, * value. */ while( ulSetToNonZeroInDebuggerToContinue == 0 ) { - __asm { - NOP - }; - __asm { - NOP - }; + __nop(); } /* Re-enable the trace recording. */ @@ -422,7 +417,7 @@ static void prvInitialiseHeap( void ) * used by the Idle task. */ void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, - uint32_t * pulIdleTaskStackSize ) + configSTACK_DEPTH_TYPE * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this * function then they must be declared static - otherwise they will be allocated on @@ -514,7 +509,7 @@ static uint32_t prvKeyboardInterruptHandler( void ) * FreeRTOS simulator. This thread passes data into the simulator using * an integer. */ -static DWORD WINAPI prvWindowsKeyboardInputThread( void * pvParam ) +static int32_t WINAPI prvWindowsKeyboardInputThread( void * pvParam ) { ( void ) pvParam; diff --git a/FreeRTOS/Source b/FreeRTOS/Source index 8e664fc984..14dd5b503a 160000 --- a/FreeRTOS/Source +++ b/FreeRTOS/Source @@ -1 +1 @@ -Subproject commit 8e664fc9844e03cc839074aff933fc9b79842d9c +Subproject commit 14dd5b503afc7d9ed88ee9483d586d88d71d20c0 diff --git a/manifest.yml b/manifest.yml index 72bdc8eb8f..dd64d627c1 100644 --- a/manifest.yml +++ b/manifest.yml @@ -5,7 +5,7 @@ license: "MIT" dependencies: - name: "FreeRTOS-Kernel" - version: "8e664fc98" + version: "14dd5b503" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git"