From 5e65cf7f4da35fe9a489b591b44d19edce355124 Mon Sep 17 00:00:00 2001 From: Jaeden Amero Date: Fri, 22 May 2020 14:56:23 +0100 Subject: [PATCH] tools: Support default_lib and c_lib For backwards compatibility reasons, since the latest Mbed OS tools must be able to build any previous online-compiler-supported version of Mbed OS, allow targets to use `default_lib` or `c_lib`. This should enable the tools to work with Mbed OS 5 style targets.json. --- tools/toolchains/mbed_toolchain.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/toolchains/mbed_toolchain.py b/tools/toolchains/mbed_toolchain.py index 17661f6816..47668b5f20 100755 --- a/tools/toolchains/mbed_toolchain.py +++ b/tools/toolchains/mbed_toolchain.py @@ -1097,11 +1097,12 @@ class mbedToolchain(with_metaclass(ABCMeta, object)): target.c_lib is modified to have the lowercased string of its original string. This is done to be case insensitive when validating. """ - if hasattr(target, "default_lib"): - raise NotSupportedException( - "target.default_lib is no longer supported, please use target.c_lib for C library selection." - ) - if hasattr(target, "c_lib"): + if hasattr(target, "default_lib"): + # Use default_lib as the c_lib attribute. This allows backwards + # compatibility with older target definitions, allowing either + # default_lib or c_lib to specify the C library to use. + target.c_lib = target.default_lib.lower() + if hasattr(target, "c_lib"): target.c_lib = target.c_lib.lower() if ( hasattr(target, "supported_c_libs") == False