Skip to content

[Tools] mbed Online Build System support and improvements #2180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions tools/export/exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __scan_and_copy(self, src_path, trg_path):

for r_type in ['headers', 's_sources', 'c_sources', 'cpp_sources',
'objects', 'libraries', 'linker_script',
'lib_builds', 'lib_refs', 'repo_files', 'hex_files', 'bin_files']:
'lib_builds', 'lib_refs', 'hex_files', 'bin_files']:
r = getattr(resources, r_type)
if r:
self.toolchain.copy_files(r, trg_path, resources=resources)
Expand Down Expand Up @@ -149,16 +149,21 @@ def scan_and_copy_resources(self, prj_paths, trg_path, relative=False):
# Copy only the file for the required target and toolchain
lib_builds = []
# Create the configuration object
if isinstance(prj_paths, basestring):
prj_paths = [prj_paths]
config = Config(self.target, prj_paths)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the

from operators import add

from the top of this file. It's no longer needed/wanted.

for src in ['lib', 'src']:
resources = reduce(add, [self.__scan_and_copy(join(path, src), trg_path) for path in prj_paths])
resources = self.__scan_and_copy(join(prj_paths[0], src), trg_path)
for path in prj_paths[1:]:
resources.add(self.__scan_and_copy(join(path, src), trg_path))

lib_builds.extend(resources.lib_builds)

# The repository files
for repo_dir in resources.repo_dirs:
repo_files = self.__scan_all(repo_dir)
for path in proj_paths :
self.toolchain.copy_files(repo_files, trg_path, rel_path=join(path, src))
#for repo_dir in resources.repo_dirs:
# repo_files = self.__scan_all(repo_dir)
# for path in prj_paths:
# self.toolchain.copy_files(repo_files, trg_path, rel_path=join(path, src))

# The libraries builds
for bld in lib_builds:
Expand Down Expand Up @@ -186,19 +191,14 @@ def scan_and_copy_resources(self, prj_paths, trg_path, relative=False):
# Loads the resources into the config system which might expand/modify resources based on config data
self.resources = config.load_resources(resources)


if hasattr(self, "MBED_CONFIG_HEADER_SUPPORTED") and self.MBED_CONFIG_HEADER_SUPPORTED :
# Add the configuration file to the target directory
self.config_header = self.toolchain.MBED_CONFIG_FILE_NAME
config.get_config_data_header(join(trg_path, self.config_header))
self.config_macros = []
else :
else:
# And add the configuration macros to the toolchain
self.config_macros = config.get_config_data_macros()
# Check the existence of a binary build of the mbed library for the desired target
# This prevents exporting the mbed libraries from source
# if not self.toolchain.mbed_libs:
# raise OldLibrariesException()

def gen_file(self, template_file, data, target_file):
template_path = join(Exporter.TEMPLATE_DIR, template_file)
Expand Down
3 changes: 0 additions & 3 deletions tools/export/uvision4.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from tools.export.exporters import Exporter, ExporterTargetsProperty
from tools.targets import TARGET_MAP, TARGET_NAMES
from tools.settings import ARM_INC

# If you wish to add a new target, add it to project_generator_definitions, and then
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
Expand Down Expand Up @@ -79,8 +78,6 @@ def generate(self, progen_build=False):
project_data['tool_specific']['uvision']['misc']['c_flags'] = list(set(self.progen_flags['common_flags'] + self.progen_flags['c_flags'] + self.progen_flags['cxx_flags']))
# not compatible with c99 flag set in the template
project_data['tool_specific']['uvision']['misc']['c_flags'].remove("--c99")
# ARM_INC is by default as system inclusion, not required for exported project
project_data['tool_specific']['uvision']['misc']['c_flags'].remove("-I \""+ARM_INC+"\"")
# cpp is not required as it's implicit for cpp files
project_data['tool_specific']['uvision']['misc']['c_flags'].remove("--cpp")
# we want no-vla for only cxx, but it's also applied for C in IDE, thus we remove it
Expand Down
3 changes: 0 additions & 3 deletions tools/export/uvision5.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from tools.export.exporters import Exporter, ExporterTargetsProperty
from tools.targets import TARGET_MAP, TARGET_NAMES
from tools.settings import ARM_INC

