How install attiny cores for arduino CLI

Pert,

I have a certain problem...

This command

arduino-cli core search attiny

gives this output

No platforms matching your search.

I did a core index update prior

I am going to need to program attiny chips, prefrably the attiny404 as those are memory/price-wise the winners.

What do I need to type in after

arduino-cli core search .....
[code]

I googled my behind off, but could not find the answer. 

Also for the bonus. I suppose I can use an arduino uno as ISP programmer right?

Can you help me out here?

Kind regards,

Bas

Hello @bask185.

By default, Arduino CLI only provides the cores for the boards in the primary package index (e.g., Arduino AVR Boards, Arduino SAMD Boards, etc.). This does not include a core that provides support for the ATtiny404. However, the amazing Arduino community has created many other cores that provide support for many other boards and microcontrollers. There is a very nice one for the ATtiny404:

3rd party cores are able to offer Boards Manager installation (arduino-cli core install) support by providing their own package index. When they do this, you only need to add the URL of that package index (which you will find in the core's installation instructions) to the board_manager.additional_urls key of your Arduino CLI configuration to get access to installation of that core via arduino-cli core install.

There are several ways of setting the board_manager.additional_urls configuration value, which you can learn about here and here, but I think the most convenient is a new feature added in Arduino CLI 0.14.0, so I'll give you the command for doing it using that method:

arduino-cli config add board_manager.additional_urls http://drazzy.com/package_drazzy.com_index.json
arduino-cli core install

After that, you will find the fabulous DrAzzy/SpenceKonde cores for the ATtiny parts listed when you do your search:

arduino-cli core search attiny
Updating index: package_index.json downloaded / 337.07 KiB   37.62%
Updating index: package_index.json.sig downloaded
Updating index: package_drazzy.com_index.json downloaded1 KiB    0.00%
ID                   Version                  Name
ATTinyCore:avr       1.4.1                    ATTinyCore
arduino-tiny-841:avr 1.0.7-deprecation-notice ATtiny Modern(deprecated, use ATTinyCore instead)
megaTinyCore:megaavr 2.2.3                    megaTinyCore

Now you can use the ID you found from the search to install megaTinyCore:

arduino-cli core install megaTinyCore:megaavr

After that, you'll find the FQBN of the ATtiny404 boards in the board listall results:

arduino-cli board listall 404
Board Name                                         FQBN
ATtiny1614/1604/814/804/414/404/214/204            megaTinyCore:megaavr:atxy4
ATtiny1614/1604/814/804/414/404/214/204 (Optiboot) megaTinyCore:megaavr:atxy4o

bask185:
I suppose I can use an arduino uno as ISP

For the ATtiny404, I don't believe this is possible. The reason is because this family of chips uses UPDI programming rather than ISP. But don't worry. DrAzzy has you covered with support and documentation in MegaTinyCore for making your own UPDI programmer:

Thank you for your answer.

This line does not work yet

arduino-cli config add board_manager.additional_urls http://drazzy.com/package_drazzy.com_index.json

I see that I am still using cli version 0.9.0. So I will update that first thing. I am seeing no update option in 0.9.0, so I suppose I have to replace arduino-cli.exe manually. The new version seems to have an update function, that is neat. :slight_smile:

I decided to upgrade to an attiny85 for my first batch of PCB's later I will most likely downgrade to a 13 instead. Saves me 50c per pcb.

Bas

bask185:
Thank you for your answer.

You're welcome.

bask185:
This line does not work yet

Yeah, as I said this feature was added in Arduino CLI 0.14.0.

bask185:
The new version seems to have an update function, that is neat.

Yes, but note this command is about updating the installed cores and libraries. It does not update Arduino CLI itself.

bask185:
I have to replace arduino-cli.exe manually.

There is an installation script, but it's a shell script, so only usable on Windows if you're using one of the Bash versions for Windows (e.g., Git Bash) or WSL.

bask185:
I decided to upgrade to an attiny85 for my first batch of PCB's

You'll have no problem using Arduino as ISP with the ATtiny85. Since this is the most popular ATtiny chip in the Arduino world, I think you'll find it to be the most well supported. DrAzzy/SpenceKonde also provides a nice core for this chip, so you can still follow the same instructions I provided above, but run the command arduino-cli core install ATTinyCore:avr to get the ATtiny85 support.

bask185:
I will most likely downgrade to a 13 instead.

For the ATtiny13, check out MicroCore:

Pert!

I found myself a new inconvenience. I finally updated arduino cli to version 0.14.0. At first I got terror because my command line tools would not find the arduino-cli.exe. after I properly altered the system path variables like last time. Eventually I copied the folder to program files as a hot fix. Got me cursing on Windows again :confused: .

I do can compile using the same build scripts but I am not going any hex files anymore. So I enabled the verbose flag to see what was going on.

echo "COMPILING"
arduino-cli.exe compile -b arduino:avr:nano ~/Documents/software/SAS -v
echo "UPLOADING"
arduino-cli.exe upload -b arduino:avr:nano:cpu=atmega328old -p COM3 -i ~/Documents/software/SAS/SAS.arduino.avr.nano.hex
#rm *.hex *.elf
exit

The output:

"C:\\Users\\Gebruiker\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF/SAS.ino.elf" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF\\sketch\\SAS.ino.cpp.o" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF\\sketch\\config.cpp.o" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF\\sketch\\input.cpp.o" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF\\sketch\\logic.cpp.o" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF\\sketch\\output.cpp.o" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF\\sketch\\teachIn.cpp.o" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF\\sketch\\src\\basics\\io.cpp.o" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF\\sketch\\src\\basics\\timers.cpp.o" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF\\sketch\\src\\modules\\debounceClass.cpp.o" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF/..\\arduino-core-cache\\core_arduino_avr_nano_f47c5a6e095339350fc9ad7d76448ee7.a" "-LC:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF" -lm
"C:\\Users\\Gebruiker\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF/SAS.ino.elf" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF/SAS.ino.eep"
"C:\\Users\\Gebruiker\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF/SAS.ino.elf" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF/SAS.ino.hex"
Using library EEPROM at version 2.0 in folder: C:\Users\Gebruiker\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\libraries\EEPROM 
"C:\\Users\\Gebruiker\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino-sketch-D054987ABE6378138B8444044ECCD3EF/SAS.ino.elf"

It is clear that I am getting hex files, but I get them in...

AppData\\Local\\Temp\\arduino-sketch.....

...this folder instead of my project folder. And with different names than I am used?

Is this perhaps a new bug feature? Do I need to alter all my build scripts now? Or can I configure arduino-cli to do what it used to do? I did replicate every step in the getting started guide.
I suppose I will install me some attiny cores in the meantime :wink:
Kind regards,
Bas

bask185:
Is this perhaps a new bug feature?

It is an intentional change:

bask185:
Do I need to alter all my build scripts now? Or can I configure arduino-cli to do what it used to do?

There are a couple options for how you can get the previous behavior. They are explained here:

If you have any problems or questions, please let me know.

I am still having problems, when I try to anything with arduino-cli I get

C:\Users\Gebruiker\AppData\Local\Arduino15\package_drazzy.com_index.json: open C:\Users\Gebruiker\AppData\Local\Arduino15\package_drazzy.com_index.json: The system cannot find the file specified

It happened after this step:

arduino-cli config add board_manager.additional_urls http://drazzy.com/package_drazzy.com_index.json

And it may be because I cannot execute this step:

arduino-cli core install

Because this one needs atleast 1 extra argument, and I do not know what to enter. From the help page
Also I have read the link you sent me, from what I understand I can use

--export-binaries

or -e flag to get what I want.
This part however I could not comprehend entirely
A related settings and env var has been added to avoid the need to always specify the

--export-binaries

flag:

sketch.always_export_binaries

and

ARDUINO_SKETCH_ALWAYS_EXPORT_BINARIES

I am not entirely sure what to do with this last two phrases. Can I look up arduino cli in program files -> right click -> properties and this

--export-binaries

behind the .exe?
Bas

New evening, new chances and new energy!

I manually downloaded the correct JSON file and put it in the spot in that strange hidden windows appdata folder where arduino-cli is looking for it. Now I can compile again. The -e flag is also working. Still have to alter my buildscripts though.

I have also succesfully installed cores for atleast the attiny85. That is if the command line output didn't lie to me ::slight_smile:

With some luck I may be able to program one this weekend. My lovely pcb design uses a soic attiny and has no program pins breakout. A soic clamp is on it's way for programming, but I am gonna do prototype X the hardway by soldering wires to the chip and than solder the PCB on it's final destination.

Thanks once again :wink:

Bas

I cheered too soon...

When trying to upload a sketch I get:

build/arduino.avr.nano/SAS.ino.hex: line 1: :100000000C9462000C945D030C9436030C948A00EB: command not found

And there are 260 more of these lines. In the build folder I have:
SAS.ino.eep
SAS.ino.elf
SAS.ino.hex
SAS.ino.with_bootloader.bin
SAS.ino.with_bootloader.hex
I altered my script to upload the 3r one. Using this command:

arduino-cli.exe upload -b arduino:avr:nano:cpu=atmega328old -p COM3 -i ~/Documents/software/SAS/build/arduino.avr.nano/SAS.ino.hex

I only altered the path, the rest remained the same.
Some months ago I tried the hex with the bootloader I bricked 2 Nano.
The IDE still can flash it, so this one is not bricked.. yet
What is it that I am doing wrong?
Bas

bask185:
A related settings and env var has been added to avoid the need to always specify the

--export-binaries

flag:

sketch.always_export_binaries

This is a key you can add to the arduino-cli.yaml configuration file for Arduino CLI. You can learn about the configuration file here:
https://arduino.github.io/arduino-cli/latest/configuration/

So if you wanted to avoid having to always use the -e flag in your arduino-cli commands, you could add these lines to your arduino-cli.yaml file:

sketch:
  always_export_binaries: true

bask185:
and

ARDUINO_SKETCH_ALWAYS_EXPORT_BINARIES

As explained at this section of the configuration documentation:
https://arduino.github.io/arduino-cli/latest/configuration/#environment-variables
any configuration key can also be set via an environment variable. So a third alternative to -e or sketch.always_export_binaries is setting the equivalent environment variable. On Windows cmd, that is done like this:

set ARDUINO_SKETCH_ALWAYS_EXPORT_BINARIES=true

bask185:
I am not entirely sure what to do with this last two phrases. Can I look up arduino cli in program files -> right click -> properties and this

--export-binaries

behind the .exe?

That will only work if you are executing Arduino CLI by clicking on that shortcut.

bask185:
When trying to upload a sketch I get:

build/arduino.avr.nano/SAS.ino.hex: line 1: :100000000C9462000C945D030C9436030C948A00EB: command not found

That is odd. I wasn't able to reproduce that. Please run the command with the -v flag added for verbose output and then paste the full output here.

If the text exceeds the forum's 9000 character limit, save it to a .txt file and post it as an attachment. If you click the "Reply" button here, you will see an "Attachments and other settings" link that will allow you to make the attachment.

Also, please tell me which shell you're using (e.g., cmd, PowerShell, Bash).

bask185:
Some months ago I tried the hex with the bootloader I bricked 2 Nano.

Interesting. That .hex file is intended to be used with an ISP programmer, but I wouldn't expect it to brick the board on a normal upload. You should be able to recover it by setting up one of your working Arduino boards as an "Arduino as ISP" programmer and then burning the bootloader. Even though I wouldn't expect a normal upload to be able to affect the bootloader, the burn bootloader process also erases the flash memory on the chip, so it gets it back to a fresh state. More information on that subject here:

I know to unbrick arduinos and burn new bootloaders via ICSP, I just haven't done it yet. I have like 30+ Nano's in reserve so the bricked ones still lie on my desk underneath my analog oscilloscope :slight_smile:

I will post the output of the compiler this evening.

I managed to fix all problems. I am however unsure how. I did something with the upload scripts. And all the sudden, it worked again.

I think I am al set up for now. All i need now is more components