Skip to content

Commit 6dcce92

Browse files
authored
Improvement for 64bit Windows port (#1011)
* 64bit TickType_t is supported on Windows port.(MSVC and MinGW) Especially it is introduced for 64bit compiler.(x64 platform on MSVC and MinGW-w64) * Unnecessary compiler warning for the cast operation is disabled locally.(MinGW-w64 only) * Modify the condition for ignoring compiler warning for the cast operation. Before modification: Compiler warning was ignored only on MinGW64 After modification: Compiler warning is ignored on MinGW32 and MinGW64 Reason of modification: The cast warning here is unavoidable not only on MinGW64 but also on MinGW32. "__GNUC__" macro is used because MSVC does not recognize this #pragma directive.
1 parent 4732b96 commit 6dcce92

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

portable/MSVC-MingW/port.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,19 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
246246
FALSE, /* Start not signalled. */
247247
NULL ); /* No name. */
248248

249+
250+
#ifdef __GNUC__
251+
/* GCC reports the warning for the cast operation from TaskFunction_t to LPTHREAD_START_ROUTINE. */
252+
/* Disable this warning here by the #pragma option. */
253+
#pragma GCC diagnostic push
254+
#pragma GCC diagnostic ignored "-Wcast-function-type"
255+
#endif
249256
/* Create the thread itself. */
250257
pxThreadState->pvThread = CreateThread( NULL, xStackSize, ( LPTHREAD_START_ROUTINE ) pxCode, pvParameters, CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION, NULL );
258+
#ifdef __GNUC__
259+
#pragma GCC diagnostic pop
260+
#endif
261+
251262
configASSERT( pxThreadState->pvThread ); /* See comment where TerminateThread() is called. */
252263
SetThreadAffinityMask( pxThreadState->pvThread, 0x01 );
253264
SetThreadPriorityBoost( pxThreadState->pvThread, TRUE );

portable/MSVC-MingW/portmacro.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,18 @@ typedef portSTACK_TYPE StackType_t;
7272
typedef uint32_t TickType_t;
7373
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
7474

75-
/* 32/64-bit tick type on a 32/64-bit architecture, so reads of the tick
75+
/* 32-bit tick type on a 32/64-bit architecture, so reads of the tick
7676
* count do not need to be guarded with a critical section. */
7777
#define portTICK_TYPE_IS_ATOMIC 1
78+
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
79+
typedef uint64_t TickType_t;
80+
#define portMAX_DELAY ( TickType_t ) 0xffffffffffffffffULL
81+
82+
#if defined( __x86_64__ ) || defined( _M_X64 )
83+
/* 64-bit tick type on a 64-bit architecture, so reads of the tick
84+
* count do not need to be guarded with a critical section. */
85+
#define portTICK_TYPE_IS_ATOMIC 1
86+
#endif
7887
#else
7988
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
8089
#endif

0 commit comments

Comments
 (0)