forked from platformio/platformio-core
Automatically install dependent upload tools // Issue #472
This commit is contained in:
1 parent
52f1502051
commit
ac9c3f88f9
7 files changed
+290
-22
No files matched your search
@@ -36,11 +36,9 @@ class AtmelavrPlatform(BasePlatform):
|
||||
},
|
||||
|
||||
"tool-avrdude": {
|
||||
"alias": "uploader"
|
||||
},
|
||||
|
||||
"tool-micronucleus": {
|
||||
"alias": "uploader"
|
||||
},
|
||||
|
||||
"framework-arduinoavr": {
|
||||
@@ -58,10 +56,10 @@ class AtmelavrPlatform(BasePlatform):
|
||||
def configure_default_packages(self, envoptions, targets):
|
||||
if envoptions.get("board"):
|
||||
board = get_boards(envoptions.get("board"))
|
||||
disable_tool = "tool-micronucleus"
|
||||
if "digispark" in board['build']['core']:
|
||||
disable_tool = "tool-avrdude"
|
||||
del self.PACKAGES[disable_tool]['alias']
|
||||
self.PACKAGES['tool-micronucleus']['alias'] = "uploader"
|
||||
else:
|
||||
self.PACKAGES['tool-avrdude']['alias'] = "uploader"
|
||||
|
||||
return BasePlatform.configure_default_packages(
|
||||
self, envoptions, targets)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
from platformio.platforms.base import BasePlatform
|
||||
from platformio.util import get_boards
|
||||
|
||||
|
||||
class AtmelsamPlatform(BasePlatform):
|
||||
@@ -49,13 +50,32 @@ class AtmelsamPlatform(BasePlatform):
|
||||
},
|
||||
|
||||
"tool-bossac": {
|
||||
"alias": "uploader"
|
||||
},
|
||||
|
||||
"tool-openocd": {
|
||||
"alias": "uploader"
|
||||
},
|
||||
|
||||
"tool-avrdude": {
|
||||
}
|
||||
}
|
||||
|
||||
def get_name(self):
|
||||
return "Atmel SAM"
|
||||
|
||||
def configure_default_packages(self, envoptions, targets):
|
||||
if envoptions.get("board"):
|
||||
board = get_boards(envoptions.get("board"))
|
||||
upload_protocol = board.get("upload", {}).get("protocol", None)
|
||||
upload_tool = None
|
||||
if upload_protocol == "openocd":
|
||||
upload_tool = "tool-openocd"
|
||||
elif upload_protocol == "sam-ba":
|
||||
upload_tool = "tool-bossac"
|
||||
elif upload_protocol == "stk500v2":
|
||||
upload_tool = "tool-avrdude"
|
||||
|
||||
if upload_tool:
|
||||
self.PACKAGES[upload_tool]['alias'] = "uploader"
|
||||
|
||||
return BasePlatform.configure_default_packages(
|
||||
self, envoptions, targets)
|
||||
Reference in new issue
Block a user