''tool-avrdude'' error cannot build example ''Hello World'' code due to the tool failing

Dear Community,

I am currently tasked to program an ATtiny404. In order to test the connection I decided to start with an example code that I found in the following guide: Attiny (tinyAVR) series-0 and how to use their GPIO - Daumemo
I have followed the steps as described in the guide on my laptop and personal computer. However, on both machines when I try to build the code it always leads to the following errors:

Processing ATtiny404 (platform: atmelmegaavr; board: ATtiny404)

Verbose mode can be enabled via -v, --verbose option
KeyError: ‘tool-avrdude’:
File “C:\Users\blago.platformio\penv\lib\site-packages\platformio\builder\main.py”, line 187:
env.SConscript(“$BUILD_SCRIPT”)
File “C:\Users\blago.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Script\SConscript.py”, line 597:
return _SConscript(self.fs, *files, **subst_kw)
File “C:\Users\blago.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Script\SConscript.py”, line 285:
exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
File “C:\Users\blago.platformio\platforms\atmelmegaavr\builder\main.py”, line 77:
env.PioPlatform().get_package_dir(
File “C:\Users\blago.platformio\penv\lib\site-packages\platformio\platform_packages.py”, line 32:
pkg = self.get_package(name)
File “C:\Users\blago.platformio\penv\lib\site-packages\platformio\platform_packages.py”, line 29:
return self.pm.get_package(spec or self.get_package_spec(name))
File “C:\Users\blago.platformio\penv\lib\site-packages\platformio\platform_packages.py”, line 21:
owner=self.packages[name].get(“owner”),
============================================================================== [FAILED] Took 0.57 seconds =============================================================================

Could you please help me figure it out? Why the AVRDUDE is failing? I have previously used PlatformIO to program Arduino mega, uno and nano and never had an issue due to a tool during building a code. I do not have much experience programming and could not solve this issue for quite some time.

Best Regards,
Boyko

Seems like either a corrupted or missing package to me. Try and delete all C:\Users\blago\.platformio\packages\tool-avrdude* folders.

If there are none, trigger the execution by using the CLIpio pkg install -g -t "tool-avrdude"

1 Like

Dear maxgerhardt,

Thank you for your reply!
I tried deleting all folders that contained AVR in their name in C:\Users\blago.platformio\packages
After which I tried building again which lead to ‘‘toolchain-atmelavr’’ installment and same errors again.

Processing ATtiny404 (platform: atmelmegaavr; board: ATtiny404)

Tool Manager: Installing platformio/toolchain-atmelavr @ ~1.70300.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: toolchain-atmelavr@1.70300.191015 has been installed!
Verbose mode can be enabled via -v, --verbose option
KeyError: ‘tool-avrdude’:
File “C:\Users\blago.platformio\penv\lib\site-packages\platformio\builder\main.py”, line 187:
env.SConscript(“$BUILD_SCRIPT”)
File “C:\Users\blago.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Script\SConscript.py”, line 597:
return _SConscript(self.fs, *files, **subst_kw)
File “C:\Users\blago.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Script\SConscript.py”, line 285:
exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
File “C:\Users\blago.platformio\platforms\atmelmegaavr\builder\main.py”, line 77:
env.PioPlatform().get_package_dir(
File “C:\Users\blago.platformio\penv\lib\site-packages\platformio\platform_packages.py”, line 32:
pkg = self.get_package(name)
File “C:\Users\blago.platformio\penv\lib\site-packages\platformio\platform_packages.py”, line 29:
return self.pm.get_package(spec or self.get_package_spec(name))
File “C:\Users\blago.platformio\penv\lib\site-packages\platformio\platform_packages.py”, line 21:
owner=self.packages[name].get(“owner”),
============================================================================= [FAILED] Took 25.84 seconds =============================================================================

After that I tried installing ‘‘tool-avrdude’’ through the CLI:

PS C:\Users\blago\Documents\PlatformIO\Projects\ATtiny404_HelloWorld> pio pkg install -g -t “tool-avrdude”
Tool Manager: Installing tool-avrdude
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: tool-avrdude@1.70100.0 has been installed!

Then I tried building the project again which lead to the same errors as the ones shown above. Currently, in ‘‘C:\Users\blago.platformio\packages’’ I have 4 folders only
image

I do think that you are correct and I have some corrupted files. However, I am not sure how to completely remove AVRDUDE and reinstall it. Additionally, it is strange that I get these exact same errors on two different PCs.

Kind Regards,
Boyko

Very strange.

Please close VSCode,delete the whole C:\Users\blago\.platformio folder, then reopen VSCode. The PlatformIO extension will redownload the core and you try and build and upload your project again.

Dear maxgerhardt,

I just deleted the ‘’.platformio’’ folder and tried building the project again. Unfortunately, I still get the same errors. Additionally, a colleague of mine who works as embedded system engineer told me that I may have issues with python on my PC which I also reinstalled and checked if it is installed correctly and has a proper path in system environmental variables which I believe it does. That did not help either.

Kind Regards,
Boyko

Hmmm this might actually be a PlatformIO bug. The platform.json’s package declaration says

which is the tool-avrdude-megaavr package, not the tool-avrdude package. Yet the main.py references

You might be able to work-around this bug by creating a Board: Arduino Uno + Framework: Aruduino project with empty code first, upload that so that it triggers the installatin of tool-avrdude, then switch to your atmelmegaavr project again.

I’ve filed a report in

Or, more directly, use

platform = https://github.com/maxgerhardt/platform-atmelmegaavr.git

in your platformio.ini instead of the stable platform version, I have tried to create a fix for it via

1 Like

Dear Maximilian,

Thank you for your time and dedication. I did not manage to work around the issue with first uploading it to an Arduino but ‘‘platform = GitHub - maxgerhardt/platform-atmelmegaavr: Atmel megaAVR: development platform for PlatformIO’’ SOLVED my issue! Thank you very much for your help!

Best Regards,
Boyko

The PR

was also merged, so better use the official bleeding-edge again

platform = https://github.com/platformio/platform-atmelmegaavr.git