From a5a1550926683eea9258c5951687ecb990499700 Mon Sep 17 00:00:00 2001 From: Matteo Suppo Date: Thu, 24 Aug 2017 15:26:08 +0200 Subject: [PATCH 1/3] Use a whitelist of commands for the upload Fix #165: Rather than signing commands on the server, the commands are hardcoded in commands.go, and the client sends the id of the command instead of the command itself. --- commands.go | 3 +++ conn.go | 13 +------------ 2 files changed, 4 insertions(+), 12 deletions(-) create mode 100644 commands.go diff --git a/commands.go b/commands.go new file mode 100644 index 000000000..13f331c38 --- /dev/null +++ b/commands.go @@ -0,0 +1,3 @@ +package main + +var commands = map[string]string{"upload:arduino:avr:chiwawa": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:mini:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:mini:cpu=atmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:nano:cpu=atmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:nano:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:fio": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:esplora": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:leonardo": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:uno": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:circuitplay32u4cat": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:mega:cpu=atmega1280": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega1280 -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:mega:cpu=atmega2560": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega2560 -cwiring -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:one": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:yunmini": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:ethernet": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:samd:arduino_zero_edbg": "\"{runtime.tools.openocd.path}/bin/openocd\" {upload.verbose} -s \"{runtime.tools.openocd.path}/share/openocd/scripts/\" -f \"{build.path}/arduino_zero.cfg\" -c \"telnet_port disabled; program {build.path}/{build.project_name}.bin verify reset 0x00002000; shutdown\"", "upload:arduino:samd:mkr1000": "\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R", "upload:arduino:samd:arduino_zero_native": "\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R", "upload:arduino:avr:LilyPadUSB": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:pro:cpu=8MHzatmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:pro:cpu=16MHzatmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:pro:cpu=16MHzatmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:pro:cpu=8MHzatmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:samd:mkrzero": "\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R", "upload:arduino:avr:lilypad:cpu=atmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:lilypad:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:robotControl": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:samd:adafruit_circuitplayground_m0": "\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R", "upload:arduino:avr:atmegang:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:atmegang:cpu=atmega8": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega8 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:yun": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:bt:cpu=atmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:bt:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:diecimila:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:diecimila:cpu=atmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:gemma": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -pattiny85 -c{upload.protocol} -P{serial.port} -b{upload.speed} -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:unowifi": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:nrf52:primo": "\"{runtime.tools.openocd-0.10.0-arduino1-static.path}/bin/openocd\" -s \"{runtime.tools.openocd-0.10.0-arduino1-static.path}/share/openocd/scripts/\" -f \"{runtime.platform.path}/arduino_primo.cfg\" -c \"program {{{build.path}/{build.project_name}-merged.hex}} verify reset exit\"", "upload:arduino:avr:robotMotor": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:leonardoeth": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:megaADK": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega2560 -cwiring -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:micro": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:samd:mkrfox1200": "\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R", "install:arduino-connector": "source /tmp/env.sh && wget -O - https://downloads.arduino.cc/tools/arduino-connector.sh | bash"} diff --git a/conn.go b/conn.go index dca6d44b4..d4e49c72b 100644 --- a/conn.go +++ b/conn.go @@ -62,7 +62,6 @@ type Upload struct { Board string `json:"board"` Rewrite string `json:"rewrite"` Commandline string `json:"commandline"` - Signature string `json:"signature"` Extra upload.Extra `json:"extra"` Hex []byte `json:"hex"` Filename string `json:"filename"` @@ -90,22 +89,12 @@ func uploadHandler(c *gin.Context) { } if data.Extra.Network == false { - if data.Signature == "" { - c.String(http.StatusBadRequest, "signature is required") - return - } + data.Commandline = commands[data.Commandline] if data.Commandline == "" { c.String(http.StatusBadRequest, "commandline is required for local board") return } - - err := verifyCommandLine(data.Commandline, data.Signature) - - if err != nil { - c.String(http.StatusBadRequest, "signature is invalid") - return - } } buffer := bytes.NewBuffer(data.Hex) From 4e01f8a2183140f996f24d1a0f6dbf466281f06b Mon Sep 17 00:00:00 2001 From: Matteo Suppo Date: Wed, 30 Aug 2017 12:38:35 +0200 Subject: [PATCH 2/3] Check that the port is available before attempting the upload This doubles as a security measure against malicious attacks --- conn.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/conn.go b/conn.go index d4e49c72b..54641ed68 100644 --- a/conn.go +++ b/conn.go @@ -82,6 +82,28 @@ func uploadHandler(c *gin.Context) { return } + // Check that the port is available + found := false + for i := range SerialPorts.Ports { + if data.Port == SerialPorts.Ports[i].Name { + found = true + break + } + } + + for i := range NetworkPorts.Ports { + if data.Port == NetworkPorts.Ports[i].Name { + found = true + break + } + } + + if !found { + c.String(http.StatusBadRequest, "port is not available") + log.Error("port is not available") + return + } + if data.Board == "" { c.String(http.StatusBadRequest, "board is required") log.Error("board is required") From dbdd2480bd8741320057026bd65cffc33b41835f Mon Sep 17 00:00:00 2001 From: Matteo Suppo Date: Wed, 30 Aug 2017 17:09:00 +0200 Subject: [PATCH 3/3] Hardcode verbose parameters This ensure that a malicious user cannot inject arbitrary code in the commandline --- commands.go | 91 +++++++++++++++++++++++++++++++++++++++++++++++- conn.go | 10 +++++- upload/upload.go | 20 ++++------- 3 files changed, 105 insertions(+), 16 deletions(-) diff --git a/commands.go b/commands.go index 13f331c38..e8cef27f3 100644 --- a/commands.go +++ b/commands.go @@ -1,3 +1,92 @@ package main -var commands = map[string]string{"upload:arduino:avr:chiwawa": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:mini:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:mini:cpu=atmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:nano:cpu=atmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:nano:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:fio": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:esplora": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:leonardo": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:uno": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:circuitplay32u4cat": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:mega:cpu=atmega1280": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega1280 -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:mega:cpu=atmega2560": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega2560 -cwiring -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:one": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:yunmini": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:ethernet": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:samd:arduino_zero_edbg": "\"{runtime.tools.openocd.path}/bin/openocd\" {upload.verbose} -s \"{runtime.tools.openocd.path}/share/openocd/scripts/\" -f \"{build.path}/arduino_zero.cfg\" -c \"telnet_port disabled; program {build.path}/{build.project_name}.bin verify reset 0x00002000; shutdown\"", "upload:arduino:samd:mkr1000": "\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R", "upload:arduino:samd:arduino_zero_native": "\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R", "upload:arduino:avr:LilyPadUSB": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:pro:cpu=8MHzatmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:pro:cpu=16MHzatmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:pro:cpu=16MHzatmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:pro:cpu=8MHzatmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:samd:mkrzero": "\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R", "upload:arduino:avr:lilypad:cpu=atmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:lilypad:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:robotControl": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:samd:adafruit_circuitplayground_m0": "\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R", "upload:arduino:avr:atmegang:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:atmegang:cpu=atmega8": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega8 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:yun": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:bt:cpu=atmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:bt:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:diecimila:cpu=atmega168": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega168 -carduino -P{serial.port} -b19200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:diecimila:cpu=atmega328": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:gemma": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -pattiny85 -c{upload.protocol} -P{serial.port} -b{upload.speed} -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:unowifi": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega328p -carduino -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:nrf52:primo": "\"{runtime.tools.openocd-0.10.0-arduino1-static.path}/bin/openocd\" -s \"{runtime.tools.openocd-0.10.0-arduino1-static.path}/share/openocd/scripts/\" -f \"{runtime.platform.path}/arduino_primo.cfg\" -c \"program {{{build.path}/{build.project_name}-merged.hex}} verify reset exit\"", "upload:arduino:avr:robotMotor": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:leonardoeth": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:megaADK": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega2560 -cwiring -P{serial.port} -b115200 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:avr:micro": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"", "upload:arduino:samd:mkrfox1200": "\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R", "install:arduino-connector": "source /tmp/env.sh && wget -O - https://downloads.arduino.cc/tools/arduino-connector.sh | bash"} +var commands = map[string]string{ + "verboseupload:arduino:avr:chiwawa": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:mini:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:mini:cpu=atmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega328p -carduino -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:nano:cpu=atmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:nano:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:fio": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:esplora": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:leonardo": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:uno": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega328p -carduino -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:circuitplay32u4cat": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:mega:cpu=atmega1280": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega1280 -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:mega:cpu=atmega2560": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega2560 -cwiring -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:one": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:yunmini": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:ethernet": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega328p -carduino -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:samd:arduino_zero_edbg": `"{runtime.tools.openocd.path}/bin/openocd" -d2 -s "{runtime.tools.openocd.path}/share/openocd/scripts/" -f "{build.path}/arduino_zero.cfg" -c "telnet_port disabled; program {build.path}/{build.project_name}.bin verify reset 0x00002000; shutdown"`, + "verboseupload:arduino:samd:mkr1000": `"{runtime.tools.bossac-1.7.0.path}/bossac" -i -d --port={serial.port.file} -U true -i -e -w -v "{build.path}/{build.project_name}.bin" -R`, + "verboseupload:arduino:samd:arduino_zero_native": `"{runtime.tools.bossac-1.7.0.path}/bossac" -i -d --port={serial.port.file} -U true -i -e -w -v "{build.path}/{build.project_name}.bin" -R`, + "verboseupload:arduino:avr:LilyPadUSB": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:pro:cpu=8MHzatmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:pro:cpu=16MHzatmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:pro:cpu=16MHzatmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:pro:cpu=8MHzatmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:samd:mkrzero": `"{runtime.tools.bossac-1.7.0.path}/bossac" -i -d --port={serial.port.file} -U true -i -e -w -v "{build.path}/{build.project_name}.bin" -R`, + "verboseupload:arduino:avr:lilypad:cpu=atmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:lilypad:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:robotControl": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:samd:adafruit_circuitplayground_m0": `"{runtime.tools.bossac-1.7.0.path}/bossac" -i -d --port={serial.port.file} -U true -i -e -w -v "{build.path}/{build.project_name}.bin" -R`, + "verboseupload:arduino:avr:atmegang:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:atmegang:cpu=atmega8": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega8 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:yun": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:bt:cpu=atmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega328p -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:bt:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:diecimila:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:diecimila:cpu=atmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:gemma": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -pattiny85 -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:unowifi": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega328p -carduino -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:nrf52:primo": `"{runtime.tools.openocd-0.10.0-arduino1-static.path}/bin/openocd" -s "{runtime.tools.openocd-0.10.0-arduino1-static.path}/share/openocd/scripts/" -f "{runtime.platform.path}/arduino_primo.cfg" -c "program {{{build.path}/{build.project_name}-merged.hex}} verify reset exit"`, + "verboseupload:arduino:avr:robotMotor": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:leonardoeth": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:megaADK": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega2560 -cwiring -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:avr:micro": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "verboseupload:arduino:samd:mkrfox1200": `"{runtime.tools.bossac-1.7.0.path}/bossac" -i -d --port={serial.port.file} -U true -i -e -w -v "{build.path}/{build.project_name}.bin" -R`, + + "quietupload:arduino:avr:chiwawa": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:mini:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:mini:cpu=atmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega328p -carduino -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:nano:cpu=atmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:nano:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:fio": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:esplora": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:leonardo": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:uno": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega328p -carduino -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:circuitplay32u4cat": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:mega:cpu=atmega1280": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega1280 -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:mega:cpu=atmega2560": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega2560 -cwiring -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:one": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:yunmini": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:ethernet": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega328p -carduino -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:samd:arduino_zero_edbg": `"{runtime.tools.openocd.path}/bin/openocd" -d0 -s "{runtime.tools.openocd.path}/share/openocd/scripts/" -f "{build.path}/arduino_zero.cfg" -c "telnet_port disabled; program {build.path}/{build.project_name}.bin verify reset 0x00002000; shutdown"`, + "quietupload:arduino:samd:mkr1000": `"{runtime.tools.bossac-1.7.0.path}/bossac" --port={serial.port.file} -U true -i -e -w -v "{build.path}/{build.project_name}.bin" -R`, + "quietupload:arduino:samd:arduino_zero_native": `"{runtime.tools.bossac-1.7.0.path}/bossac" --port={serial.port.file} -U true -i -e -w -v "{build.path}/{build.project_name}.bin" -R`, + "quietupload:arduino:avr:LilyPadUSB": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:pro:cpu=8MHzatmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:pro:cpu=16MHzatmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:pro:cpu=16MHzatmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:pro:cpu=8MHzatmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:samd:mkrzero": `"{runtime.tools.bossac-1.7.0.path}/bossac" --port={serial.port.file} -U true -i -e -w -v "{build.path}/{build.project_name}.bin" -R`, + "quietupload:arduino:avr:lilypad:cpu=atmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:lilypad:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:robotControl": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:samd:adafruit_circuitplayground_m0": `"{runtime.tools.bossac-1.7.0.path}/bossac" --port={serial.port.file} -U true -i -e -w -v "{build.path}/{build.project_name}.bin" -R`, + "quietupload:arduino:avr:atmegang:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:atmegang:cpu=atmega8": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega8 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:yun": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:bt:cpu=atmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega328p -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:bt:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:diecimila:cpu=atmega168": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega168 -carduino -P{serial.port} -b19200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:diecimila:cpu=atmega328": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega328p -carduino -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:gemma": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -pattiny85 -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:unowifi": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega328p -carduino -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:nrf52:primo": `"{runtime.tools.openocd-0.10.0-arduino1-static.path}/bin/openocd" -s "{runtime.tools.openocd-0.10.0-arduino1-static.path}/share/openocd/scripts/" -f "{runtime.platform.path}/arduino_primo.cfg" -c "program {{{build.path}/{build.project_name}-merged.hex}} verify reset exit"`, + "quietupload:arduino:avr:robotMotor": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:leonardoeth": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:megaADK": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega2560 -cwiring -P{serial.port} -b115200 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:avr:micro": `"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -q -q -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, + "quietupload:arduino:samd:mkrfox1200": `"{runtime.tools.bossac-1.7.0.path}/bossac" --port={serial.port.file} -U true -i -e -w -v "{build.path}/{build.project_name}.bin" -R`, + + "install:arduino-connector": "source /tmp/env.sh && wget -O - https://downloads.arduino.cc/tools/arduino-connector.sh | bash"} diff --git a/conn.go b/conn.go index 54641ed68..e295b4038 100644 --- a/conn.go +++ b/conn.go @@ -111,7 +111,15 @@ func uploadHandler(c *gin.Context) { } if data.Extra.Network == false { - data.Commandline = commands[data.Commandline] + log.Println(data.Commandline) + + if data.Extra.Verbose { + data.Commandline = commands["verbose"+data.Commandline] + } else { + data.Commandline = commands["quiet"+data.Commandline] + } + + log.Println(data.Commandline) if data.Commandline == "" { c.String(http.StatusBadRequest, "commandline is required for local board") diff --git a/upload/upload.go b/upload/upload.go index 8b14f5d55..5a291ddbd 100644 --- a/upload/upload.go +++ b/upload/upload.go @@ -39,14 +39,12 @@ type Auth struct { // Extra contains some options used during the upload type Extra struct { - Use1200bpsTouch bool `json:"use_1200bps_touch"` - WaitForUploadPort bool `json:"wait_for_upload_port"` - Network bool `json:"network"` - Auth Auth `json:"auth"` - Verbose bool `json:"verbose"` - ParamsVerbose string `json:"params_verbose"` - ParamsQuiet string `json:"params_quiet"` - SSH bool `json:"ssh,omitempty"` + Use1200bpsTouch bool `json:"use_1200bps_touch"` + WaitForUploadPort bool `json:"wait_for_upload_port"` + Network bool `json:"network"` + Auth Auth `json:"auth"` + Verbose bool `json:"verbose"` + SSH bool `json:"ssh,omitempty"` } // PartiallyResolve replaces some symbols in the commandline with the appropriate values @@ -55,12 +53,6 @@ func PartiallyResolve(board, file, commandline string, extra Extra, t Locater) ( commandline = strings.Replace(commandline, "{build.path}", filepath.ToSlash(filepath.Dir(file)), -1) commandline = strings.Replace(commandline, "{build.project_name}", strings.TrimSuffix(filepath.Base(file), filepath.Ext(filepath.Base(file))), -1) - if extra.Verbose == true { - commandline = strings.Replace(commandline, "{upload.verbose}", extra.ParamsVerbose, -1) - } else { - commandline = strings.Replace(commandline, "{upload.verbose}", extra.ParamsQuiet, -1) - } - // search for runtime variables and replace with values from Locater var runtimeRe = regexp.MustCompile("\\{(.*?)\\}") runtimeVars := runtimeRe.FindAllString(commandline, -1)