|
52 | 52 |
|
53 | 53 | RELEASE_VERSIONS = ['2', '5']
|
54 | 54 |
|
| 55 | +SMALL_C_LIB_CHANGE_WARNING = ( |
| 56 | + "Warning: We noticed that you are using target.c_lib set to small. " |
| 57 | + "As the {} target does not support a small C library for the {} toolchain, we are using the standard C library instead. " |
| 58 | +) |
| 59 | + |
55 | 60 | def prep_report(report, target_name, toolchain_name, id_name):
|
56 | 61 | """Setup report keys
|
57 | 62 |
|
@@ -205,6 +210,27 @@ def get_toolchain_name(target, toolchain_name):
|
205 | 210 |
|
206 | 211 | return toolchain_name
|
207 | 212 |
|
| 213 | + |
| 214 | +def check_small_c_lib_support(target, toolchain_name): |
| 215 | + """ |
| 216 | + Check if the small C lib is supported, if not use the standard C library. |
| 217 | + Return a warning if target.c_lib is changed. |
| 218 | + """ |
| 219 | + if ( |
| 220 | + hasattr(target, "c_lib") |
| 221 | + and target.c_lib.lower() == "small" |
| 222 | + and hasattr(target, "supported_c_libs") |
| 223 | + and toolchain_name not in target.supported_c_libs |
| 224 | + ): |
| 225 | + if ( |
| 226 | + "small" not in target.supported_c_libs[toolchain_name] |
| 227 | + and "std" in target.supported_c_libs[toolchain_name] |
| 228 | + ): |
| 229 | + target.c_lib = "std" |
| 230 | + return SMALL_C_LIB_CHANGE_WARNING.format(target.name, toolchain_name) |
| 231 | + |
| 232 | + |
| 233 | + |
208 | 234 | def find_valid_toolchain(target, toolchain):
|
209 | 235 | """Given a target and toolchain, get the names for the appropriate
|
210 | 236 | toolchain to use. The environment is also checked to see if the corresponding
|
@@ -250,6 +276,7 @@ def find_valid_toolchain(target, toolchain):
|
250 | 276 | and "uARM" in {toolchain_name, target.default_toolchain}
|
251 | 277 | ):
|
252 | 278 | end_warnings.append(UARM_TOOLCHAIN_WARNING)
|
| 279 | + |
253 | 280 | return toolchain_name, internal_tc_name, end_warnings
|
254 | 281 | else:
|
255 | 282 | if last_error:
|
|
0 commit comments