Skip to content

Commit ae3909d

Browse files
PlatformIO: Fix build on posix systems, fix spaces in project path
1 parent f8619e3 commit ae3909d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

tools/python/mbed_platformio/build_mbed_ce.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def is_cmake_reconfigure_required():
9393
ninja_buildfile = BUILD_DIR / "build.ninja"
9494

9595
if not cmake_cache_file.exists():
96-
print("Mbed CE: Reconfigure required because CMake cache does not exist")
96+
print(f"Mbed CE: Reconfigure required because CMake cache ({cmake_cache_file!s}) does not exist")
9797
return True
9898
if not CMAKE_API_REPLY_DIR.is_dir() or not any(CMAKE_API_REPLY_DIR.iterdir()):
9999
print("Mbed CE: Reconfigure required because CMake API reply dir is missing")
@@ -253,7 +253,7 @@ def get_app_defines(app_config: dict):
253253
"-DUPLOAD_METHOD=NONE", # Disable Mbed CE upload method system as PlatformIO has its own
254254
]
255255
+ click.parser.split_arg_string(board.get("build.cmake_extra_args", "")),
256-
)
256+
)
257257

258258
if not project_codemodel:
259259
sys.stderr.write("Error: Couldn't find code model generated by CMake\n")
@@ -282,8 +282,9 @@ def get_app_defines(app_config: dict):
282282

283283
# Link the main Mbed OS library using -Wl,--whole-archive. This is needed for the resolution of weak symbols
284284
# within this archive.
285-
link_args = ["-Wl,--whole-archive", "$BUILD_DIR\\mbed-os\\libmbed-os.a", "-Wl,--no-whole-archive"]
286-
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", "$BUILD_DIR\\mbed-os\\libmbed-os.a")
285+
mbed_ce_lib_path = pathlib.Path("$BUILD_DIR") / "mbed-os" / "libmbed-os.a"
286+
link_args = ["-Wl,--whole-archive", '"' + str(mbed_ce_lib_path) + '"', "-Wl,--no-whole-archive"]
287+
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", str(mbed_ce_lib_path))
287288

288289
# Get other linker flags from Mbed. We want these to appear after the application objects and Mbed libraries
289290
# because they contain the C/C++ library link flags.

tools/python/mbed_platformio/cmake_to_scons_converter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ def _get_flags_for_compile_group(compile_group_json: dict) -> list[str]:
136136
"""
137137
flags = []
138138
for ccfragment in compile_group_json["compileCommandFragments"]:
139-
fragment = ccfragment.get("fragment", "").strip("\" ")
139+
fragment = ccfragment.get("fragment", "").strip()
140140
if not fragment or fragment.startswith("-D"):
141141
continue
142142
flags.extend(
143-
click.parser.split_arg_string(fragment.strip())
143+
click.parser.split_arg_string(fragment)
144144
)
145145
return flags
146146

0 commit comments

Comments
 (0)