-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[WIN32-MingW Demo] TickType_t width is defined based on compiler type.(32bit/64bit) #1199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ype.(32bit/64bit) 32bit TickType_t is used if compiler is MinGW32. 64bit TickType_t is used if compiler is MinGW64. Reason of change: Before this change, 32bit TickType_t is always used in MinGW demo. It is inefficient for 64bit compiler. In addition, MinGW64 reported warnings for the cast operation between TickType_t and (void *) pointer because of different width. 64bit TickType_t should be used instead of 32bit if compiler is 64bit.
Reason of change: %u specifier corrupts 64bit tick count because it supports only 32bit value. %llu can be used for both of 64bit value and 32bit value.(After casting to 64bit)
…seType_t. Reason of change: These variables are cast to/from pointer type in existing codes. 64bit compiler(MinGW64) 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 MinGW32 and MinGW64.
…seType_t. Same change as previous commit is applied to source codes which are built only on Debug configuration.
…havior is not changed. Reason of change is to follow coding style guide of FreeRTOS.
|
Hi @watsk, Thank you. |
|
@ActoryOu Can I update submodule in this PR? Or should submodule be updated on another PR separately? |
Hi @watsk, Thanks for your contribution! |
…UBaseType_t. Additional modification for solving compiler warnings for the cast operation on MinGW64.
|
@ActoryOu |
|
@ActoryOu |
|
@ActoryOu |
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
|
@watsk, |
|
@watsk Thank you for your contribution! |
….(32bit/64bit) (FreeRTOS#1199) * [WIN32-MingW Demo] Add tick type width definition based on compiler type.(32bit/64bit) 32bit TickType_t is used if compiler is MinGW32. 64bit TickType_t is used if compiler is MinGW64. Reason of change: Before this change, 32bit TickType_t is always used in MinGW demo. It is inefficient for 64bit compiler. In addition, MinGW64 reported warnings for the cast operation between TickType_t and (void *) pointer because of different width. 64bit TickType_t should be used instead of 32bit if compiler is 64bit. * [WIN32-MingW Demo] Change printf() format specifiers from %u to %llu. Reason of change: %u specifier corrupts 64bit tick count because it supports only 32bit value. %llu can be used for both of 64bit value and 32bit value.(After casting to 64bit) * [WIN32-MingW 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. 64bit compiler(MinGW64) 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 MinGW32 and MinGW64. * [WIN32-MingW Demo] Change type of some variables from uint32_t to UBaseType_t. Same change as previous commit is applied to source codes which are built only on Debug configuration. * [WIN32-MingW Demo] Add brackets to the condition in #if statement. Behavior is not changed. Reason of change is to follow coding style guide of FreeRTOS. * Update "FreeRTOS/Source" submodule(FreeRTOS-kernel) to FreeRTOS#1008. * [WIN32-MingW Demo] Change type of one more variable from uint32_t to UBaseType_t. Additional modification for solving compiler warnings for the cast operation on MinGW64. * Update FreeRTOS-kernel submodule version in manifest.yml. * Modify prefix of variables to follow coding style guide. * Code review suggestions Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> --------- Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> Co-authored-by: ActoryOu <ousc@amazon.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
[WIN32-MingW Demo] TickType_t width is defined based on compiler type.(32bit/64bit)
Description
32bit
TickType_tis used if compiler is MinGW32. 64bitTickType_tis used if compiler is MinGW64.[Reason of change]
Before this change, 32bit
TickType_twas always used in MinGW demo. It was inefficient for 64bit compiler. In addition, MinGW64 reported warnings for the cast operation betweenTickType_tandvoid *pointer because of different width. 64bitTickType_tshould be used instead of 32bit if compiler is 64bit.[Additional change]
Even if 64bit
TickType_tis used, MinGW64 still reported warnings for the cast operation between 32bit variable and pointer type. To solve that,uint32_thas been replaced byUBaseType_tin some functions and%uhas been replaced by%lluinprintf().[Related forum topic]
This PR is derived by the following topic in the forum.
64bit application on FreeRTOS windows port
[Limitation]
There are still same warnings in TraceRecorder module because 32bit variables are used as address there. They cannot be modified because TraceRecorder is out of FreeRTOS.
Test Steps
Build WIN32-MingW Demo by MinGW64 on Debug configuration and on Debug_CodeCoverage configuration.
Confirm there is no warning for the cast operation. (Except for TraceRecorder)
Run executable on both configurations.
Confirm they are running successfully.
Confirm code coverage is kept after change.
Those tests are performed by also MinGW32 as regression tests.
Checklist:
Related Issue
If this PR is accepted, I will send another PR for similar changes for MSVC-Demo.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.