From 7d13f6ef4dd1ab0f8c211ed254ddf826c08438dd Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Mon, 29 Mar 2021 15:48:49 +0530 Subject: [PATCH 1/3] add msptool Upside Down Labs msptool is a flahing tool for MSP430G2XX3 boards. It allows flahing chips through any generic UART bridge. --- platform.json | 6 ++++++ 1 file changed, 6 insertions(+) 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" } } } From 00fb31637f9308cce67433f30499adf92a90fa87 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Mon, 29 Mar 2021 15:53:18 +0530 Subject: [PATCH 2/3] add MSP430 Breadstick Upside Down Labs MSP430 Breadstick is the first MSP430 board fully compatible with msptool. Github repo: https://github.com/upsidedownlabs/MSP430-Breadstick --- boards/upsidedownlabs-breadstick.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 boards/upsidedownlabs-breadstick.json 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" +} From dd4c60fae92789479922fe260618c2e8fdc28f02 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Mon, 29 Mar 2021 16:00:08 +0530 Subject: [PATCH 3/3] add msptool upload protocol This code will allow uploading firmware to any MSP430 board with msptool as defined protocol. --- builder/main.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) 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