-
Notifications
You must be signed in to change notification settings - Fork 3k
Enable build with IAR when c_lib is set to small #12665
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,11 @@ | |
|
||
RELEASE_VERSIONS = ['2', '5'] | ||
|
||
SMALL_C_LIB_CHANGE_WARNING = ( | ||
"Warning: We noticed that you are using target.c_lib set to small. " | ||
"As the {} target does not support a small C library for the {} toolchain, we are using the standard C library instead. " | ||
) | ||
|
||
def prep_report(report, target_name, toolchain_name, id_name): | ||
"""Setup report keys | ||
|
||
|
@@ -205,6 +210,27 @@ def get_toolchain_name(target, toolchain_name): | |
|
||
return toolchain_name | ||
|
||
|
||
def check_small_c_lib_support(target, toolchain_name): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two issues with this function: 1. The 'target' argument is potentially modified inside the function (ie the function has a side-effect that is not easily seen from outside). The name of the function 'check...' implies that it simply checks something. When the function is called, the user does not know that the target arg will be modified (without studying the internals of the function). This kind of thing is really hard to maintain in future. 2. The function mixes up the concepts of checking for some condition, and reporting on that condition. This makes it hard to test (and there are no tests for this). The reporting should be done by the caller IMO. |
||
""" | ||
Check if the small C lib is supported. | ||
If it is not supported and the standard C library is supported, the later will be used instead. | ||
Return a warning if the standard C lib will be used instead of the small C lib. | ||
""" | ||
if ( | ||
hasattr(target, "c_lib") | ||
and target.c_lib.lower() == "small" | ||
and hasattr(target, "supported_c_libs") | ||
and toolchain_name not in target.supported_c_libs | ||
): | ||
if ( | ||
"small" not in target.supported_c_libs[toolchain_name] | ||
and "std" in target.supported_c_libs[toolchain_name] | ||
): | ||
return SMALL_C_LIB_CHANGE_WARNING.format(target.name, toolchain_name) | ||
|
||
|
||
|
||
def find_valid_toolchain(target, toolchain): | ||
"""Given a target and toolchain, get the names for the appropriate | ||
toolchain to use. The environment is also checked to see if the corresponding | ||
|
@@ -250,6 +276,7 @@ def find_valid_toolchain(target, toolchain): | |
and "uARM" in {toolchain_name, target.default_toolchain} | ||
): | ||
end_warnings.append(UARM_TOOLCHAIN_WARNING) | ||
|
||
return toolchain_name, internal_tc_name, end_warnings | ||
else: | ||
if last_error: | ||
|
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.
Separating the message format from its arguments doesn't really make sense here. Since this is used only once, at the print, it makes more sense to put the text template there.