-
Notifications
You must be signed in to change notification settings - Fork 3k
uARM: Fix deprecate warning printing wrongly for GCC_ARM/IAR toolchain build #12198
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
0619941
to
0c9d8b2
Compare
@rajkan01, thank you for your changes. |
0c9d8b2
to
de3c737
Compare
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
@ARMmbed/mbed-os-tools Please review. If approved, this is ready for integration |
Quick review here 👍 |
tools/build_api.py
Outdated
end_warnings.append(UARM_TOOLCHAIN_WARNING) | ||
if toolchain_name == "uARM": | ||
end_warnings.append(UARM_TOOLCHAIN_WARNING) | ||
elif toolchain_name == "ARMC6" and target.default_toolchain == "uARM": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you checking for target.default_toolchain
?
Also isn't there an opportunity do so something like:
if (
toolchain_name in ["uARM", "ARMC5", "ARMC6"]
and target.default_toolchain == "uARM"
):
end_warnings.append(UARM_TOOLCHAIN_WARNING)
(check if the syntax is correct)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, this logic has become too complex to maintain. Please can you take the opportunity to refactor this into a sequence of 'if' statements at the same level, rather than the current complex arrangement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you checking for target.default_toolchain?
Also isn't there an opportunity do so something like:
if (
toolchain_name in ["uARM", "ARMC5", "ARMC6"]
and target.default_toolchain == "uARM"
):
end_warnings.append(UARM_TOOLCHAIN_WARNING)(check if the syntax is correct)
The reason for checking target.default_toolchain is, if the target tries to build with ARM(ARMC5 or ARMC6) toolchain but the target.default_toolchain is configured to uARM then internally build tool use ARM with Small library.
So code snapshot will not work for all the target, such as LPC11C24 has uARM in the supported_toolchain but there is no target.default_toolchain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
Please refactor the code to avoid repetitions and add comment where an explanation is needed.
tools/build_api.py
Outdated
end_warnings.append(UARM_TOOLCHAIN_WARNING) | ||
if toolchain_name == "uARM": | ||
end_warnings.append(UARM_TOOLCHAIN_WARNING) | ||
elif toolchain_name == "ARMC6" and target.default_toolchain == "uARM": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, this logic has become too complex to maintain. Please can you take the opportunity to refactor this into a sequence of 'if' statements at the same level, rather than the current complex arrangement.
tools/toolchains/arm.py
Outdated
@@ -44,6 +44,13 @@ | |||
"please visit https://os.mbed.com/docs/mbed-os/latest/reference/using-small-c-libraries.html" | |||
) | |||
|
|||
UARM_DEFAULT_TOOLCHAIN_WARNING = ( | |||
"Warning: We noticed that this target default_toolchain overrides --toolchain option with uARM Toolchain. " | |||
"We are deprecating the use of uARM Toolchain. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"We are deprecating the use of uARM Toolchain. " | |
"We are deprecating the use of the uARM Toolchain. " |
tools/toolchains/arm.py
Outdated
@@ -44,6 +44,13 @@ | |||
"please visit https://os.mbed.com/docs/mbed-os/latest/reference/using-small-c-libraries.html" | |||
) | |||
|
|||
UARM_DEFAULT_TOOLCHAIN_WARNING = ( | |||
"Warning: We noticed that this target default_toolchain overrides --toolchain option with uARM Toolchain. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Warning: We noticed that this target default_toolchain overrides --toolchain option with uARM Toolchain. " | |
"Warning: We noticed that this target overrides default_toolchain with the uARM Toolchain (using --toolchain). " |
CI restarted |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
"Warning: We noticed that you are using uARM Toolchain. " | ||
"We are deprecating the use of uARM Toolchain. " | ||
"Warning: We noticed that you are using uARM Toolchain either via --toolchain command line or default_toolchain option. " | ||
"We are deprecating the use of the uARM Toolchain. " | ||
"For more information on how to use the ARM toolchain with small C libraries, " | ||
"please visit https://os.mbed.com/docs/mbed-os/latest/reference/using-small-c-libraries.html" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened to UARM_DEFAULT_TOOLCHAIN_WARNING
that you had before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have combined into existing UARM_TOOLCHAIN_WARNING
tools/build_api.py
Outdated
if not TOOLCHAIN_CLASSES[internal_tc_name].check_executable(): | ||
search_path = TOOLCHAIN_PATHS[internal_tc_name] or "No path set" | ||
last_error = ( | ||
"Could not find executable for {}.\n" | ||
"Currently set search path: {}" | ||
).format(toolchain_name, search_path) | ||
else: | ||
if toolchain_name == "uARM" or target.default_toolchain == "uARM": | ||
end_warnings.append(UARM_TOOLCHAIN_WARNING) | ||
if toolchain_name in ["uARM", "ARMC5", "ARMC6"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use elif (condition): pass
instead of else: if (condition): pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is, it will fail for GCC_ARM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will not fail. It will work the exact same way. It is weird to have else and and single if.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
until if toolchain_name in ["uARM", "ARMC5", "ARMC6", "GCC_ARM"]:
, it will not work when I combined as if with else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was confused. I know understand that line 244 is only applicable to line 247 (To prevent adding the warning if a target has target.default_toolchain
set to uARM
even if say the GCC_ARM
toolchain is used).
Perhaps line 244 should be moved to above 247 to be clear.
tools/build_api.py
Outdated
if toolchain_name == "uARM" or target.default_toolchain == "uARM": | ||
end_warnings.append(UARM_TOOLCHAIN_WARNING) | ||
if toolchain_name in ["uARM", "ARMC5", "ARMC6"]: | ||
if toolchain_name == "ARMC5": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the following more readable?
elif toolchain_name in ["uARM", "ARMC5", "ARMC6"]:
(end_warnings.append(ARMC5_MIGRATION_WARNING) if toolchain_name == "ARMC5")
(end_warnings.append(UARM_TOOLCHAIN_WARNING) if "uARM" in {toolchain_name, target.default_toolchain})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit difficult to readable "pass" followed if(condition)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can at least do:
if "uARM" in {toolchain_name, target.default_toolchain}:
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Summary of changes
Mbed OS build tool is wrongly printing uARM toolchain deprecation warning when building with GCC_ARM toolchain, so added the toolchain check before appending warning message.
Impact of changes
Migration actions required
Documentation
Pull request type
Test results
Reviewers
@evedon @hugueskamba