Skip to content

Commit 6cecd09

Browse files
Merge pull request #4961 from theotherjimmy/check-rtos-export
Check for mbed 5 support on export
2 parents 4f1cafd + dc6398a commit 6cecd09

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

tools/build_api.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,18 @@ def scan_resources(src_paths, toolchain, dependencies_paths=None,
438438
# Set the toolchain's configuration data
439439
toolchain.set_config_data(toolchain.config.get_config_data())
440440

441+
if (hasattr(toolchain.target, "release_versions") and
442+
"5" not in toolchain.target.release_versions and
443+
"rtos" in toolchain.config.lib_config_data):
444+
if "Cortex-A" in toolchain.target.core:
445+
raise NotSupportedException(
446+
("%s Will be supported in mbed OS 5.6. "
447+
"To use the %s, please checkout the mbed OS 5.4 release branch. "
448+
"See https://developer.mbed.org/platforms/Renesas-GR-PEACH/#important-notice "
449+
"for more information") % (toolchain.target.name, toolchain.target.name))
450+
else:
451+
raise NotSupportedException("Target does not support mbed OS 5")
452+
441453
return resources
442454

443455
def build_project(src_paths, build_path, target, toolchain_name,
@@ -519,17 +531,6 @@ def build_project(src_paths, build_path, target, toolchain_name,
519531
try:
520532
# Call unified scan_resources
521533
resources = scan_resources(src_paths, toolchain, inc_dirs=inc_dirs)
522-
if (hasattr(toolchain.target, "release_versions") and
523-
"5" not in toolchain.target.release_versions and
524-
"rtos" in toolchain.config.lib_config_data):
525-
if "Cortex-A" in toolchain.target.core:
526-
raise NotSupportedException(
527-
("%s Will be supported in mbed OS 5.6. "
528-
"To use the %s, please checkout the mbed OS 5.4 release branch. "
529-
"See https://developer.mbed.org/platforms/Renesas-GR-PEACH/#important-notice "
530-
"for more information") % (toolchain.target.name, toolchain.target.name))
531-
else:
532-
raise NotSupportedException("Target does not support mbed OS 5")
533534

534535
# Change linker script if specified
535536
if linker_script is not None:

tools/project.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from tools.utils import argparse_force_lowercase_type
2121
from tools.utils import argparse_force_uppercase_type
2222
from tools.utils import print_large_string
23+
from tools.utils import NotSupportedException
2324
from tools.options import extract_profile, list_profiles, extract_mcus
2425

2526
def setup_project(ide, target, program=None, source_dir=None, build=None, export_path=None):
@@ -246,11 +247,13 @@ def main():
246247
profile = extract_profile(parser, options, toolchain_name, fallback="debug")
247248
if options.clean:
248249
rmtree(BUILD_DIR)
249-
export(mcu, options.ide, build=options.build,
250-
src=options.source_dir, macros=options.macros,
251-
project_id=options.program, zip_proj=zip_proj,
252-
build_profile=profile, app_config=options.app_config)
253-
250+
try:
251+
export(mcu, options.ide, build=options.build,
252+
src=options.source_dir, macros=options.macros,
253+
project_id=options.program, zip_proj=zip_proj,
254+
build_profile=profile, app_config=options.app_config)
255+
except NotSupportedException as exc:
256+
print "[ERROR] %s" % str(exc)
254257

255258
if __name__ == "__main__":
256259
main()

0 commit comments

Comments
 (0)