Skip to content

Commit 31e2535

Browse files
committed
Make the test compile on Windows as well
Signed-off-by: Gaurav Aggarwal <[email protected]>
1 parent ebc21e1 commit 31e2535

File tree

4 files changed

+36
-36
lines changed

4 files changed

+36
-36
lines changed

test/build-combination/CMakeLists.txt

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,33 +41,49 @@ set( TEST_DIR ${MODULE_ROOT_DIR}/test/build-combination )
4141
include_directories( ${MODULE_ROOT_DIR}/source/include )
4242
include_directories( ${MODULE_ROOT_DIR}/source/portable/Compiler/MSVC )
4343
include_directories( ${FREERTOS_KERNEL_DIR}/include )
44-
include_directories( ${FREERTOS_KERNEL_DIR}/portable/ThirdParty/GCC/Posix )
45-
include_directories( ${FREERTOS_KERNEL_DIR}/portable/MemMang )
44+
# Add the correct portable directory to include search paths.
45+
if (WIN32)
46+
include_directories( ${FREERTOS_KERNEL_DIR}/portable/MSVC-MingW )
47+
else()
48+
include_directories( ${FREERTOS_KERNEL_DIR}/portable/ThirdParty/GCC/Posix )
49+
endif()
4650
include_directories( ${TEST_DIR}/Common )
4751

4852
if( ${TEST_CONFIGURATION} STREQUAL "ENABLE_ALL" )
49-
include_directories( ${TEST_DIR}/AllEnable )
53+
include_directories( ${TEST_DIR}/AllEnable )
5054
elseif( ${TEST_CONFIGURATION} STREQUAL "DISABLE_ALL" )
51-
include_directories( ${TEST_DIR}/AllDisable )
55+
include_directories( ${TEST_DIR}/AllDisable )
5256
else()
53-
include_directories( ${TEST_DIR}/DefaultConf )
57+
include_directories( ${TEST_DIR}/DefaultConf )
5458
endif()
5559

60+
# Pick the correct kernel port files for the platform.
61+
if (WIN32)
62+
file(GLOB KERNEL_SOURCES "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/*.c"
63+
"${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/MSVC-MingW/*.c")
64+
else()
65+
file(GLOB KERNEL_SOURCES "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/*.c"
66+
"${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix/*.c"
67+
"${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix/utils/*.c")
68+
endif()
5669

57-
58-
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")
59-
file(GLOB TCP_SOURCES "${MODULE_ROOT_DIR}/source/*.c"
60-
)
70+
file(GLOB TCP_SOURCES "${MODULE_ROOT_DIR}/source/*.c" )
6171

6272
message(STATUS "${KERNEL_SOURCES}")
6373
message(STATUS "${TCP_SOURCES}")
6474

6575
add_executable(project ${KERNEL_SOURCES}
66-
${TCP_SOURCES}
67-
${FREERTOS_KERNEL_DIR}/portable/MemMang/heap_4.c
68-
${MODULE_ROOT_DIR}/source/portable/BufferManagement/BufferAllocation_2.c
69-
${TEST_DIR}/Common/main.c )
70-
71-
# Link pthread which is needed for POSIX port.
72-
find_package( Threads REQUIRED )
73-
target_link_libraries( project Threads::Threads )
76+
${TCP_SOURCES}
77+
${FREERTOS_KERNEL_DIR}/portable/MemMang/heap_4.c
78+
${MODULE_ROOT_DIR}/source/portable/BufferManagement/BufferAllocation_2.c
79+
${TEST_DIR}/Common/main.c )
80+
81+
if (WIN32)
82+
# Add preprocessor definitions to suppress warnings.
83+
target_compile_definitions( project PRIVATE
84+
_CRT_SECURE_NO_WARNINGS )
85+
else()
86+
# Link pthread which is needed for POSIX port.
87+
find_package( Threads REQUIRED )
88+
target_link_libraries( project Threads::Threads )
89+
endif()

test/build-combination/Common/main.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343

4444
#define mainHOST_NAME "Build Combination"
4545

46-
volatile BaseType_t xInsideInterrupt = pdFALSE;
47-
4846
/*-----------------------------------------------------------*/
4947

5048
/* Notes if the trace is running or not. */
@@ -239,16 +237,6 @@ BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber )
239237
return pdTRUE;
240238
}
241239

242-
void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber )
243-
{
244-
/* Provide a stub for this function. */
245-
}
246-
void vPortCloseRunningThread( void * pvTaskToDelete,
247-
volatile BaseType_t * pxPendYield )
248-
{
249-
/* Provide a stub for this function. */
250-
}
251-
252240
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
253241
StackType_t ** ppxIdleTaskStackBuffer,
254242
uint32_t * pulIdleTaskStackSize )
@@ -276,11 +264,6 @@ extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
276264
return uxRand();
277265
}
278266

279-
void vPortDeleteThread( void * pvThreadToDelete )
280-
{
281-
/* Provide a stub for this function. */
282-
}
283-
284267
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
285268
StackType_t ** ppxTimerTaskStackBuffer,
286269
uint32_t * pulTimerTaskStackSize )
@@ -297,18 +280,21 @@ BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkB
297280
BaseType_t bReleaseAfterSend )
298281
{
299282
/* Provide a stub for this function. */
283+
return pdTRUE;
300284
}
301285

302286
BaseType_t xNetworkInterfaceInitialise( void )
303287
{
304288
/* Provide a stub for this function. */
289+
return pdTRUE;
305290
}
306291

307292
#if ( ( ipconfigUSE_TCP == 1 ) && ( ipconfigUSE_DHCP_HOOK != 0 ) )
308293
eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase,
309294
uint32_t ulIPAddress )
310295
{
311296
/* Provide a stub for this function. */
297+
return eDHCPContinue;
312298
}
313299
#endif
314300

test/build-combination/Common/winbase.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/build-combination/Common/windows.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)