Skip to content

Commit fd757d3

Browse files
authored
Merge pull request #2180 from mbedmicro/online-build-system
[Tools] mbed Online Build System support and improvements
2 parents 7fd0a9b + ad87f9d commit fd757d3

File tree

12 files changed

+342
-285
lines changed

12 files changed

+342
-285
lines changed

tools/export/exporters.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __scan_and_copy(self, src_path, trg_path):
6969

7070
for r_type in ['headers', 's_sources', 'c_sources', 'cpp_sources',
7171
'objects', 'libraries', 'linker_script',
72-
'lib_builds', 'lib_refs', 'repo_files', 'hex_files', 'bin_files']:
72+
'lib_builds', 'lib_refs', 'hex_files', 'bin_files']:
7373
r = getattr(resources, r_type)
7474
if r:
7575
self.toolchain.copy_files(r, trg_path, resources=resources)
@@ -149,16 +149,21 @@ def scan_and_copy_resources(self, prj_paths, trg_path, relative=False):
149149
# Copy only the file for the required target and toolchain
150150
lib_builds = []
151151
# Create the configuration object
152+
if isinstance(prj_paths, basestring):
153+
prj_paths = [prj_paths]
152154
config = Config(self.target, prj_paths)
153155
for src in ['lib', 'src']:
154-
resources = reduce(add, [self.__scan_and_copy(join(path, src), trg_path) for path in prj_paths])
156+
resources = self.__scan_and_copy(join(prj_paths[0], src), trg_path)
157+
for path in prj_paths[1:]:
158+
resources.add(self.__scan_and_copy(join(path, src), trg_path))
159+
155160
lib_builds.extend(resources.lib_builds)
156161

157162
# The repository files
158-
for repo_dir in resources.repo_dirs:
159-
repo_files = self.__scan_all(repo_dir)
160-
for path in proj_paths :
161-
self.toolchain.copy_files(repo_files, trg_path, rel_path=join(path, src))
163+
#for repo_dir in resources.repo_dirs:
164+
# repo_files = self.__scan_all(repo_dir)
165+
# for path in prj_paths:
166+
# self.toolchain.copy_files(repo_files, trg_path, rel_path=join(path, src))
162167

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

189-
190194
if hasattr(self, "MBED_CONFIG_HEADER_SUPPORTED") and self.MBED_CONFIG_HEADER_SUPPORTED :
191195
# Add the configuration file to the target directory
192196
self.config_header = self.toolchain.MBED_CONFIG_FILE_NAME
193197
config.get_config_data_header(join(trg_path, self.config_header))
194198
self.config_macros = []
195-
else :
199+
else:
196200
# And add the configuration macros to the toolchain
197201
self.config_macros = config.get_config_data_macros()
198-
# Check the existence of a binary build of the mbed library for the desired target
199-
# This prevents exporting the mbed libraries from source
200-
# if not self.toolchain.mbed_libs:
201-
# raise OldLibrariesException()
202202

203203
def gen_file(self, template_file, data, target_file):
204204
template_path = join(Exporter.TEMPLATE_DIR, template_file)

tools/export/uvision4.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
from tools.export.exporters import Exporter, ExporterTargetsProperty
2121
from tools.targets import TARGET_MAP, TARGET_NAMES
22-
from tools.settings import ARM_INC
2322

2423
# If you wish to add a new target, add it to project_generator_definitions, and then
2524
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
@@ -79,8 +78,6 @@ def generate(self, progen_build=False):
7978
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']))
8079
# not compatible with c99 flag set in the template
8180
project_data['tool_specific']['uvision']['misc']['c_flags'].remove("--c99")
82-
# ARM_INC is by default as system inclusion, not required for exported project
83-
project_data['tool_specific']['uvision']['misc']['c_flags'].remove("-I \""+ARM_INC+"\"")
8481
# cpp is not required as it's implicit for cpp files
8582
project_data['tool_specific']['uvision']['misc']['c_flags'].remove("--cpp")
8683
# we want no-vla for only cxx, but it's also applied for C in IDE, thus we remove it

tools/export/uvision5.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
from tools.export.exporters import Exporter, ExporterTargetsProperty
2121
from tools.targets import TARGET_MAP, TARGET_NAMES
22-
from tools.settings import ARM_INC
2322

