コード例 #1
0
        profile_data = json.load(profile_file)
        profile_toolchain = build_api.prepare_toolchain(src_paths=[mbed_os_dir], build_dir=config_header_dir, target=target_name, toolchain_name=toolchain_name, build_profile=[profile_data])
        # each toolchain must then scan the mbed dir to pick up more configs
        resources = Resources(notifier).scan_with_toolchain(src_paths=[mbed_os_dir], toolchain=profile_toolchain, exclude=True)
        profile_toolchain.RESPONSE_FILES=False


        profile_toolchains.append(profile_toolchain)


# Profiles seem to only set flags, so for the remaining operations we can use any toolchain
toolchain = profile_toolchains[0]
print("Generated config header: " + toolchain.get_config_header())


print("Using settings from these JSON files:\n " + "\n ".join(resources.get_file_paths(FileType.JSON)))


# Write target header
# -------------------------------------------------------------------------

target_header_path = os.path.join(config_header_dir, "mbed_target_config.h")
write_target_header(target_header_path, toolchain.get_symbols())
print("Generated target config header: " + target_header_path)

# Write CMake config file
# -------------------------------------------------------------------------

cmake_config_dir = os.path.join(generated_path, "cmake", )
pathlib.Path(cmake_config_dir).mkdir(parents=True, exist_ok=True) # create dir if not exists
コード例 #2
0
            target=target_name,
            toolchain_name=toolchain_name,
            build_profile=[profile_data])
        # each toolchain must then scan the mbed dir to pick up more configs
        resources = Resources(notifier).scan_with_toolchain(
            src_paths=[mbed_os_dir], toolchain=profile_toolchain, exclude=True)
        profile_toolchain.RESPONSE_FILES = False

        profile_toolchains.append(profile_toolchain)

# Profiles seem to only set flags, so for the remaining operations we can use any toolchain
toolchain = profile_toolchains[0]
print("Generated config header: " + toolchain.get_config_header())

print("Using settings from these JSON files:\n " +
      "\n ".join(resources.get_file_paths(FileType.JSON)))

# Write target header
# -------------------------------------------------------------------------

target_header_path = os.path.join(config_header_dir, "mbed_target_config.h")
write_target_header(target_header_path, toolchain.get_symbols())
print("Generated target config header: " + target_header_path)

# Write CMake config file
# -------------------------------------------------------------------------

cmake_config_dir = os.path.join(
    generated_path,
    "cmake",
)