# If you wish to add a new target, add it to project_generator_definitions, and then
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
Expand Down Expand Up @@ -77,8 +76,6 @@ def generate(self, progen_build=False):
project_data['tool_specific']['uvision5']['misc']['asm_flags'] = list(set(self.progen_flags['asm_flags']))
# cxx flags included, as uvision have them all in one tab
project_data['tool_specific']['uvision5']['misc']['c_flags'] = list(set(self.progen_flags['common_flags'] + self.progen_flags['c_flags'] + self.progen_flags['cxx_flags']))
# ARM_INC is by default as system inclusion, not required for exported project
project_data['tool_specific']['uvision5']['misc']['c_flags'].remove("-I \""+ARM_INC+"\"")
# not compatible with c99 flag set in the template
project_data['tool_specific']['uvision5']['misc']['c_flags'].remove("--c99")
# cpp is not required as it's implicit for cpp files
Expand Down
11 changes: 0 additions & 11 deletions tools/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,6 @@
print "WARNING: MBED_%s set as environment variable but doesn't exist" % _n


##############################################################################
# ARM Compiler Paths
##############################################################################

ARM_BIN = join(ARM_PATH, "bin")
ARM_INC = join(ARM_PATH, "include")
ARM_LIB = join(ARM_PATH, "lib")
ARM_CPPLIB = join(ARM_LIB, "cpplib")
MY_ARM_CLIB = join(ARM_LIB, "lib", "microlib")


##############################################################################
# Test System Settings
##############################################################################
Expand Down
4 changes: 2 additions & 2 deletions tools/synch.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def ignore_path(name, reg_exps):
class MbedRepository:
@staticmethod
def run_and_print(command, cwd):
stdout, _, _ = run_cmd(command, wd=cwd, redirect=True)
stdout, _, _ = run_cmd(command, work_dir=cwd, redirect=True)
print(stdout)

def __init__(self, name, team = None):
Expand All @@ -147,7 +147,7 @@ def __init__(self, name, team = None):
def publish(self):
# The maintainer has to evaluate the changes first and explicitly accept them
self.run_and_print(['hg', 'addremove'], cwd=self.path)
stdout, _, _ = run_cmd(['hg', 'status'], wd=self.path)
stdout, _, _ = run_cmd(['hg', 'status'], work_dir=self.path)
if stdout == '':
print "No changes"
return False
Expand Down
3 changes: 3 additions & 0 deletions tools/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class Target:
# need to be computed differently than regular attributes
__cumulative_attributes = ['extra_labels', 'macros', 'device_has', 'features']

# List of targets that were added dynamically using "add_py_targets" (see below)
__py_targets = set()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__py_targets is no longer needed. Please remove it.


# Location of the 'targets.json' file
__targets_json_location = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'hal', 'targets.json')

Expand Down
10 changes: 5 additions & 5 deletions tools/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
from tools.build_api import add_result_to_report
from tools.build_api import scan_for_source_paths
from tools.libraries import LIBRARIES, LIBRARY_MAP
from tools.toolchains import TOOLCHAIN_BIN_PATH
from tools.toolchains import TOOLCHAIN_PATHS
from tools.toolchains import TOOLCHAINS
from tools.test_exporters import ReportExporter, ResultExporterType
from tools.utils import argparse_filestring_type
Expand Down Expand Up @@ -1343,8 +1343,8 @@ def print_test_configuration_from_json(json_data, join_delim=", "):
if conflict:
cell_val += '*'
# Check for conflicts: toolchain vs toolchain path
if toolchain in TOOLCHAIN_BIN_PATH:
toolchain_path = TOOLCHAIN_BIN_PATH[toolchain]
if toolchain in TOOLCHAIN_PATHS:
toolchain_path = TOOLCHAIN_PATHS[toolchain]
if not os.path.isdir(toolchain_path):
conflict_path = True
if toolchain not in toolchain_path_conflicts:
Expand All @@ -1368,8 +1368,8 @@ def print_test_configuration_from_json(json_data, join_delim=", "):

for toolchain in toolchain_path_conflicts:
# Let's check toolchain configuration
if toolchain in TOOLCHAIN_BIN_PATH:
toolchain_path = TOOLCHAIN_BIN_PATH[toolchain]
if toolchain in TOOLCHAIN_PATHS:
toolchain_path = TOOLCHAIN_PATHS[toolchain]
if not os.path.isdir(toolchain_path):
result += "\t# Toolchain %s path not found: %s\n"% (toolchain, toolchain_path)
return result
Expand Down
Loading