From 47505393179adcb12296c36fb9809549c7f933f5 Mon Sep 17 00:00:00 2001 From: Monika Singh Date: Thu, 1 Sep 2022 10:19:23 +0530 Subject: [PATCH 1/7] Fix Mac compilation error --- test/build-combination/CMakeLists.txt | 4 +-- .../build-combination/Common/FreeRTOSConfig.h | 2 +- test/build-combination/Common/main.c | 27 ------------------- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/test/build-combination/CMakeLists.txt b/test/build-combination/CMakeLists.txt index 170e0c2875..db62887071 100644 --- a/test/build-combination/CMakeLists.txt +++ b/test/build-combination/CMakeLists.txt @@ -41,7 +41,7 @@ set( TEST_DIR ${MODULE_ROOT_DIR}/test/build-combination ) include_directories( ${MODULE_ROOT_DIR}/source/include ) include_directories( ${MODULE_ROOT_DIR}/source/portable/Compiler/MSVC ) include_directories( ${FREERTOS_KERNEL_DIR}/include ) -include_directories( ${FREERTOS_KERNEL_DIR}/portable/MSVC-MingW ) +include_directories( ${FREERTOS_KERNEL_DIR}/portable/ThirdParty/GCC/Posix ) include_directories( ${FREERTOS_KERNEL_DIR}/portable/MemMang ) include_directories( ${TEST_DIR}/Common ) @@ -55,7 +55,7 @@ endif() -file(GLOB KERNEL_SOURCES "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/*.c") +file(GLOB KERNEL_SOURCES "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/*.c" "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix/*.c" "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix/utils/*.c") file(GLOB TCP_SOURCES "${MODULE_ROOT_DIR}/source/*.c" ) diff --git a/test/build-combination/Common/FreeRTOSConfig.h b/test/build-combination/Common/FreeRTOSConfig.h index 22c8d8b3c9..e869d5209f 100644 --- a/test/build-combination/Common/FreeRTOSConfig.h +++ b/test/build-combination/Common/FreeRTOSConfig.h @@ -42,7 +42,7 @@ *----------------------------------------------------------*/ #define configENABLE_BACKWARD_COMPATIBILITY 1 #define configUSE_PREEMPTION 1 -#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configMAX_PRIORITIES ( 7 ) #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 ) 60 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the Win32 thread. */ diff --git a/test/build-combination/Common/main.c b/test/build-combination/Common/main.c index 1abbf54853..13e7029a40 100644 --- a/test/build-combination/Common/main.c +++ b/test/build-combination/Common/main.c @@ -239,23 +239,6 @@ BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber ) return pdTRUE; } -void vPortEnterCritical( void ) -{ - /* Provide a stub for this function. */ -} - -void vPortExitCritical( void ) -{ - /* Provide a stub for this function. */ -} - -StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, - TaskFunction_t pxCode, - void * pvParameters ) -{ - /* Provide a stub for this function. */ -} - void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber ) { /* Provide a stub for this function. */ @@ -299,16 +282,6 @@ void vConfigureTimerForRunTimeStats( void ) /* Provide a stub for this function. */ } -BaseType_t xPortStartScheduler( void ) -{ - /* Provide a stub for this function. */ -} - -void vPortEndScheduler( void ) -{ - /* Provide a stub for this function. */ -} - unsigned long ulGetRunTimeCounterValue( void ) { /* Provide a stub for this function. */ From 6a94be4d96c590daad2aba911c2ca710d862d2ac Mon Sep 17 00:00:00 2001 From: Gaurav Aggarwal Date: Thu, 15 Sep 2022 08:07:10 +0000 Subject: [PATCH 2/7] Fix build failures Signed-off-by: Gaurav Aggarwal --- test/build-combination/CMakeLists.txt | 4 ++++ test/build-combination/Common/FreeRTOSConfig.h | 7 ------- test/build-combination/Common/main.c | 11 ----------- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/test/build-combination/CMakeLists.txt b/test/build-combination/CMakeLists.txt index db62887071..2ef6ad8bb4 100644 --- a/test/build-combination/CMakeLists.txt +++ b/test/build-combination/CMakeLists.txt @@ -67,3 +67,7 @@ add_executable(project ${KERNEL_SOURCES} ${FREERTOS_KERNEL_DIR}/portable/MemMang/heap_4.c ${MODULE_ROOT_DIR}/source/portable/BufferManagement/BufferAllocation_2.c ${TEST_DIR}/Common/main.c ) + +# Link pthread which is needed for POSIX port. +find_package(Threads REQUIRED) +target_link_libraries(project Threads::Threads) diff --git a/test/build-combination/Common/FreeRTOSConfig.h b/test/build-combination/Common/FreeRTOSConfig.h index e869d5209f..109902c8d5 100644 --- a/test/build-combination/Common/FreeRTOSConfig.h +++ b/test/build-combination/Common/FreeRTOSConfig.h @@ -76,13 +76,6 @@ /* Event group related definitions. */ #define configUSE_EVENT_GROUPS 1 -/* Run time stats gathering definitions. */ -unsigned long ulGetRunTimeCounterValue( void ); -void vConfigureTimerForRunTimeStats( void ); -#define configGENERATE_RUN_TIME_STATS 1 -#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats() -#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeCounterValue() - /* Co-routine definitions. */ #define configUSE_CO_ROUTINES 0 #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) diff --git a/test/build-combination/Common/main.c b/test/build-combination/Common/main.c index 13e7029a40..421e35407a 100644 --- a/test/build-combination/Common/main.c +++ b/test/build-combination/Common/main.c @@ -276,17 +276,6 @@ extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress, return uxRand(); } - -void vConfigureTimerForRunTimeStats( void ) -{ - /* Provide a stub for this function. */ -} - -unsigned long ulGetRunTimeCounterValue( void ) -{ - /* Provide a stub for this function. */ -} - void vPortDeleteThread( void * pvThreadToDelete ) { /* Provide a stub for this function. */ From af51c85eea4d326a97fcbdcd257cec11b865f3a7 Mon Sep 17 00:00:00 2001 From: Monika Singh Date: Fri, 16 Sep 2022 10:42:33 +0530 Subject: [PATCH 3/7] update --- test/build-combination/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/build-combination/CMakeLists.txt b/test/build-combination/CMakeLists.txt index 2ef6ad8bb4..1aaf0ea63b 100644 --- a/test/build-combination/CMakeLists.txt +++ b/test/build-combination/CMakeLists.txt @@ -69,5 +69,5 @@ add_executable(project ${KERNEL_SOURCES} ${TEST_DIR}/Common/main.c ) # Link pthread which is needed for POSIX port. -find_package(Threads REQUIRED) -target_link_libraries(project Threads::Threads) +find_package( Threads REQUIRED ) +target_link_libraries( project Threads::Threads ) From ebc21e17882b370f98b75fa99e2afb2cb869d214 Mon Sep 17 00:00:00 2001 From: Gaurav Aggarwal Date: Fri, 16 Sep 2022 06:47:39 +0000 Subject: [PATCH 4/7] Fix formatting check Signed-off-by: Gaurav Aggarwal --- .../build-combination/Common/FreeRTOSConfig.h | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/test/build-combination/Common/FreeRTOSConfig.h b/test/build-combination/Common/FreeRTOSConfig.h index 109902c8d5..7d5de97dc4 100644 --- a/test/build-combination/Common/FreeRTOSConfig.h +++ b/test/build-combination/Common/FreeRTOSConfig.h @@ -77,33 +77,33 @@ #define configUSE_EVENT_GROUPS 1 /* Co-routine definitions. */ -#define configUSE_CO_ROUTINES 0 -#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) /* Currently the TCP/IP stack is using dynamic allocation, and the MQTT task is * using static allocation. */ -#define configSUPPORT_DYNAMIC_ALLOCATION 1 -#define configSUPPORT_STATIC_ALLOCATION 1 +#define configSUPPORT_DYNAMIC_ALLOCATION 1 +#define configSUPPORT_STATIC_ALLOCATION 1 /* Set the following definitions to 1 to include the API function, or zero * to exclude the API function. */ -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskCleanUpResources 0 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_uxTaskGetStackHighWaterMark 1 -#define INCLUDE_xTaskGetSchedulerState 1 -#define INCLUDE_xTimerGetTimerTaskHandle 0 -#define INCLUDE_xTaskGetIdleTaskHandle 0 -#define INCLUDE_xQueueGetMutexHolder 1 -#define INCLUDE_eTaskGetState 1 -#define INCLUDE_xEventGroupSetBitsFromISR 1 -#define INCLUDE_xTimerPendFunctionCall 1 -#define INCLUDE_xTaskGetCurrentTaskHandle 1 -#define INCLUDE_xTaskAbortDelay 1 +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 0 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xTimerGetTimerTaskHandle 0 +#define INCLUDE_xTaskGetIdleTaskHandle 0 +#define INCLUDE_xQueueGetMutexHolder 1 +#define INCLUDE_eTaskGetState 1 +#define INCLUDE_xEventGroupSetBitsFromISR 1 +#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_xTaskAbortDelay 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 @@ -112,7 +112,7 @@ * is set to 2 so the formatting functions are included without the stdio.h being * included in tasks.c. That is because this project defines its own sprintf() * functions. */ -#define configUSE_STATS_FORMATTING_FUNCTIONS 1 +#define configUSE_STATS_FORMATTING_FUNCTIONS 1 /* Assert call defined for debug builds. */ void vAssertCalled( const char * pcFile, From 31e2535ee092ee7fd1ee7e8bc1a02bf2db1688e4 Mon Sep 17 00:00:00 2001 From: Gaurav Aggarwal Date: Tue, 20 Sep 2022 18:06:01 +0530 Subject: [PATCH 5/7] Make the test compile on Windows as well Signed-off-by: Gaurav Aggarwal --- test/build-combination/CMakeLists.txt | 50 ++++++++++++++++--------- test/build-combination/Common/main.c | 20 ++-------- test/build-combination/Common/winbase.h | 1 - test/build-combination/Common/windows.h | 1 - 4 files changed, 36 insertions(+), 36 deletions(-) delete mode 100644 test/build-combination/Common/winbase.h delete mode 100644 test/build-combination/Common/windows.h diff --git a/test/build-combination/CMakeLists.txt b/test/build-combination/CMakeLists.txt index 1aaf0ea63b..c695073309 100644 --- a/test/build-combination/CMakeLists.txt +++ b/test/build-combination/CMakeLists.txt @@ -41,33 +41,49 @@ set( TEST_DIR ${MODULE_ROOT_DIR}/test/build-combination ) include_directories( ${MODULE_ROOT_DIR}/source/include ) include_directories( ${MODULE_ROOT_DIR}/source/portable/Compiler/MSVC ) include_directories( ${FREERTOS_KERNEL_DIR}/include ) -include_directories( ${FREERTOS_KERNEL_DIR}/portable/ThirdParty/GCC/Posix ) -include_directories( ${FREERTOS_KERNEL_DIR}/portable/MemMang ) +# Add the correct portable directory to include search paths. +if (WIN32) + include_directories( ${FREERTOS_KERNEL_DIR}/portable/MSVC-MingW ) +else() + include_directories( ${FREERTOS_KERNEL_DIR}/portable/ThirdParty/GCC/Posix ) +endif() include_directories( ${TEST_DIR}/Common ) if( ${TEST_CONFIGURATION} STREQUAL "ENABLE_ALL" ) - include_directories( ${TEST_DIR}/AllEnable ) + include_directories( ${TEST_DIR}/AllEnable ) elseif( ${TEST_CONFIGURATION} STREQUAL "DISABLE_ALL" ) - include_directories( ${TEST_DIR}/AllDisable ) + include_directories( ${TEST_DIR}/AllDisable ) else() - include_directories( ${TEST_DIR}/DefaultConf ) + include_directories( ${TEST_DIR}/DefaultConf ) endif() +# Pick the correct kernel port files for the platform. +if (WIN32) + file(GLOB KERNEL_SOURCES "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/*.c" + "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/MSVC-MingW/*.c") +else() + file(GLOB KERNEL_SOURCES "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/*.c" + "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix/*.c" + "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix/utils/*.c") +endif() - -file(GLOB KERNEL_SOURCES "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/*.c" "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix/*.c" "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix/utils/*.c") -file(GLOB TCP_SOURCES "${MODULE_ROOT_DIR}/source/*.c" - ) +file(GLOB TCP_SOURCES "${MODULE_ROOT_DIR}/source/*.c" ) message(STATUS "${KERNEL_SOURCES}") message(STATUS "${TCP_SOURCES}") add_executable(project ${KERNEL_SOURCES} - ${TCP_SOURCES} - ${FREERTOS_KERNEL_DIR}/portable/MemMang/heap_4.c - ${MODULE_ROOT_DIR}/source/portable/BufferManagement/BufferAllocation_2.c - ${TEST_DIR}/Common/main.c ) - -# Link pthread which is needed for POSIX port. -find_package( Threads REQUIRED ) -target_link_libraries( project Threads::Threads ) + ${TCP_SOURCES} + ${FREERTOS_KERNEL_DIR}/portable/MemMang/heap_4.c + ${MODULE_ROOT_DIR}/source/portable/BufferManagement/BufferAllocation_2.c + ${TEST_DIR}/Common/main.c ) + +if (WIN32) + # Add preprocessor definitions to suppress warnings. + target_compile_definitions( project PRIVATE + _CRT_SECURE_NO_WARNINGS ) +else() + # Link pthread which is needed for POSIX port. + find_package( Threads REQUIRED ) + target_link_libraries( project Threads::Threads ) +endif() diff --git a/test/build-combination/Common/main.c b/test/build-combination/Common/main.c index 421e35407a..6f5eba9fc5 100644 --- a/test/build-combination/Common/main.c +++ b/test/build-combination/Common/main.c @@ -43,8 +43,6 @@ #define mainHOST_NAME "Build Combination" -volatile BaseType_t xInsideInterrupt = pdFALSE; - /*-----------------------------------------------------------*/ /* Notes if the trace is running or not. */ @@ -239,16 +237,6 @@ BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber ) return pdTRUE; } -void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber ) -{ - /* Provide a stub for this function. */ -} -void vPortCloseRunningThread( void * pvTaskToDelete, - volatile BaseType_t * pxPendYield ) -{ - /* Provide a stub for this function. */ -} - void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t * pulIdleTaskStackSize ) @@ -276,11 +264,6 @@ extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress, return uxRand(); } -void vPortDeleteThread( void * pvThreadToDelete ) -{ - /* Provide a stub for this function. */ -} - void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t * pulTimerTaskStackSize ) @@ -297,11 +280,13 @@ BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkB BaseType_t bReleaseAfterSend ) { /* Provide a stub for this function. */ + return pdTRUE; } BaseType_t xNetworkInterfaceInitialise( void ) { /* Provide a stub for this function. */ + return pdTRUE; } #if ( ( ipconfigUSE_TCP == 1 ) && ( ipconfigUSE_DHCP_HOOK != 0 ) ) @@ -309,6 +294,7 @@ BaseType_t xNetworkInterfaceInitialise( void ) uint32_t ulIPAddress ) { /* Provide a stub for this function. */ + return eDHCPContinue; } #endif diff --git a/test/build-combination/Common/winbase.h b/test/build-combination/Common/winbase.h deleted file mode 100644 index 6a98fc9e16..0000000000 --- a/test/build-combination/Common/winbase.h +++ /dev/null @@ -1 +0,0 @@ -/*Nothing to see here.*/ diff --git a/test/build-combination/Common/windows.h b/test/build-combination/Common/windows.h deleted file mode 100644 index 6a98fc9e16..0000000000 --- a/test/build-combination/Common/windows.h +++ /dev/null @@ -1 +0,0 @@ -/*Nothing to see here.*/ From 334adb575a77113de9c7abd8efcb8076b8b7e9bc Mon Sep 17 00:00:00 2001 From: Gaurav Aggarwal Date: Tue, 20 Sep 2022 18:18:32 +0530 Subject: [PATCH 6/7] Add readme for build combination tests Signed-off-by: Gaurav Aggarwal --- test/build-combination/README.md | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 test/build-combination/README.md diff --git a/test/build-combination/README.md b/test/build-combination/README.md new file mode 100644 index 0000000000..0bbcba87d3 --- /dev/null +++ b/test/build-combination/README.md @@ -0,0 +1,51 @@ +# Build Instructions + +This test aims at finding only compilation issues and as a result, the +generated binary is not runnable. + +## UNIX (Linux and Mac) + +All the CMake commands are to be run from the root of the repository. + +* Build checks (Enable all functionalities) +``` +cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=ENABLE_ALL +make -C test/build-combination/build/ +``` + +* Build checks (Disable all functionalities) +``` +cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=DISABLE_ALL +make -C test/build-combination/build/ +``` + +* Build checks (Default configuration) +``` +cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=DEFAULT_CONF +make -C test/build-combination/build/ +``` + +## Windows + +All the CMake commands are to be run from the root of the repository. + +* Build checks (Enable all functionalities) +``` +cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 +``` +Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln` +in Visual Studio and click `Build --> Build Solution`. + +* Build checks (Disable all functionalities) +``` +cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 +``` +Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln` +in Visual Studio and click `Build --> Build Solution`. + +* Build checks (Default configuration) +``` +cmake -S test/build-combination -B test/build-combination/build/ -DTEST_CONFIGURATION=ENABLE_ALL -DCMAKE_GENERATOR_PLATFORM=Win32 +``` +Open the generated Visual Studio Solution file `test\build-combination\build\FreeRTOS-Plus-TCP Build Combination.sln` +in Visual Studio and click `Build --> Build Solution`. From f35230d4725d3813e9629a99e61333f15343529a Mon Sep 17 00:00:00 2001 From: Gaurav Aggarwal Date: Tue, 20 Sep 2022 18:21:24 +0530 Subject: [PATCH 7/7] Remove unnecessary include Signed-off-by: Gaurav Aggarwal --- test/build-combination/Common/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/build-combination/Common/main.c b/test/build-combination/Common/main.c index 6f5eba9fc5..a60035f543 100644 --- a/test/build-combination/Common/main.c +++ b/test/build-combination/Common/main.c @@ -34,8 +34,6 @@ #include #include "task.h" -#include - /* System application includes. */ #include "FreeRTOS_IP.h" #include "FreeRTOS_Sockets.h"