Correct check for the ARM toolchain binary in the PATH.

The compiler used for the ARM toolchain changes depending on the target.
This changes the front end scripts to do the proper toolchain look up
before checking the system PATH for the compiler executable. The tools
were always checking for the ARMC5 compiler, now it should check for the
right version.
pull/10044/head
Brian Daniels 2019-03-11 18:50:04 -05:00
parent 83d70199d1
commit cd96b21370
3 changed files with 24 additions and 12 deletions

View File

@ -38,6 +38,7 @@ from tools.options import extract_mcus
from tools.build_api import build_library, build_mbed_libs, build_lib
from tools.build_api import mcu_toolchain_matrix
from tools.build_api import print_build_results
from tools.build_api import get_toolchain_name
from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT
from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT, CLI_COLOR_MAP
from tools.notifier.term import TerminalNotifier
@ -169,12 +170,18 @@ if __name__ == '__main__':
successes = []
skipped = []
toolchain_names = set()
for toolchain in toolchains:
if not TOOLCHAIN_CLASSES[toolchain].check_executable():
search_path = TOOLCHAIN_PATHS[toolchain] or "No path set"
for target_name in targets:
target = Target.get_target(target_name)
toolchain_names.add(get_toolchain_name(target, toolchain))
for toolchain_name in toolchain_names:
if not TOOLCHAIN_CLASSES[toolchain_name].check_executable():
search_path = TOOLCHAIN_PATHS[toolchain_name] or "No path set"
args_error(parser, "Could not find executable for %s.\n"
"Currently set search path: %s"
% (toolchain, search_path))
% (toolchain_name, search_path))
for toolchain in toolchains:
for target in targets:

View File

@ -47,6 +47,7 @@ from tools.build_api import mcu_toolchain_matrix
from tools.build_api import mcu_toolchain_list
from tools.build_api import mcu_target_list
from tools.build_api import merge_build_data
from tools.build_api import get_toolchain_name
from utils import argparse_filestring_type
from utils import argparse_many
from utils import argparse_dir_not_parent
@ -308,7 +309,8 @@ if __name__ == '__main__':
args_error(parser, "argument -t/--tool is required")
toolchain = options.tool[0]
if Target.get_target(mcu).is_PSA_secure_target and \
target = Target.get_target(mcu)
if target.is_PSA_secure_target and \
not is_relative_to_root(options.source_dir):
options.source_dir = ROOT
@ -321,11 +323,12 @@ if __name__ == '__main__':
notify = TerminalNotifier(options.verbose, options.silent, options.color)
if not TOOLCHAIN_CLASSES[toolchain].check_executable():
search_path = TOOLCHAIN_PATHS[toolchain] or "No path set"
toolchain_name = get_toolchain_name(target, toolchain)
if not TOOLCHAIN_CLASSES[toolchain_name].check_executable():
search_path = TOOLCHAIN_PATHS[toolchain_name] or "No path set"
args_error(parser, "Could not find executable for %s.\n"
"Currently set search path: %s"
%(toolchain, search_path))
%(toolchain_name, search_path))
if options.source_dir is not None:
wrapped_build_project(

View File

@ -35,6 +35,7 @@ from tools.options import get_default_options_parser, extract_profile, extract_m
from tools.build_api import build_project, build_library
from tools.build_api import print_build_memory_usage
from tools.build_api import merge_build_data
from tools.build_api import get_toolchain_name
from tools.targets import TARGET_MAP
from tools.notifier.term import TerminalNotifier
from tools.utils import mkdir, ToolException, NotSupportedException, args_error, write_json_to_file
@ -149,18 +150,20 @@ if __name__ == '__main__':
if options.mcu is None:
args_error(parser, "argument -m/--mcu is required")
mcu = extract_mcus(parser, options)[0]
mcu_secured = Target.get_target(mcu).is_PSA_secure_target
target = Target.get_target(mcu)
mcu_secured = target.is_PSA_secure_target
# Toolchain
if options.tool is None:
args_error(parser, "argument -t/--tool is required")
toolchain = options.tool[0]
if not TOOLCHAIN_CLASSES[toolchain].check_executable():
search_path = TOOLCHAIN_PATHS[toolchain] or "No path set"
toolchain_name = get_toolchain_name(target, toolchain)
if not TOOLCHAIN_CLASSES[toolchain_name].check_executable():
search_path = TOOLCHAIN_PATHS[toolchain_name] or "No path set"
args_error(parser, "Could not find executable for %s.\n"
"Currently set search path: %s"
% (toolchain, search_path))
% (toolchain_name, search_path))
# Assign config file. Precedence: test_config>app_config
# TODO: merge configs if both given
@ -312,4 +315,3 @@ if __name__ == '__main__':
traceback.print_exc(file=sys.stdout)
print("[ERROR] %s" % str(e))
sys.exit(1)