From 6800d63f4ffe2e81cc263fea1dc665ffd4b4da2e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 3 Oct 2016 17:58:40 +0300 Subject: [PATCH] Add `buildprog` target; other improvements --- builder/main.py | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/builder/main.py b/builder/main.py index 17ee510..ff628f6 100644 --- a/builder/main.py +++ b/builder/main.py @@ -12,10 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -""" - Builder for ST STM32 Series ARM microcontrollers. -""" - from os.path import isfile, join from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, @@ -174,17 +170,16 @@ if "arduino" in env.subst("$PIOFRAMEWORK"): # Target: Build executable and linkable firmware # -target_elf = env.BuildProgram() - -# -# Target: Build the .bin file -# - -if "uploadlazy" in COMMAND_LINE_TARGETS: +target_elf = None +if "nobuild" in COMMAND_LINE_TARGETS: target_firm = join("$BUILD_DIR", "firmware.bin") else: + target_elf = env.BuildProgram() target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf) +AlwaysBuild(env.Alias("nobuild", target_firm)) +target_buildprog = env.Alias("buildprog", target_firm) + # # Target: Print binary size # @@ -199,24 +194,25 @@ AlwaysBuild(target_size) # if "mbed" in env.subst("$PIOFRAMEWORK") and not env.subst("$UPLOAD_PROTOCOL"): - upload = env.Alias( - ["upload", "uploadlazy"], target_firm, + target_upload = env.Alias( + "upload", target_firm, [env.VerboseAction(env.AutodetectUploadPort, "Looking for upload disk..."), env.VerboseAction(env.UploadToDisk, "Uploading $SOURCE")]) elif "arduino" in env.subst("$PIOFRAMEWORK"): - upload = env.Alias( - ["upload", "uploadlazy"], target_firm, + target_upload = env.Alias( + "upload", target_firm, [env.VerboseAction(env.AutodetectUploadPort, "Looking for upload disk..."), env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]) else: - upload = env.Alias(["upload", "uploadlazy"], target_firm, - env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")) -AlwaysBuild(upload) + target_upload = env.Alias( + "upload", target_firm, + env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")) +AlwaysBuild(target_upload) # # Default targets # -Default([target_firm, target_size]) +Default([target_buildprog, target_size])