[WIN32-MSVC Demo] Define TickType_t width based on the target platform(32bit/64bit). (#1201)

* [WIN32-MSVC Demo] Add tick type width definition based on the target platform.(32bit/64bit)
32bit TickType_t is used on Win32 target. 64bit TickType_t is used on x64 target.

Reason of change: Before this change, 32bit TickType_t is always used in MSVC demo. It is inefficient  for 64bit target. In addition, compiler reported warnings for the cast operation between TickType_t and (void *) pointer if the target is x64 because of different width. 64bit TickType_t should be used instead of 32bit if target is 64bit.

* [WIN32-MSVC Demo] Change type of some variables from uint32_t to UBaseType_t.

Reason of change: These variables are cast to/from pointer type in existing codes. x64 compiler reports warnings for the cast operations between uint32_t and pointer type. UBaseType_t solves those warnings because it has same width as pointer type on both of Win32 platform and x64 platform.

* [WIN32-MSVC Demo]Correct prefix of variables and indent to follow coding style guide.

* [WIN32-MSVC Demo]Correct type of the argument in vApplicationGetIdleTaskMemory() prototype declaration.
It is corrected to match original declaration described in task.h.

* [WIN32-MSVC] Add cast operation to solve compiler warnings on x64 platform.
Before this change, compiler claimed that the cast operation to wider type should be applied before other arithmetic operations because of overflow risk. There is no overflow risk here but it is modified to solve compiler warnings.
This commit is contained in:
wat 2024-04-01 13:46:07 +09:00 committed by GitHub
parent 4592acca4c
commit 7514cd3d54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 13 deletions

View file

@ -133,7 +133,7 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask,
void vApplicationTickHook( void );
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize );
configSTACK_DEPTH_TYPE * puxIdleTaskStackSize );
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
StackType_t ** ppxTimerTaskStackBuffer,
uint32_t * pulTimerTaskStackSize );
@ -417,7 +417,7 @@ static void prvInitialiseHeap( void )
* used by the Idle task. */
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
configSTACK_DEPTH_TYPE * pulIdleTaskStackSize )
configSTACK_DEPTH_TYPE * puxIdleTaskStackSize )
{
/* 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
@ -435,7 +435,7 @@ void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
/* 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;
*puxIdleTaskStackSize = configMINIMAL_STACK_SIZE;
}
/*-----------------------------------------------------------*/