diff --git a/tools/python/mbed_platformio/build_mbed_ce.py b/tools/python/mbed_platformio/build_mbed_ce.py index 27233bf112d..556c971078c 100644 --- a/tools/python/mbed_platformio/build_mbed_ce.py +++ b/tools/python/mbed_platformio/build_mbed_ce.py @@ -93,7 +93,7 @@ def is_cmake_reconfigure_required(): ninja_buildfile = BUILD_DIR / "build.ninja" if not cmake_cache_file.exists(): - print("Mbed CE: Reconfigure required because CMake cache does not exist") + print(f"Mbed CE: Reconfigure required because CMake cache does not exist") return True if not CMAKE_API_REPLY_DIR.is_dir() or not any(CMAKE_API_REPLY_DIR.iterdir()): print("Mbed CE: Reconfigure required because CMake API reply dir is missing") @@ -253,7 +253,7 @@ def get_app_defines(app_config: dict): "-DUPLOAD_METHOD=NONE", # Disable Mbed CE upload method system as PlatformIO has its own ] + click.parser.split_arg_string(board.get("build.cmake_extra_args", "")), -) + ) if not project_codemodel: sys.stderr.write("Error: Couldn't find code model generated by CMake\n") @@ -282,8 +282,9 @@ def get_app_defines(app_config: dict): # Link the main Mbed OS library using -Wl,--whole-archive. This is needed for the resolution of weak symbols # within this archive. -link_args = ["-Wl,--whole-archive", "$BUILD_DIR\\mbed-os\\libmbed-os.a", "-Wl,--no-whole-archive"] -env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", "$BUILD_DIR\\mbed-os\\libmbed-os.a") +mbed_ce_lib_path = pathlib.Path("$BUILD_DIR") / "mbed-os" / "libmbed-os.a" +link_args = ["-Wl,--whole-archive", '"' + str(mbed_ce_lib_path) + '"', "-Wl,--no-whole-archive"] +env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", str(mbed_ce_lib_path)) # Get other linker flags from Mbed. We want these to appear after the application objects and Mbed libraries # because they contain the C/C++ library link flags. diff --git a/tools/python/mbed_platformio/cmake_to_scons_converter.py b/tools/python/mbed_platformio/cmake_to_scons_converter.py index f733c3791a0..19e7a02775a 100644 --- a/tools/python/mbed_platformio/cmake_to_scons_converter.py +++ b/tools/python/mbed_platformio/cmake_to_scons_converter.py @@ -136,11 +136,11 @@ def _get_flags_for_compile_group(compile_group_json: dict) -> list[str]: """ flags = [] for ccfragment in compile_group_json["compileCommandFragments"]: - fragment = ccfragment.get("fragment", "").strip("\" ") + fragment = ccfragment.get("fragment", "").strip() if not fragment or fragment.startswith("-D"): continue flags.extend( - click.parser.split_arg_string(fragment.strip()) + click.parser.split_arg_string(fragment) ) return flags