Reverted `-Wl,-whole-archive` hook for ST STM32 and mbed

This commit is contained in:
Ivan Kravets
2016-01-29 17:55:48 +02:00
parent 9102a70e04
commit c036bde86c
2 changed files with 17 additions and 0 deletions

View File

@ -8,6 +8,7 @@ PlatformIO 2.0
~~~~~~~~~~~~~~~~~~
* Exclude only ``test`` and ``tests`` folders from build process
* Reverted ``-Wl,-whole-archive`` hook for ST STM32 and mbed
2.8.1 (2016-01-29)
~~~~~~~~~~~~~~~~~~

View File

@ -195,6 +195,20 @@ def get_build_flags(data):
return flags
def _mbed_whole_archive_hook(flags):
if (not isinstance(flags, list) or
env.get("BOARD_OPTIONS", {}).get("platform") != "ststm32"):
return flags
for pos, flag in enumerate(flags[:]):
if isinstance(flag, basestring):
continue
flags.insert(pos, "-Wl,-whole-archive")
flags.insert(pos + 2, "-Wl,-no-whole-archive")
return flags
board_type = env.subst("$BOARD")
variant = MBED_VARIANTS[
board_type] if board_type in MBED_VARIANTS else board_type.upper()
@ -205,6 +219,8 @@ build_flags = get_build_flags(eixdata)
variant_dir = join("$PLATFORMFW_DIR", "variant", variant)
env.Replace(
_mbed_whole_archive_hook=_mbed_whole_archive_hook,
_LIBFLAGS="${_mbed_whole_archive_hook(%s)}" % env.get("_LIBFLAGS")[2:-1],
CPPFLAGS=build_flags.get("CPPFLAGS", []),
CFLAGS=build_flags.get("CFLAGS", []),
CXXFLAGS=build_flags.get("CXXFLAGS", []),