2423
# If you wish to add a new target, add it to project_generator_definitions, and then
2524
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
@@ -77,8 +76,6 @@ def generate(self, progen_build=False):
7776
project_data['tool_specific']['uvision5']['misc']['asm_flags'] = list(set(self.progen_flags['asm_flags']))
7877
# cxx flags included, as uvision have them all in one tab
7978
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']))
80-
# ARM_INC is by default as system inclusion, not required for exported project
81-
project_data['tool_specific']['uvision5']['misc']['c_flags'].remove("-I \""+ARM_INC+"\"")
8279
# not compatible with c99 flag set in the template
8380
project_data['tool_specific']['uvision5']['misc']['c_flags'].remove("--c99")
8481
# cpp is not required as it's implicit for cpp files

tools/settings.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,6 @@
8080
print "WARNING: MBED_%s set as environment variable but doesn't exist" % _n
8181

8282

83-
##############################################################################
84-
# ARM Compiler Paths
85-
##############################################################################
86-
87-
ARM_BIN = join(ARM_PATH, "bin")
88-
ARM_INC = join(ARM_PATH, "include")
89-
ARM_LIB = join(ARM_PATH, "lib")
90-
ARM_CPPLIB = join(ARM_LIB, "cpplib")
91-
MY_ARM_CLIB = join(ARM_LIB, "lib", "microlib")
92-
93-
9483
##############################################################################
9584
# Test System Settings
9685
##############################################################################

tools/synch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def ignore_path(name, reg_exps):
122122
class MbedRepository:
123123
@staticmethod
124124
def run_and_print(command, cwd):
125-
stdout, _, _ = run_cmd(command, wd=cwd, redirect=True)
125+
stdout, _, _ = run_cmd(command, work_dir=cwd, redirect=True)
126126
print(stdout)
127127

128128
def __init__(self, name, team = None):
@@ -147,7 +147,7 @@ def __init__(self, name, team = None):
147147
def publish(self):
148148
# The maintainer has to evaluate the changes first and explicitly accept them
149149
self.run_and_print(['hg', 'addremove'], cwd=self.path)
150-
stdout, _, _ = run_cmd(['hg', 'status'], wd=self.path)
150+
stdout, _, _ = run_cmd(['hg', 'status'], work_dir=self.path)
151151
if stdout == '':
152152
print "No changes"
153153
return False

tools/targets.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class Target:
6161
# need to be computed differently than regular attributes
6262
__cumulative_attributes = ['extra_labels', 'macros', 'device_has', 'features']
6363

64+
# List of targets that were added dynamically using "add_py_targets" (see below)
65+
__py_targets = set()
66+
6467
# Location of the 'targets.json' file
6568
__targets_json_location = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'hal', 'targets.json')
6669

tools/test_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
from tools.build_api import add_result_to_report
5959
from tools.build_api import scan_for_source_paths
6060
from tools.libraries import LIBRARIES, LIBRARY_MAP
61-
from tools.toolchains import TOOLCHAIN_BIN_PATH
61+
from tools.toolchains import TOOLCHAIN_PATHS
6262
from tools.toolchains import TOOLCHAINS
6363
from tools.test_exporters import ReportExporter, ResultExporterType
6464
from tools.utils import argparse_filestring_type
@@ -1343,8 +1343,8 @@ def print_test_configuration_from_json(json_data, join_delim=", "):
13431343
if conflict:
13441344
cell_val += '*'
13451345
# Check for conflicts: toolchain vs toolchain path
1346-
if toolchain in TOOLCHAIN_BIN_PATH:
1347-
toolchain_path = TOOLCHAIN_BIN_PATH[toolchain]
1346+
if toolchain in TOOLCHAIN_PATHS:
1347+
toolchain_path = TOOLCHAIN_PATHS[toolchain]
13481348
if not os.path.isdir(toolchain_path):
13491349
conflict_path = True
13501350
if toolchain not in toolchain_path_conflicts:
@@ -1368,8 +1368,8 @@ def print_test_configuration_from_json(json_data, join_delim=", "):
13681368

13691369
for toolchain in toolchain_path_conflicts:
13701370
# Let's check toolchain configuration
1371-
if toolchain in TOOLCHAIN_BIN_PATH:
1372-
toolchain_path = TOOLCHAIN_BIN_PATH[toolchain]
1371+
if toolchain in TOOLCHAIN_PATHS:
1372+
toolchain_path = TOOLCHAIN_PATHS[toolchain]
13731373
if not os.path.isdir(toolchain_path):
13741374
result += "\t# Toolchain %s path not found: %s\n"% (toolchain, toolchain_path)
13751375
return result

0 commit comments

Comments
 (0)