The Arduino Command Line Interface (CLI)

The Arduino folks just came out with the Arduino Command Line Interface (CLI) :

Announcing the Arduino Command Line Interface (CLI)

A while back, I wrote about the  Arduino-Builder which is what the Arduino IDE invokes behind the scenes to compile the sketch. (That post is here.) Now, with the Arduino Command Line Interface, everything that can be done from the IDE can now be done on the command line.

The Arduino Command Line Interface can be downloaded from here. By the way, it is also written in the Go language.

I downloaded the file for my system (Linux 64 bit):

Extracted it:

and moved it to an easier name:

I tried it out and got it working OK for the BluePill but had to make some changes to the boards.txt configuration file.

Here is how I got it working for both the Arduino Uno and  the BluePill (STM32F103C8T6):

Create these directories first (the are needed and not created if they don’t exist):

Create a basic config file since it will need to be modified to add the BluePill info:

Edit the .cli-config.yml and add these lines at the end:

Next, create a basic test sketch (and optionally edit it):

Next, create the index json files via:

Optionally look and see what boards are available to install:

Then install the stm32duino files for the BluePill:

Optionally install the core files for the Arduino Uno (etc.):

You can see a list of the installed boards via:

If you try and compile the test sketch now via:

You will see a bunch of errors, so you will need to edit the boards.txt file:

To eliminate the errors, change some of the genericSTM32F103C lines with  the string genericSTM32F103C.menu….build. in them to just genericSTM32F103C.build. lines. Make sure there are no duplicates. (The .menu. lines are for selections in the Arduino IDE.)

Once all the correct options are fixed in the boards.txt config file, the sketch should compile fine via:

To see if the arduino-cli recognizes your attached BluePill (or other Arduino), run:

To upload the sketch:

Libraries can be found with a search:

And installed via:

……………………….

At no time did my fingers leave the keyboard… I like the cli !

Leave a Reply

Your email address will not be published.