Uploading hex files from mac via java: how?

Hello!

I have a mature Java app built for windows, mac, and ubuntu. In Windows it piggy backs on AVRDude to upload pre-built firmware. I'd like to offer something similar for all my mac users. The path to getting mac avrdude installed seems quite onerous, and I haven't found a purely-java way to upload hex files.

Clearly Arduino has already solved this problem - in fact, I used Arduino as an example when figuring out how to do the avrdude thing. So... can you please give me some pointers? I'm trying to make things simpler for my users so they can't install 3rd party stuff, open the CLI, any of that. I can add things to the DMG file when I package with maven.

Thank you!

PS the project is GitHub - MarginallyClever/Makelangelo-software: Software for plotters - especially the wall-hanging polargraph also called Makelangelo.

I'm not sure if I understand your goal. Arduino didn't implement a system for uploading hex files in the Java code. Arduino IDE and Arduino CLI only generate an upload command from the pattern (a template) defined in the platform of the selected board and then invokes that arbitrary command. The upload tool like AVRDUDE handles the actual upload.

What do you mean by onerous?

With homebrew

brew install avrdude

Or with macPorts

sudo port install avrdude

If you turn on verbose output, you will see that the build output simply uses avrdude to perform the actual upload.

I know you are using Mac, but here is an example from windoze:

C:\<PATHTO>\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\<PATHTO>\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM11 -b115200 -D -Uflash:w:C:\<PATHTO>\Temp\arduino_build_730631/delme.ino.hex:i 

I edited the paths slight to reduce the verbosity.

Oh, I should have added that if you really wanted to port it to Java, you can find the avrdude source online - I don't know how up to date it is, or what the licensing issues might be, but that would be an option.

If it were me, I would just include an installation of avrdude in your project and just run that - just like the Arduino installer seems to do.

Well... I guess I'm just stuck on the idea of making my users install a lot of stuff just to run one feature, doesn't feel efficient or safe. Yes, I can figure out how to make the packaging tool run those commands to install some app to then install avrdude and pray none of the middle steps break. I remain hopeful there's a way with less steps.

investigating further... I use jpackage to prepare my app for release and it's my understanding that it is not well equipped to call out to install homebrew etc.

avrdude is open source...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.