diff --git a/HISTORY.rst b/HISTORY.rst index ce5c8d24..57d0867c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,6 +15,7 @@ PlatformIO 3.0 * Renamed ``envs_dir`` option to ``build_dir`` in `Project Configuration File "platformio.ini" `__ * Fixed project generator for CLion IDE +* Fixed PIO Unified Debugger for mbed framework 3.5.0 (2017-12-28) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index dd6be6a4..f9dd5386 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -46,6 +46,9 @@ def BuildProgram(env): if not case_sensitive_suffixes(".s", ".S"): env.Replace(AS="$CC", ASCOM="$ASPPCOM") + if "__debug" in COMMAND_LINE_TARGETS: + env.ProcessDebug() + # process extra flags from board if "BOARD" in env and "build.extra_flags" in env.BoardConfig(): env.ProcessFlags(env.BoardConfig().get("build.extra_flags")) @@ -60,18 +63,6 @@ def BuildProgram(env): # restore PIO macros if it was deleted by framework _append_pio_macros() - # Search for project source files - env.Append( - LIBPATH=["$BUILD_DIR"], - PIOBUILDFILES=env.CollectBuildFiles( - "$BUILDSRC_DIR", "$PROJECTSRC_DIR", "$SRC_FILTER", - duplicate=False)) - - if "__debug" in COMMAND_LINE_TARGETS: - env.ProcessDebug() - if "__test" in COMMAND_LINE_TARGETS: - env.Append(PIOBUILDFILES=env.ProcessTest()) - # build dependent libs env.Append(LIBS=env.BuildProjectLibraries()) @@ -88,7 +79,18 @@ def BuildProgram(env): # Handle SRC_BUILD_FLAGS env.ProcessFlags(env.get("SRC_BUILD_FLAGS")) - if not env.get("PIOBUILDFILES") and not COMMAND_LINE_TARGETS: + env.Append( + LIBPATH=["$BUILD_DIR"], + PIOBUILDFILES=env.CollectBuildFiles( + "$BUILDSRC_DIR", + "$PROJECTSRC_DIR", + src_filter=env.get("SRC_FILTER"), + duplicate=False)) + + if "__test" in COMMAND_LINE_TARGETS: + env.Append(PIOBUILDFILES=env.ProcessTest()) + + if not env['PIOBUILDFILES'] and not COMMAND_LINE_TARGETS: sys.stderr.write( "Error: Nothing to build. Please put your source code files " "to '%s' folder\n" % env.subst("$PROJECTSRC_DIR"))