@echo off setlocal EnableDelayedExpansion REM aupload.bat - Don Cross - https://cosinekitty.com set rc=1 REM --------------------------------------------------------------------------- if not defined arduino_path ( echo.The environment variable ARDUINO_PATH must be defined to point to the Arduino installation. goto end ) if not exist "!arduino_path!\cygwin1.dll" ( echo.The environment variable ARDUINO_PATH is pointing to an invalid directory. goto end ) REM --------------------------------------------------------------------------- if "%1" == "" ( echo. echo.Usage - aupload hexfile echo. echo.Uploads the given hexfile [e.g. "mysketch.hex"] to your Arduino board. echo.If hexfile is an asterisk [*], aupload will search in .\obj for a .hex echo.file, and if exactly one such .hex file is found, that will be uploaded. echo. echo.This batch file was released on 7 January 2007. echo.Check the following web page for the latest version: echo. echo. https://playground.arduino.cc/Code/WindowsCommandLine echo. goto end ) if "%1" == "*" ( set hexcount=0 for %%f in (obj\*.hex) do ( set hexfile=%%f echo.Found !hexfile! set /a hexcount+=1 ) if !hexcount! == 1 ( REM Unique file was found. We are happy. ) else ( if !hexcount! == 0 ( echo. echo.aupload.bat: No hex files were found in obj\*.hex echo. ) else ( echo. echo.aupload.bat: Found !hexcount! were found in obj\*.hex. echo.Please specify which should be uploaded, or delete all but one of them. echo. ) goto end ) ) else ( set hexfile=%1 if not exist !hexfile! ( echo.aupload.bat: File !hexfile! does not exist. goto end ) ) call agetpref.bat agetpref_internal if not !errorlevel! == 0 ( goto end ) REM --------------------------------------------------------------------------- set path=!arduino_path!;!arduino_path!\tools\avr\bin;!path! uisp -v=3 -dpart=!pref_build.mcu! -dprog=!pref_upload.programmer! -dserial=/dev/com1 -dspeed=!pref_serial.download_rate! --upload if=!hexfile! set rc=!errorlevel! goto end REM --------------------------------------------------------------------------- :end echo.aupload.bat: exiting with return code !rc! exit /b !rc! REM $Log: aupload.bat,v $ REM Revision 1.6 2007/01/07 22:53:53 dcross REM Usage text now displays link to where to get latest version on Arduino Playground. REM Also displays its own release date so user can tell whether what he has is up-to-date. REM REM Revision 1.5 2007/01/07 22:31:08 dcross REM Now call agetpref.bat to get Arduino preferences, instead of having hardcoded options. REM REM Revision 1.4 2007/01/07 21:39:59 dcross REM Discovered weird behavior if uisp is fed a file that does not exist: it acts like it is still trying to upload something! REM So now we check for existence of file. REM Exit with return code so calling process can determine whether upload was successful or not. REM REM Revision 1.3 2007/01/06 23:15:00 dcross REM Now generate much less verbose uisp output with -v=3 instead of -v=4. REM REM Revision 1.2 2007/01/06 22:33:10 dcross REM Now allow user to pass * on the command line, which causes us to search for a unique hex file in the obj dir. REM REM Revision 1.1 2007/01/06 22:05:33 dcross REM First draft of an uploader batch file. Right now all the parameters are hardcoded for my own configuration. REM To make this usable by other people, I will need to figure out how to get their configuration. REM