Arduino Forum

Development => Other Software Development => Topic started by: robgonnella on Sep 16, 2019, 12:29 am

Title: Compiling and Uploading from Command-Line
Post by: robgonnella on Sep 16, 2019, 12:29 am
Hi All,

For anyone that might find this useful, or interesting, I wrote a light-weight wrapper around arduino-cli that lets you easily compile, upload, and watch logs from command-line. It will attempt auto detect your board and baud rate, and even gives you an option to watch for changes in your sketch file automatically triggering a recompile & re-upload.

This is for anyone that does not want to use the full IDE and just wants a simple mechanism for compiling, uploading and watching logs on the serial port from command line.

Instructions for installation and usage here: https://github.com/robgonnella/ardi

Feel free to make requests for additional features or report any bugs via the "issues" tab of that github link
Title: Re: Compiling and Uploading from Command-Line
Post by: liuzengqiang on Sep 16, 2019, 10:41 pm
Cool! I'll definitely check it out. Could you, in your README.md, mention the IDE version you based on? It will be relevant on the long run and when you update in case a newer IDE works slightly differently.
Title: Re: Compiling and Uploading from Command-Line
Post by: robgonnella on Sep 17, 2019, 09:21 am
Thanks for checking it out!

I can definitely add something to the readme. Something along the lines of the below statement should suffice I think.

This tool is based directly on a specific commit of arduino-cli (https://github.com/arduino/arduino-cli). The exact commit can be found in the go.mod (https://github.com/robgonnella/ardi/blob/master/go.mod) file of ardi. When installing via "go get" be sure to omit the "-u" flag so as not to update dependencies as the cli may have changed and behave unpredictably with ardi

Code: [Select]

go get -v github.com/robgonnella/ardi - ok
go get -u github.com/robgonnella/ardi - bad
Title: Re: Compiling and Uploading from Command-Line
Post by: Pimmetje on Sep 20, 2019, 09:25 pm
I was about to write something about library handling. Maybe the people interested in this also want to give there view.

I see your code used a library folder where u can put libraries for the project. But i would like to suggest to make something like composer does for PHP. So a definition what libraries (and where, if there not in the default search path).
Than it can handle the updates of the libraries as well.

The reason i am looking for something like this is i use a auto build server. For the auto building it would be nice to have repeatable builds. Even if i update the library. (Now i have all libraries in one folder). But i can only build a project with the latest library. And that is not the way it should be :).
Title: Re: Compiling and Uploading from Command-Line
Post by: Pimmetje on Sep 21, 2019, 07:50 pm
Seems this is going in the same direction (but still not finished) https://github.com/arduino/arduino-cli
Title: Re: Compiling and Uploading from Command-Line
Post by: robgonnella on Sep 23, 2019, 05:07 am
Thank you for taking a look and for your great suggestions! I will look into adding some kind dependency management feature for external libraries. As mentioned above, ardi is directly based on and uses arduino-cli (https://github.com/arduino/arduino-cli) under the hood so I may be able to build upon existing work there for this feature too. Feel free to request a feature enhancement via the issues tab of ardi (https://github.com/robgonnella/ard). Thanks again for your input!