mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9652 from kfnta/tools_fixes
Fix minor bugs in secure targets file filteringpull/9670/head
commit
f04d51b2cd
|
|
@ -43,6 +43,7 @@ from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT, CLI_COLOR_MAP
|
||||||
from tools.notifier.term import TerminalNotifier
|
from tools.notifier.term import TerminalNotifier
|
||||||
from tools.utils import argparse_filestring_type, args_error, argparse_many
|
from tools.utils import argparse_filestring_type, args_error, argparse_many
|
||||||
from tools.utils import argparse_filestring_type, argparse_dir_not_parent
|
from tools.utils import argparse_filestring_type, argparse_dir_not_parent
|
||||||
|
from tools.paths import is_relative_to_root
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
start = time()
|
start = time()
|
||||||
|
|
@ -188,19 +189,11 @@ if __name__ == '__main__':
|
||||||
mcu = TARGET_MAP[target]
|
mcu = TARGET_MAP[target]
|
||||||
profile = extract_profile(parser, options, toolchain)
|
profile = extract_profile(parser, options, toolchain)
|
||||||
|
|
||||||
if mcu.is_PSA_secure_target:
|
if mcu.is_PSA_secure_target and \
|
||||||
lib_build_res = build_library(
|
not is_relative_to_root(options.source_dir):
|
||||||
ROOT, options.build_dir, mcu, toolchain,
|
options.source_dir = ROOT
|
||||||
jobs=options.jobs,
|
|
||||||
clean=options.clean,
|
if options.source_dir:
|
||||||
archive=(not options.no_archive),
|
|
||||||
macros=options.macros,
|
|
||||||
name=options.artifact_name,
|
|
||||||
build_profile=profile,
|
|
||||||
ignore=options.ignore,
|
|
||||||
notify=notifier,
|
|
||||||
)
|
|
||||||
elif options.source_dir:
|
|
||||||
lib_build_res = build_library(
|
lib_build_res = build_library(
|
||||||
options.source_dir, options.build_dir, mcu, toolchain,
|
options.source_dir, options.build_dir, mcu, toolchain,
|
||||||
jobs=options.jobs,
|
jobs=options.jobs,
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ from tools.paths import MBED_LIBRARIES
|
||||||
from tools.paths import RPC_LIBRARY
|
from tools.paths import RPC_LIBRARY
|
||||||
from tools.paths import USB_LIBRARIES
|
from tools.paths import USB_LIBRARIES
|
||||||
from tools.paths import DSP_LIBRARIES
|
from tools.paths import DSP_LIBRARIES
|
||||||
|
from tools.paths import is_relative_to_root
|
||||||
from tools.tests import TESTS, Test, TEST_MAP
|
from tools.tests import TESTS, Test, TEST_MAP
|
||||||
from tools.tests import TEST_MBED_LIB
|
from tools.tests import TEST_MBED_LIB
|
||||||
from tools.tests import test_known, test_name_known
|
from tools.tests import test_known, test_name_known
|
||||||
|
|
@ -307,8 +308,9 @@ if __name__ == '__main__':
|
||||||
args_error(parser, "argument -t/--tool is required")
|
args_error(parser, "argument -t/--tool is required")
|
||||||
toolchain = options.tool[0]
|
toolchain = options.tool[0]
|
||||||
|
|
||||||
if Target.get_target(mcu).is_PSA_secure_target:
|
if Target.get_target(mcu).is_PSA_secure_target and \
|
||||||
options.source_dir = ROOT
|
not is_relative_to_root(options.source_dir):
|
||||||
|
options.source_dir = ROOT
|
||||||
|
|
||||||
if (options.program is None) and (not options.source_dir):
|
if (options.program is None) and (not options.source_dir):
|
||||||
args_error(parser, "one of -p, -n, or --source is required")
|
args_error(parser, "one of -p, -n, or --source is required")
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
"""
|
"""
|
||||||
from os.path import join
|
from os.path import join, commonprefix, realpath
|
||||||
from os import getenv
|
from os import getenv
|
||||||
|
|
||||||
# Conventions about the directory structure
|
# Conventions about the directory structure
|
||||||
|
|
@ -85,3 +85,11 @@ CPPUTEST_TESTRUNNER_SCR = join(TEST_DIR, "utest", "testrunner")
|
||||||
CPPUTEST_TESTRUNNER_INC = join(TEST_DIR, "utest", "testrunner")
|
CPPUTEST_TESTRUNNER_INC = join(TEST_DIR, "utest", "testrunner")
|
||||||
|
|
||||||
CPPUTEST_LIBRARY = join(BUILD_DIR, "cpputest")
|
CPPUTEST_LIBRARY = join(BUILD_DIR, "cpputest")
|
||||||
|
|
||||||
|
|
||||||
|
def is_relative_to_root(dirs):
|
||||||
|
if not isinstance(dirs, list):
|
||||||
|
dirs = [dirs]
|
||||||
|
dirs = [realpath(d) for d in dirs]
|
||||||
|
out = commonprefix(dirs + [ROOT])
|
||||||
|
return out == ROOT
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ from collections import namedtuple, defaultdict
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from os import walk, sep
|
from os import walk, sep
|
||||||
from os.path import (join, splitext, dirname, relpath, basename, split, normcase,
|
from os.path import (join, splitext, dirname, relpath, basename, split, normpath,
|
||||||
abspath, exists)
|
abspath, exists)
|
||||||
|
|
||||||
from .ignore import MbedIgnoreSet, IGNORE_FILENAME
|
from .ignore import MbedIgnoreSet, IGNORE_FILENAME
|
||||||
|
|
@ -148,6 +148,11 @@ class Resources(object):
|
||||||
|
|
||||||
self._ignoreset = MbedIgnoreSet()
|
self._ignoreset = MbedIgnoreSet()
|
||||||
|
|
||||||
|
# make sure mbed-os root is added as include directory
|
||||||
|
script_dir = dirname(abspath(__file__))
|
||||||
|
mbed_os_root_dir = normpath(join(script_dir, '..', '..'))
|
||||||
|
self.add_file_ref(FileType.INC_DIR, mbed_os_root_dir, mbed_os_root_dir)
|
||||||
|
|
||||||
def ignore_dir(self, directory):
|
def ignore_dir(self, directory):
|
||||||
if self._collect_ignores:
|
if self._collect_ignores:
|
||||||
self.ignored_dirs.append(directory)
|
self.ignored_dirs.append(directory)
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS, TOOLCHAIN_CLASSES
|
||||||
from tools.settings import CLI_COLOR_MAP
|
from tools.settings import CLI_COLOR_MAP
|
||||||
from tools.settings import ROOT
|
from tools.settings import ROOT
|
||||||
from tools.targets import Target
|
from tools.targets import Target
|
||||||
|
from tools.paths import is_relative_to_root
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
# Parse Options
|
# Parse Options
|
||||||
|
|
@ -211,7 +213,7 @@ if __name__ == '__main__':
|
||||||
if not options.build_dir:
|
if not options.build_dir:
|
||||||
args_error(parser, "argument --build is required")
|
args_error(parser, "argument --build is required")
|
||||||
|
|
||||||
if mcu_secured:
|
if mcu_secured and not is_relative_to_root(options.source_dir):
|
||||||
base_source_paths = ROOT
|
base_source_paths = ROOT
|
||||||
else:
|
else:
|
||||||
base_source_paths = options.source_dir
|
base_source_paths = options.source_dir
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue