diff --git a/boards/upsidedownlabs-breadstick.json b/boards/upsidedownlabs-breadstick.json new file mode 100644 index 0000000..b8401e2 --- /dev/null +++ b/boards/upsidedownlabs-breadstick.json @@ -0,0 +1,19 @@ + { + "build": { + "core": "msp430", + "f_cpu": "16000000L", + "mcu": "msp430g2553", + "variant": "UpsideDownLabs-Breadstick" + }, + "frameworks": [ + "arduino" + ], + "name": "Upside Down Labs MSP430 Breadstick", + "upload": { + "maximum_ram_size": 512, + "maximum_size": 16384, + "protocol": "msptool" + }, + "url": "https://github.com/upsidedownlabs/MSP430-Breadstick", + "vendor": "Upside Down Labs" +} diff --git a/builder/main.py b/builder/main.py index 5ea2bc6..e6b1671 100644 --- a/builder/main.py +++ b/builder/main.py @@ -1,3 +1,4 @@ +# Copyright 2021 Upside Down Labs # Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -150,10 +151,24 @@ ) upload_target = target_elf upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")] - -target_upload = env.Alias("upload", upload_target, - env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")) -AlwaysBuild(target_upload) +elif env.subst("$UPLOAD_PROTOCOL") == "msptool": + env.Replace( + UPLOADER=join(env.PioPlatform().get_package_dir("tool-msptool") or "", "msptool.py"), + MSPTOOLDIR=env.PioPlatform().get_package_dir("tool-msptool"), + UPLOADCMD='"$PYTHONEXE" "$UPLOADER" -d $MSPTOOLDIR -p $UPLOAD_PORT -f $SOURCES' + ) + upload_target = target_elf + upload_actions = [ + env.VerboseAction(env.AutodetectUploadPort, "Looking for upload port..."), + env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE") + ] + + +if env.subst("$UPLOAD_PROTOCOL") == "msptool": + env.AddPlatformTarget("upload", upload_target, upload_actions, "Upload") +else: + target_upload = env.Alias("upload", upload_target, env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")) + AlwaysBuild(target_upload) # # Default targets diff --git a/platform.json b/platform.json index 654a76d..9a95550 100644 --- a/platform.json +++ b/platform.json @@ -50,6 +50,12 @@ "optional": true, "owner": "platformio", "version": "~1.90200.1400" + }, + "tool-msptool": { + "type": "uploader", + "optional": true, + "owner": "lorforlinux", + "version": "~0.3" } } }