Hello, I’m just researching right now to see if it is possible to program an arduino Uno or leonardo board without having the arduino ide or avrdude? Just straight command line.
So my question is if you have a hex or bin file can I program an arduino in command line on windows without ide or avrdude?
I’m seeing a lot of mix results a lot of people say yes and a lot says no. I’m also seeing a lot of maybes. Not saying why though. Any help understanding what. I can do or not do without and arduino ide program.
I’m setting up a temperature sensor in my brother place that also haves a webserver on it. I might need reprogram it for me. He knows nothing about arduino and might get confused. I’m just trying to get him the best way of programming it. Yes I do know the ide would be better.
it appears that an Arduino can be programmed thru the USB/Serial interface using some protocol that makes the bootloader recognize the program mode, accepts the .hex file contents and programs it into flash.
presumably you're asking what that protocol is and are proposing writing a replacement for avrdude which your brother would run from the command line of a PC instead of avrdude.
I'm trying to find a program to where he can upload and program the arduino without having to open the sketch then go through all the boards, libraries like you normally do. just select the board and port as upload the hex or bin file and go.
That is all. I'm just trying to make it easy for him.
Can you supply him with a zip file that contains avrdude, the hex file and a batch file / shell script that executes the needed command(s). Your brother can extract the zip somewhere, double-click the batch file / script and it's done.
The batch file needs to contain a command (or a couple) to reset the Leonardo and the avrdude command to upload.
@echo off
REM 1 reset Leonardo
REM 2 upload using avrdude
REM reset-port is the normal port
set reset-port=com12
REM upload-port is the booloader port
set upload-port=com6
echo leonardo on %reset-port%
echo bootloader on %upload-port%
REM reset Leonardo
echo reset Leonardo
mode %reset-port% 1200 > nul
echo > %reset-port%
REM give it a bit of time to switch to bootloader
echo wait a bit
timeout /t 5 > nul
REM upload
echo upload
avrdude\bin\avrdude.exe -C"avrdude/etc/avrdude.conf" -patmega32u4 -cavr109 -P%upload-port% -b57600 -D "-Uflash:w:blink/build/arduino.avr.leonardo/Blink.ino.hex:i"
pause
Sorry for inconsistency in \ and /. I had some problems initially with the avrdude command
Attached is a full zip to upload a modified blink. When you "export compiled binary" in the IDE, you will get a build directory in the sketch directory that contains the hex file. That is reflected in the attached zip; you can clean it out to only have the hex file in there (no sketch, no eep file etc)