diff --git a/tools/build_api.py b/tools/build_api.py index fcf26878181..932cfb6531f 100644 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -486,11 +486,6 @@ def scan_resources(src_paths, toolchain, dependencies_paths=None, # Set the toolchain's configuration data toolchain.set_config_data(toolchain.config.get_config_data()) - if (hasattr(toolchain.target, "release_versions") and - "5" not in toolchain.target.release_versions and - "rtos" in toolchain.config.lib_config_data): - raise NotSupportedException("Target does not support mbed OS 5") - return resources def build_project(src_paths, build_path, target, toolchain_name, diff --git a/tools/config/__init__.py b/tools/config/__init__.py index aae39af59e0..04677215eeb 100644 --- a/tools/config/__init__.py +++ b/tools/config/__init__.py @@ -30,7 +30,8 @@ from jinja2.environment import Environment from jsonschema import Draft4Validator, RefResolver -from ..utils import json_file_to_dict, intelhex_offset, integer +from ..utils import (json_file_to_dict, intelhex_offset, integer, + NotSupportedException) from ..arm_pack_manager import Cache from ..targets import (CUMULATIVE_ATTRIBUTES, TARGET_MAP, generate_py_target, get_resolution_order, Target) @@ -1029,6 +1030,11 @@ def load_resources(self, resources): prev_features = features self.validate_config() + if (hasattr(self.target, "release_versions") and + "5" not in self.target.release_versions and + "rtos" in self.lib_config_data): + raise NotSupportedException("Target does not support mbed OS 5") + return resources @staticmethod