diff --git a/test/build-combination/CMakeLists.txt b/test/build-combination/CMakeLists.txt index 170e0c287..c69507330 100644 --- a/test/build-combination/CMakeLists.txt +++ b/test/build-combination/CMakeLists.txt @@ -41,29 +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/MSVC-MingW ) -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") -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 ) + ${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/FreeRTOSConfig.h b/test/build-combination/Common/FreeRTOSConfig.h index 22c8d8b3c..7d5de97dc 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. */ @@ -76,41 +76,34 @@ /* 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 ) +#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 @@ -119,7 +112,7 @@ void vConfigureTimerForRunTimeStats( void ); * 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, diff --git a/test/build-combination/Common/main.c b/test/build-combination/Common/main.c index 1abbf5485..a60035f54 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" @@ -43,8 +41,6 @@ #define mainHOST_NAME "Build Combination" -volatile BaseType_t xInsideInterrupt = pdFALSE; - /*-----------------------------------------------------------*/ /* Notes if the trace is running or not. */ @@ -239,33 +235,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. */ -} -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 ) @@ -293,32 +262,6 @@ extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress, return uxRand(); } - -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. */ -} - -void vPortDeleteThread( void * pvThreadToDelete ) -{ - /* Provide a stub for this function. */ -} - void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t * pulTimerTaskStackSize ) @@ -335,11 +278,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 ) ) @@ -347,6 +292,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 6a98fc9e1..000000000 --- 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 6a98fc9e1..000000000 --- a/test/build-combination/Common/windows.h +++ /dev/null @@ -1 +0,0 @@ -/*Nothing to see here.*/ diff --git a/test/build-combination/README.md b/test/build-combination/README.md new file mode 100644 index 000000000..0bbcba87d --- /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`.