I got me another question. I can compile a program with arduino cli for an attiny, but I am sure the computer is compiling for an Attiny85 (as the maximum programming size is over 8kb) and I want to compile for the 45
With the board listall command I found that this FQBN is to be used for the AT25, AT45 and AT85 ATTinyCore:avr:attinyx5
But like with the nano (arduino:avr:nano:cpu=atmega328old) I am guessing that I have to type to something similar behind the attiny FQBN. I have not find what I should use as FQBN for 'dem AT45.
I am guessing it is something like :mcu=attiny45 or .... (have not tried it)
Than another related point. When attempting to upload I got an error message of the baudrate not being good.
I use this line for uploading: arduino-cli upload -b ATTinyCore:avr:attinyx5 -p COM4 -i ./build/ATTinyCore.avr.attinyx5/trainCatcher.ino.hex"
Besided a wrong FQBN, is the rest correct? Do I need to explicetly specify that I am using an arduino as ICSP programmer in this line?
You can use the arduino-cli board details command to learn the available options for a given board, and the menu and option IDs that must be used in the FQBN to set an option:
So what you can see from this is that the default "Chip" menu setting is indeed "ATtiny85". If you would like to use a different option from this menu, you must use the menu ID (chip) and option ID (e.g., 45) in the FQBN.
So the FQBN for the ATtiny45 board with all other options set to their default value is:
ATTinyCore:avr:attinyx5:chip=45
You should also check the other menus to see whether a custom option is needed. If you don't specify an option then the default value shown in the arduino-cli board details output will be used.
Custom board options are specified in a comma separated list, so for example if you wanted set the "Clock Source" menu to "16 MHz (external)", you would use this FQBN:
ATTinyCore:avr:attinyx5:chip=45,clock=16external
Use the --programmer arduinoasisp flag in your arduino-cli upload command to specify the "Arduino as ISP" programmer be used for the upload.
You typed: chip=45 But, looking at the output of arduino-cli I would be inclined to type chip= ATtiny45 instead.
And same for clock settings: the board details specify among others 8 MHz (internal) so based on what you told me I am guessing it would become clock=8internal.
Lets say that I do not want to retain EEPROM. I have no clue what to type in as option.
How can I find out what the exact syntax is for the options?
And for the bonus .
I let a python script generate the build and upload scripts whenever I assemble a software project. The scripts lists all installed FQBN and you have to enter one of these FQBN in the program. The script also pickes the last listed com port. So if you plug in an arduino or whatever in the USB port when you run the script, it is likely that the upload script will end up with the correct COM port number.
Learning about all these options, I figured it would be nice addon to have a more interactive program which does the same thing only more user friendly in the form of yes and no questions of even a GUI with which you can (un)check boxes and use dropdown menus and such.
I am propably not the first person who thinks of this. So the bonus question: Is this wheel already invented by somebody?
"ATtiny45" is the human readable label for the option. But the FQBN is the machine readable name for the board, so we must use the machine identifier for the option, which is 45.
The narrow display width of the forum posts might make the ID hard to see. You must scroll the code block window over to the right to see it. It is probably easier to see in the terminal (you even get color there if supported).
That is correct. Note that this is the default selection for the clock menu, so it is not required for you to specify that in your FQBN, but you are welcome to do so if you don't feel comfortable relying on the defaults.
eesave=disable
Just look at the rightmost column of the arduino-cli board details output.
If you are curious to learn more about the custom board options system, the technical details are available in the Arduino Platform Specification:
But a user of Arduino CLI is not required to understand how these options are configured. That information is really only needed by the Arduino boards platform authors like DrAzzy.
Nice! You will likely find the --format json flag useful for that. This will cause the arduino-cli board details output to be in a machine readable JSON format that can easily be consumed by a Python script.
Well, it sort of sounds like the Arduino IDE. But I say go for it!
The narrow display width of the forum posts might make the ID hard to see. You must scroll the code block window over to the right to see it.
Yep, I had no clue the information was just sitting there
Well, it sort of sounds like the Arduino IDE.
Haha yes I agree, indeed it does. I am never fan of IDEs, they are ever inferior to dedicated code editors. I am a VS Code user myself. That is why I want dedicated upload and build script per project. Besides those I also have scripts to initialize git repositories and immediately push them to github.com. I have a script to make software releases. I add the date and time to the program every time when I compile. This gets printed to the monitor in setup. I recently added custom code-snippets. For every script there is a entry in tasks.json so I can do just about everything with the press on F6
As ATtiny user, it would be a nice addon for me to make the upload/build scripts more configurable.
Arduino really facilitated this sort of thing by moving all the non-GUI functionality out of the original location in the Java code base of the Arduino IDE and into a command line tool. This tool can then be used directly, by both versions of the Arduino IDE, by Arduino Web Editor, and by 3rd party tools such as the Arduino extension for VS Code Microsoft made.
Some years ago, I made extensive use of the classic Arduino IDE's command line interface in automated applications and it was a bit painful to be forced to use an application that was primarily intended to be a GUI in that manner. Arduino CLI has made that sort of thing so much easier to do.