Compiler "error: {build.pwmflags}: No such file or directory" with Curiosity Nano ATtiny1607

Hi.
I just got hold of a Curiosity Nano ATtiny1607 and installed the megaTinyCore 2.6.10 in Arduino IDE 2.3.4.
I started with the BareMinimum sketch and selected "Official Microchip Board".
As board name I obviously use "Curiosity Nano ATtiny1607" but then the compiler throws up an error:
avr-g++: error: {build.pwmflags}: No such file or directory
exit status 1

I had a go at the various options with "BOD Mode when Active/Sleeping", "Clock", "millis()/micros() Timer" but it doesn't make any difference.
Choosing the wrong Curiosity board, ATtiny3217 or ATtiny1627, clears the error.
I'm confused.

Can anyone help?

Edit: may it be that something is not right in the command line invoking the compiler?
Is -DCORE_ATTACH_ALL {build.pwmflags} correct?
"C:\Users\MyUserName\AppData\Local\Arduino15\packages\DxCore\tools\avr-gcc\7.3.0-atmel3.6.1-azduino7b1/bin/avr-g++" -c -g -Os -Wall -std=gnu++17 -fpermissive -Wno-sized-deallocation -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mrelax -mmcu=attiny1607 -DF_CPU=20000000L -DCLOCK_SOURCE=0 -DTWI_MORS -DMILLIS_USE_TIMERA0 -DCORE_ATTACH_ALL {build.pwmflags} -DARDUINO=10607 -DARDUINO_AVR_CuriosityNano1607 -DARDUINO_ARCH_MEGAAVR "-DMEGATINYCORE="2.6.10"" -DMEGATINYCORE_MAJOR=2UL -DMEGATINYCORE_MINOR=6UL -DMEGATINYCORE_PATCH=10UL -DMEGATINYCORE_RELEASED=1 -DARDUINO_attinyxy7 -DLED_BUILTIN=PIN_PC4 -DPIN_BUTTON_BUILTIN=PIN_PB7 "-IC:\Users\MyUserName\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10\cores\megatinycore/api/deprecated" "-IC:\Users\MyUserName\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10\cores\megatinycore" "-IC:\Users\MyUserName\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10\variants\txy7" "C:\Users\MyUserName\AppData\Local\arduino\sketches\DE94AC95B7C88887B8B6741E420BD13A\sketch\BareMinimum.ino.cpp" -o "C:\Users\MyUserName\AppData\Local\arduino\sketches\DE94AC95B7C88887B8B6741E420BD13A\sketch\BareMinimum.ino.cpp.o"

Hi @logcge. This is caused by a bug in the megaTinyCore boards platform. The bug has already been fixed:

However, the fix was made after the time of the latest release, so this is why you still suffer from it when using the release version of the platform.

The bug that caused the error message you shared is trivial, and could be easily fixed by adding a single line to a configuration file for the megaTinyCore platform. However, I see that the developer made quite a few other changes and mentioned that there were "a number of gross problems". So I fear that if I only provided you with instructions for fixing the immediate bug, you might only run into another one. For this reason, I think the best way forward is to use the development version of the platform. The Arduino IDE Boards Manager only provides the release versions of the platform, so it is necessary to make a manual installation in order to use the development version. I'll provide instructions you can follow to do that:

  1. Start Arduino IDE if it is not already running.
  2. Select File > Preferences from the Arduino IDE menus.
    The "Preferences" dialog will open.
  3. Take note of the path shown in the "Sketchbook location" field of the "Preferences" dialog.
  4. Click the "CANCEL" button.
    The "Preferences" dialog will close.
  5. Select File > Quit from the Arduino IDE menus.
  6. Create a folder named hardware under the folder at the path that was shown in the "Sketchbook location" field of the IDE preferences.
  7. Click the link below to open the GitHub repository of the "megaTinyCore" platform in your web browser:
    https://github.com/SpenceKonde/megaTinyCore
  8. Click the "Code ▾" button you see on that page.
  9. Select Download ZIP from the menu.
    A download of the ZIP file of the platform will start.
  10. Wait for the download to finish.
  11. Extract the downloaded file.
  12. Copy the extracted megaTinyCore-master folder to the hardware folder you created at step (8) of the instructions.

The final folder structure must have this form:

<sketchbook location>/
├── hardware/
│   └── megaTinyCore-master/
│       └── megaavr/
│           ├── boards.txt
│           ...
...

(where <sketchbook location> is the path that was shown in the "Sketchbook location" field of the IDE preferences)

Now start Arduino IDE. You should see a "megaTinyCore (in Sketchbook) (megaTinyCore-master)" item under the Tools > Board menu in addition to the previously existing "megaTinyCore" menu item. When you select a board from the Tools > Board > megaTinyCore (in Sketchbook) (megaTinyCore-master) menu, the manually installed development version of the platform will be used. When you select a board from the Tools > Board > megaTinyCore menu, the Boards Manager installed release version of the platform will be used.

Select the Tools > Board > megaTinyCore (in Sketchbook) (megaTinyCore-master) > Official Microchp Board from the Arduino IDE menus, and then Tools > Board Name > Curiosity Nano ATtiny1607. Check to make sure you have the desired selections from all the other submenus under the Tools menu (the menu selections you make when you have the board from the release version of the platform installed don't affect the menu selections for the board from the development version). Now try compiling or uploading your sketch again. Hopefully this time everything will work as expected.


:exclamation: Even if you aren't going to use it anymore, do not uninstall the release version of megaTinyCore. The reason is that the manual installation is relying on the toolchain that is installed for the release version, and if you uninstall the release version then its tools will also be uninstalled.


2 Likes

Thank you very much!
I followed the detailed instruction and compilation is now working.
I understand that the ATtiny on the Curiosity Nano cannot be programmed by the IDE directly and instead one needs to export the compiled binary. I just tried to drop the .hex on the drive of the Curiosity but I'm not sure it's working. That's for another question anyway.

You are welcome. I'm glad the compilation is working now.

Regards, Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.