Merge remote-tracking branch 'upstream/master'

pull/17/head
Matthew Else 2013-07-24 14:39:53 +01:00
commit 57cbd39868
3 changed files with 36 additions and 17 deletions

View File

@ -136,18 +136,20 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False):
# mbed
toolchain.info("\n>>> BUILD LIBRARY %s (%s, %s)" % ('MBED', target.name, toolchain_name))
HAL_SRC = join(MBED_TARGETS_PATH, "hal")
hal_implementation = toolchain.scan_resources(HAL_SRC)
mbed_resources = toolchain.scan_resources(MBED_COMMON)
mbed_resources.add(hal_implementation)
# Headers
# Common Headers
toolchain.copy_files(toolchain.scan_resources(MBED_API).headers, MBED_LIBRARIES)
toolchain.copy_files(toolchain.scan_resources(MBED_HAL).headers, MBED_LIBRARIES)
toolchain.copy_files(hal_implementation.headers, BUILD_TARGET)
objects = toolchain.compile_sources(mbed_resources, TMP_PATH, [MBED_LIBRARIES, BUILD_TARGET])
# Target specific sources
HAL_SRC = join(MBED_TARGETS_PATH, "hal")
hal_implementation = toolchain.scan_resources(HAL_SRC)
toolchain.copy_files(hal_implementation.headers, BUILD_TARGET)
objects = toolchain.compile_sources(hal_implementation, TMP_PATH, [MBED_LIBRARIES, BUILD_TARGET])
# Common Sources
mbed_resources = toolchain.scan_resources(MBED_COMMON)
objects += toolchain.compile_sources(mbed_resources, TMP_PATH, [MBED_LIBRARIES, BUILD_TARGET])
# Keep the stdio retargeting as a standalone object to be sure the
# C standard library symbols get overridden

View File

@ -9,12 +9,16 @@ from workspace_tools.export import export
from shutil import copytree
EXPORT_DIR = join(BUILD_DIR, "export_test")
USER_WORKSPACE = join(EXPORT_DIR, "user_workspace")
USR_PRJ_NAME = "export_test"
USER_PRJ = join(BUILD_DIR, USR_PRJ_NAME)
USR_PRJ_NAME = "usr_prj"
USER_PRJ = join(USER_WORKSPACE, USR_PRJ_NAME)
USER_LIB = join(USER_PRJ, "lib")
USER_SRC = join(USER_PRJ, "src")
TEMP = join(USER_PRJ, ".temp")
TEMP = join(USER_WORKSPACE, ".temp")
def setup_test_user_prj():
if exists(USER_PRJ):
@ -50,7 +54,7 @@ def test_export(toolchain, target, expected_error=None):
zip_path, report = export(USER_PRJ, USR_PRJ_NAME, toolchain, target, base_dir, temp_dir, False, fake_build_url_resolver)
if report['success']:
export_name = join(TEMP, "export_%s_%s.zip" % (toolchain, target))
export_name = join(EXPORT_DIR, "export_%s_%s.zip" % (toolchain, target))
cmd(["mv", zip_path, export_name])
print "[OK]"
else:
@ -66,9 +70,6 @@ def test_export(toolchain, target, expected_error=None):
if __name__ == '__main__':
# import logging as log
# log.getLogger().setLevel(log.DEBUG)
setup_test_user_prj()
for toolchain, target in [

View File

@ -101,6 +101,20 @@ class Resources:
return '\n'.join(s)
# Support legacy build conventions: the original mbed build system did not have
# standard labels for the "TARGET_" and "TOOLCHAIN_" specific directories, but
# had the knowledge of a list of these directories to be ignored.
LEGACY_IGNORE_DIRS = set([
'LPC11U24', 'LPC1768', 'LPC2368', 'LPC4088', 'LPC812', 'KL25Z',
'ARM', 'GCC_ARM', 'GCC_CR', 'GCC_CS', 'IAR', 'uARM'
])
LEGACY_TOOLCHAIN_NAMES = {
'ARM_STD':'ARM', 'ARM_MICRO': 'uARM',
'GCC_ARM': 'GCC_ARM', 'GCC_CR': 'GCC_CR', 'GCC_CS': 'GCC_CS',
'IAR': 'IAR',
}
class mbedToolchain:
VERBOSE = True
@ -113,6 +127,9 @@ class mbedToolchain:
def __init__(self, target, options=None, notify=None):
self.target = target
self.name = self.__class__.__name__
self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set([target.name, LEGACY_TOOLCHAIN_NAMES[self.name]])
if notify is not None:
self.notify = notify
@ -127,7 +144,6 @@ class mbedToolchain:
if self.options:
self.info("Build Options: %s" % (', '.join(self.options)))
self.name = self.__class__.__name__
self.obj_path = join(target.name, self.name)
self.symbols = None
@ -195,7 +211,7 @@ class mbedToolchain:
for root, dirs, files in walk(path):
# Remove ignored directories
for d in copy(dirs):
if ((d.startswith('.') or d in set(['CVS'])) or
if ((d.startswith('.') or d in self.legacy_ignore_dirs) or
(d.startswith('TARGET_') and d[7:] not in labels['TARGET']) or
(d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN'])):
dirs.remove(d)