mirror of https://github.com/ARMmbed/mbed-os.git
restructure - Added single-nested inc_dir support to legacy build_lib
Added single-nested include directories to libraries built with the legacy build_lib function. Unfortunately, to get this working without a significant rewrite of the legacy build tools, library header files are just duplicated in the precompile stage.pull/2878/head
parent
04a2af7395
commit
a7ddc46caf
2
mbed.h
2
mbed.h
|
@ -19,7 +19,7 @@
|
||||||
#define MBED_LIBRARY_VERSION 123
|
#define MBED_LIBRARY_VERSION 123
|
||||||
|
|
||||||
#if MBED_CONF_RTOS_PRESENT
|
#if MBED_CONF_RTOS_PRESENT
|
||||||
#include "rtos.h"
|
#include "rtos/rtos.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MBED_CONF_NSAPI_PRESENT
|
#if MBED_CONF_NSAPI_PRESENT
|
||||||
|
|
|
@ -26,7 +26,9 @@ from time import time
|
||||||
from tools.utils import mkdir, run_cmd, run_cmd_ext, NotSupportedException,\
|
from tools.utils import mkdir, run_cmd, run_cmd_ext, NotSupportedException,\
|
||||||
ToolException, InvalidReleaseTargetException
|
ToolException, InvalidReleaseTargetException
|
||||||
from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_HEADER,\
|
from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_HEADER,\
|
||||||
MBED_DRIVERS, MBED_PLATFORM, MBED_HAL, MBED_CONFIG_FILE
|
MBED_DRIVERS, MBED_PLATFORM, MBED_HAL, MBED_CONFIG_FILE,\
|
||||||
|
MBED_LIBRARIES_DRIVERS, MBED_LIBRARIES_PLATFORM, MBED_LIBRARIES_HAL,\
|
||||||
|
BUILD_DIR
|
||||||
from tools.targets import TARGET_NAMES, TARGET_MAP
|
from tools.targets import TARGET_NAMES, TARGET_MAP
|
||||||
from tools.libraries import Library
|
from tools.libraries import Library
|
||||||
from tools.toolchains import TOOLCHAIN_CLASSES
|
from tools.toolchains import TOOLCHAIN_CLASSES
|
||||||
|
@ -772,6 +774,8 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
|
||||||
for resource in resources:
|
for resource in resources:
|
||||||
toolchain.copy_files(resource.headers, build_path,
|
toolchain.copy_files(resource.headers, build_path,
|
||||||
resources=resource)
|
resources=resource)
|
||||||
|
toolchain.copy_files(resource.headers, join(build_path, name),
|
||||||
|
resources=resource)
|
||||||
|
|
||||||
dependencies_include_dir.extend(
|
dependencies_include_dir.extend(
|
||||||
toolchain.scan_resources(build_path).inc_dirs)
|
toolchain.scan_resources(build_path).inc_dirs)
|
||||||
|
@ -905,12 +909,12 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
|
||||||
|
|
||||||
# Common Headers
|
# Common Headers
|
||||||
toolchain.copy_files([MBED_HEADER], MBED_LIBRARIES)
|
toolchain.copy_files([MBED_HEADER], MBED_LIBRARIES)
|
||||||
toolchain.copy_files(toolchain.scan_resources(MBED_DRIVERS).headers,
|
for dir, dest in [(MBED_DRIVERS, MBED_LIBRARIES_DRIVERS),
|
||||||
MBED_LIBRARIES)
|
(MBED_PLATFORM, MBED_LIBRARIES_PLATFORM),
|
||||||
toolchain.copy_files(toolchain.scan_resources(MBED_PLATFORM).headers,
|
(MBED_HAL, MBED_LIBRARIES_HAL)]:
|
||||||
MBED_LIBRARIES)
|
resources = toolchain.scan_resources(dir)
|
||||||
toolchain.copy_files(toolchain.scan_resources(MBED_HAL).headers,
|
toolchain.copy_files(resources.headers, MBED_LIBRARIES)
|
||||||
MBED_LIBRARIES)
|
toolchain.copy_files(resources.headers, dest)
|
||||||
|
|
||||||
# Target specific sources
|
# Target specific sources
|
||||||
hal_src = MBED_TARGETS_PATH
|
hal_src = MBED_TARGETS_PATH
|
||||||
|
@ -925,14 +929,14 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
|
||||||
[MBED_LIBRARIES] + incdirs)
|
[MBED_LIBRARIES] + incdirs)
|
||||||
|
|
||||||
# Common Sources
|
# Common Sources
|
||||||
mbed_resources = toolchain.scan_resources(MBED_DRIVERS)
|
mbed_resources = None
|
||||||
mbed_resources += toolchain.scan_resources(MBED_PLATFORM)
|
for dir in [MBED_DRIVERS, MBED_PLATFORM, MBED_HAL]:
|
||||||
mbed_resources += toolchain.scan_resources(MBED_HAL)
|
mbed_resources += toolchain.scan_resources(dir)
|
||||||
|
|
||||||
objects += toolchain.compile_sources(mbed_resources, tmp_path,
|
objects += toolchain.compile_sources(mbed_resources, tmp_path,
|
||||||
[MBED_LIBRARIES] + incdirs)
|
[MBED_LIBRARIES] + incdirs)
|
||||||
|
|
||||||
# A number of compiled files need to be copied as objects as opposed to
|
# A number of compiled files need to be copied as objects as opposed to
|
||||||
# being part of the mbed library, for reasons that have to do with the
|
|
||||||
# way the linker search for symbols in archives. These are:
|
# way the linker search for symbols in archives. These are:
|
||||||
# - retarget.o: to make sure that the C standard lib symbols get
|
# - retarget.o: to make sure that the C standard lib symbols get
|
||||||
# overridden
|
# overridden
|
||||||
|
|
|
@ -14,8 +14,8 @@ 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 tools.paths import MBED_RTX, RTOS_LIBRARIES, MBED_LIBRARIES, MBED_RPC,\
|
from tools.paths import MBED_RTX, RTOS, RTOS_LIBRARIES, MBED_LIBRARIES,\
|
||||||
RTOS_ABSTRACTION, RPC_LIBRARY, USB, USB_LIBRARIES, USB_HOST,\
|
MBED_RPC, RPC_LIBRARY, USB, USB_LIBRARIES, USB_HOST,\
|
||||||
USB_HOST_LIBRARIES, FAT_FS, DSP_ABSTRACTION, DSP_CMSIS, DSP_LIBRARIES,\
|
USB_HOST_LIBRARIES, FAT_FS, DSP_ABSTRACTION, DSP_CMSIS, DSP_LIBRARIES,\
|
||||||
SD_FS, FS_LIBRARY, ETH_SOURCES, LWIP_SOURCES, ETH_LIBRARY, UBLOX_SOURCES,\
|
SD_FS, FS_LIBRARY, ETH_SOURCES, LWIP_SOURCES, ETH_LIBRARY, UBLOX_SOURCES,\
|
||||||
UBLOX_LIBRARY, CELLULAR_SOURCES, CELLULAR_USB_SOURCES, CPPUTEST_SRC,\
|
UBLOX_LIBRARY, CELLULAR_SOURCES, CELLULAR_USB_SOURCES, CPPUTEST_SRC,\
|
||||||
|
@ -36,7 +36,7 @@ LIBRARIES = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "rtos",
|
"id": "rtos",
|
||||||
"source_dir": RTOS_ABSTRACTION,
|
"source_dir": RTOS,
|
||||||
"build_dir": RTOS_LIBRARIES,
|
"build_dir": RTOS_LIBRARIES,
|
||||||
"dependencies": [MBED_LIBRARIES, MBED_RTX],
|
"dependencies": [MBED_LIBRARIES, MBED_RTX],
|
||||||
},
|
},
|
||||||
|
@ -62,7 +62,7 @@ LIBRARIES = [
|
||||||
"id": "usb_host",
|
"id": "usb_host",
|
||||||
"source_dir": USB_HOST,
|
"source_dir": USB_HOST,
|
||||||
"build_dir": USB_HOST_LIBRARIES,
|
"build_dir": USB_HOST_LIBRARIES,
|
||||||
"dependencies": [MBED_LIBRARIES, FAT_FS, MBED_RTX, RTOS_ABSTRACTION],
|
"dependencies": [MBED_LIBRARIES, FAT_FS, MBED_RTX, RTOS_LIBRARIES],
|
||||||
},
|
},
|
||||||
|
|
||||||
# DSP libraries
|
# DSP libraries
|
||||||
|
|
|
@ -39,6 +39,9 @@ MBED_HAL = join(ROOT, "hal")
|
||||||
MBED_TARGETS_PATH = join(ROOT, "targets")
|
MBED_TARGETS_PATH = join(ROOT, "targets")
|
||||||
|
|
||||||
MBED_LIBRARIES = join(BUILD_DIR, "mbed")
|
MBED_LIBRARIES = join(BUILD_DIR, "mbed")
|
||||||
|
MBED_LIBRARIES_DRIVERS = join(MBED_LIBRARIES, "drivers")
|
||||||
|
MBED_LIBRARIES_PLATFORM = join(MBED_LIBRARIES, "platform")
|
||||||
|
MBED_LIBRARIES_HAL = join(MBED_LIBRARIES, "hal")
|
||||||
|
|
||||||
MBED_CONFIG_FILE = join(ROOT, "platform/mbed_lib.json")
|
MBED_CONFIG_FILE = join(ROOT, "platform/mbed_lib.json")
|
||||||
|
|
||||||
|
@ -54,7 +57,6 @@ RPC_LIBRARY = join(BUILD_DIR, "rpc")
|
||||||
# mbed RTOS
|
# mbed RTOS
|
||||||
RTOS = join(ROOT, "rtos")
|
RTOS = join(ROOT, "rtos")
|
||||||
MBED_RTX = join(RTOS, "rtx")
|
MBED_RTX = join(RTOS, "rtx")
|
||||||
RTOS_ABSTRACTION = RTOS
|
|
||||||
|
|
||||||
RTOS_LIBRARIES = join(BUILD_DIR, "rtos")
|
RTOS_LIBRARIES = join(BUILD_DIR, "rtos")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue