diff --git a/commands.go b/commands.go new file mode 100644 index 000000000..e8cef27f3 --- /dev/null +++ b/commands.go @@ -0,0 +1,92 @@ +package main + +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 dca6d44b4..e295b4038 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"` @@ -83,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") @@ -90,20 +111,18 @@ func uploadHandler(c *gin.Context) { } if data.Extra.Network == false { - if data.Signature == "" { - c.String(http.StatusBadRequest, "signature is required") - return - } + log.Println(data.Commandline) - if data.Commandline == "" { - c.String(http.StatusBadRequest, "commandline is required for local board") - return + if data.Extra.Verbose { + data.Commandline = commands["verbose"+data.Commandline] + } else { + data.Commandline = commands["quiet"+data.Commandline] } - err := verifyCommandLine(data.Commandline, data.Signature) + log.Println(data.Commandline) - if err != nil { - c.String(http.StatusBadRequest, "signature is invalid") + if data.Commandline == "" { + c.String(http.StatusBadRequest, "commandline is required for local board") return } } 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)