Skip to content

Commit

Permalink
restructure - Updated tools to point to restructured modules
Browse files Browse the repository at this point in the history
MBED_HAL       /hal/hal      x
MBED_API       /hal/api      x
MBED_COMMON    /hal/common   x
MBED_TARGETS   /hal/targets  ->  /targets
MBED_DRIVERS                  +  /drivers
MBED_PLATFORM                 +  /platform
MBED_HEADER                   +  /mbed.h
  • Loading branch information
geky committed Oct 1, 2016
1 parent ba99a1f commit 960d69f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
24 changes: 16 additions & 8 deletions tools/build_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

from tools.utils import mkdir, run_cmd, run_cmd_ext, NotSupportedException,\
ToolException, InvalidReleaseTargetException
from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_API, MBED_HAL,\
MBED_COMMON, MBED_CONFIG_FILE
from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_HEADER,\
MBED_DRIVERS, MBED_PLATFORM, MBED_HAL, MBED_CONFIG_FILE
from tools.targets import TARGET_NAMES, TARGET_MAP
from tools.libraries import Library
from tools.toolchains import TOOLCHAIN_CLASSES
Expand Down Expand Up @@ -904,13 +904,16 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
('MBED', target.name, toolchain_name))

# Common Headers
toolchain.copy_files(toolchain.scan_resources(MBED_API).headers,
toolchain.copy_files([MBED_HEADER], MBED_LIBRARIES)
toolchain.copy_files(toolchain.scan_resources(MBED_DRIVERS).headers,
MBED_LIBRARIES)
toolchain.copy_files(toolchain.scan_resources(MBED_PLATFORM).headers,
MBED_LIBRARIES)
toolchain.copy_files(toolchain.scan_resources(MBED_HAL).headers,
MBED_LIBRARIES)

# Target specific sources
hal_src = join(MBED_TARGETS_PATH, "hal")
hal_src = MBED_TARGETS_PATH
hal_implementation = toolchain.scan_resources(hal_src)
toolchain.copy_files(hal_implementation.headers +
hal_implementation.hex_files +
Expand All @@ -922,7 +925,9 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
[MBED_LIBRARIES] + incdirs)

# Common Sources
mbed_resources = toolchain.scan_resources(MBED_COMMON)
mbed_resources = toolchain.scan_resources(MBED_DRIVERS)
mbed_resources += toolchain.scan_resources(MBED_PLATFORM)
mbed_resources += toolchain.scan_resources(MBED_HAL)
objects += toolchain.compile_sources(mbed_resources, tmp_path,
[MBED_LIBRARIES] + incdirs)

Expand Down Expand Up @@ -1187,7 +1192,10 @@ def static_analysis_scan(target, toolchain_name, cppcheck_cmd,
('MBED', target.name, toolchain_name))

# Common Headers
toolchain.copy_files(toolchain.scan_resources(MBED_API).headers,
toolchain.copy_files([MBED_HEADER], MBED_LIBRARIES)
toolchain.copy_files(toolchain.scan_resources(MBED_DRIVERS).headers,
MBED_LIBRARIES)
toolchain.copy_files(toolchain.scan_resources(MBED_PLATFORM).headers,
MBED_LIBRARIES)
toolchain.copy_files(toolchain.scan_resources(MBED_HAL).headers,
MBED_LIBRARIES)
Expand Down Expand Up @@ -1217,8 +1225,8 @@ def static_analysis_scan(target, toolchain_name, cppcheck_cmd,
# command line
mbed_includes = ["-I%s" % i for i in mbed_resources.inc_dirs]
mbed_includes.append("-I%s"% str(build_target))
mbed_includes.append("-I%s"% str(MBED_COMMON))
mbed_includes.append("-I%s"% str(MBED_API))
mbed_includes.append("-I%s"% str(MBED_DRIVERS))
mbed_includes.append("-I%s"% str(MBED_PLATFORM))
mbed_includes.append("-I%s"% str(MBED_HAL))
mbed_c_sources = " ".join(mbed_resources.c_sources)
mbed_cpp_sources = " ".join(mbed_resources.cpp_sources)
Expand Down
2 changes: 1 addition & 1 deletion tools/build_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
print str(e)

# copy targets.json file as part of the release
copy(join(dirname(abspath(__file__)), '..', 'hal', 'targets.json'), MBED_LIBRARIES)
copy(join(dirname(abspath(__file__)), '..', 'targets', 'targets.json'), MBED_LIBRARIES)

# Write summary of the builds
if options.report_build_file_name:
Expand Down
10 changes: 5 additions & 5 deletions tools/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
TOOLS_BOOTLOADERS = join(TOOLS, "bootloaders")

# mbed libraries
MBED_BASE = join(ROOT, "hal")
MBED_HEADER = join(ROOT, "mbed.h")
MBED_DRIVERS = join(ROOT, "drivers")
MBED_PLATFORM = join(ROOT, "platform")
MBED_HAL = join(ROOT, "hal")

MBED_API = join(MBED_BASE, "api")
MBED_COMMON = join(MBED_BASE, "common")
MBED_HAL = join(MBED_BASE, "hal")
MBED_TARGETS_PATH = join(MBED_BASE, "targets")
MBED_TARGETS_PATH = join(ROOT, "targets")

MBED_LIBRARIES = join(BUILD_DIR, "mbed")

Expand Down
2 changes: 1 addition & 1 deletion tools/synch.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# Tuple data: (repo_name, list_of_code_dirs, [team])
# team is optional - if not specified, the code is published under mbed_official
OFFICIAL_CODE = (
("mbed-dev" , MBED_BASE),
("mbed-dev" , [MBED_DRIVERS, MBED_PLATFORM, MBED_HAL]),
("mbed-rtos", RTOS),
("mbed-dsp" , DSP),
("mbed-rpc" , MBED_RPC),
Expand Down
2 changes: 1 addition & 1 deletion tools/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Target(namedtuple("Target", "name json_data resolution_order resolution_or

# Default location of the 'targets.json' file
__targets_json_location_default = os.path.join(
os.path.dirname(os.path.abspath(__file__)), '..', 'hal', 'targets.json')
os.path.dirname(os.path.abspath(__file__)), '..', 'targets', 'targets.json')

# Current/new location of the 'targets.json' file
__targets_json_location = None
Expand Down

0 comments on commit 960d69f

Please sign in to comment.