I’ve been trying to figure out how to make use of the arduino command line interface on my MacBook pro, but to be frank, I don’t entirely know what I’m doing. I’ve almost figured out the command to use to upload a sketch onto a Blink, but I’m a little stuck with this error:
arduino-cli upload -b Move38-Blinks-Library:avr:blink -programmer
Error during Upload: compiled sketch /Users/JonathanWest/Projects/Causeway/Causeway.Move38-Blinks-Library.avr.blink.hex not found
This seems to me that it’s trying to point to a hex file that I assume lives somewhere other than the project directory, but I’m unsure how to change that.
I was also under the assumption that I just hadn’t properly added the Blinks core package, so I attempted that with this command from the “getting started” guide:
Updating index: package_index.json downloaded
Updating index: package_move38.com-blinks_index.json downloaded
Error updating index: invalid package index in https://raw.githubusercontent.com/Move38/Blinks-SDK/master/package_move38.com-blinks_index.json: invalid character ']' looking for beginning of value
Has anyone done this before who could show me what I’m doing wrong or walk me through this process? It isn’t a huge deal for me to get this working, but as I’m mostly using Vim for code editing and I’m only using the Arduino software for it’s “upload” button, I thought this might be nicer to set up.
Thanks for that suggestion. Looking a bit more closely at the documentation for the arduino-cli’s configuration file, it looks like there are options to set specific directories for data. I might play around with that and see what I can come up with.
I’m not sure about the other stuff, but I think at least this error was my fault - you happened to hit the boards manager config file while I was corrupting updating it. Sorry.
That file should be good now. If the other issues persist then the debug output from the bottom window would be helpful as @BGA mentioned above.
@bigjosh Thanks for looking at this, unfortunately though I still seem to be getting that error:
arduino-cli core update-index --additional-urls https://raw.githubusercontent.com/Move38/Blinks-SDK/master/package_move38.com-blinks_index.json
Updating index: package_index.json downloaded
Updating index: package_move38.com-blinks_index.json downloaded
Error updating index: invalid package index in https://raw.githubusercontent.com/Move38/Blinks-SDK/master/package_move38.com-blinks_index.json: invalid character ']' looking for beginning of value
Is there maybe another URL I should be using instead? I did get a step closer yesterday by updating the “data directory” in my config to point to the location where I installed the Blinks SDK originally, which is where the BlinkBIOS.hex file was being stored, but I was met with a rather vague error when uploading:
Running that command yesterday with the verbose flag yielded the same error. Another step I tried was running arduino core update-index, which seemed to be successful, as this was part of the output:
Hmmm… not sure where that url came from, but it is not right in so many ways!
I’ll be honest I’m not entirely sure where I grabbed that url from either… Adding the link in in your instructions seems to have worked successfully though, so that error is fixed!
Now though I’m still running into the issue where the program is searching for a .hex file in the sketch directory to upload… I’m sure it’s just something I’m doing wrong with the upload command but I haven’t figured out what yet.
Maybe you need to do a compile command first to create the HEX files before doing the upload ?
You were right, I didn’t realize that’s what was going on with the IDE when you compiled. I had to run a few extra steps to get the compiler working properly, namely run arduino-cli core install arduino:avr to make sure the right compiler was installed, but after that the hex file was getting dropped into the project directory for upload.
I didn’t have my Blinks on hand to actually test the upload, so I’ll confirm that everything works later today or tomorrow morning, but I’m assuming that was the big fix. Thanks for your help!
EDIT: When I confirm that I get everything working I’ll make a last post summing up the steps I took to get this working for the Blinks Dev Kit, in case anyone else wants to make use of it in the future.
Run arduino-cli config init to create a configuration file. The program should give you an output telling you where the config file was placed. It should be named arduino-cli.yaml.
Edit the config file to include https://github.com/bigjosh/Move38-Arduino-Platform/releases/latest/download/package_move38.com-blinks_index.json in the “board_manager” section under “additional urls”. It should look like this:
Save the changes to the config file and run arduino-cli core update-index for the changes in your config to take place.
Make sure you have the proper compiler installed by running arduino-cli core install arduino:avr
All of these above steps are explained in more detail in their own docs, which you can follow in case my instructions aren’t very clear. I just thought it would be helpful to include the proper board strings and package urls for Blinks.
From here, you should be able to compile and upload the sketch using the arduino-cli program. However, make sure you are in the parent directory of your sketch folder, not in the sketch folder itself. Otherwise these commands get a little confused.
Note that the above commands take the name of the sketch without the ‘.ino’ extension. Arduino-CLI is assuming that the name of the sketch is within a folder that matches the name of the sketch file. The IDE also behaves this way, but the CLI program is a little less obvious about it.
Hopefully this helps, if there’s anything I missed let me know. This will probably be the way I handle my workflow on my macbook from here on out!
Hey, I’m trying to get command line tools working, and successfully followed most of the steps here. I had to change Move38-Blinks-Library to move38 (retrieved from board listall), because my board is not showing up in the board list. This allowed me to successfully compile from the command line, but when I try to upload, I get:
Error during Upload: uploading error: cannot execute upload tool: exec: “echo ERROR_TELL_JOSH_UPLOAD_WAS_CALLED”: executable file not found in $PATH
so, HEY JOSH, UPLOAD WAS CALLED
This is code that I have been able to compile and upload to blinks in the Arduino IDE. Any hints?
You are not supposed to be able to do an “UPLOAD” because there is no such thing as an upload for this board, but apparently the CLI let’s you try to do it anyway.
In Arduino-speak, UPLOAD means “send to bootloader over serial connection”. What we want to do to program a blink is called “Upload Via Programmer” by the IDE.
I do not see any way to explicitly do that with the CLI, so it looks like we will need to explicitly specify the programmer like this…