Attinycore compiler warnings

I have a program for an Attiny1634 using SpenceKonde's Attinycore - works great.

I have been using IDE 1.6.3 to compile my programs without any problems - except that it gives rise to a Java warning.

When I tried using the newer 1.8.6 (to avoid the Java warning) with the same program I get a large list of compiler warnings similar to this

...../MyProgs/Arduino/hardware/ATTinyCore/avr/cores/tinymodern/pins_arduino.c:66:2: warning: initialization makes integer from pointer without a cast
  &DDRA,
  ^

I presume as they are only warnings the code will work fine but I am concerned that the warnings might become errors in a future version of the compiler.

OR, am I the only person seeing these warnings?

...R

Are you using the latest version of my core? I think that is this issue: Find way to get rid of compiler warnings · Issue #76 · SpenceKonde/ATTinyCore · GitHub

Which was fixed over a year ago. You should update to the latest version, 1.2.1 (it looks like you're using 1.1.3 or earlier). You'll get rid of the warnings, plus some new features:

Unified Wire and SPI library allowing use of SPI and I2C functionality on all boards without modifying libraries or using special libraries - you just include Wire.h or SPI.h like you would on a normal Arduino, and it "Just Works" (though there are still a few kinks being worked out) (you may already have this - but if you do, it's missing a big batch of bugfixes)

Optiboot now uses EE_RDY instead of WDT vector, so you can use WDT in interrupt mode with the bootloader.

Optiboot bootloaders for 45/85, 461/861, 48/88, 44/84 using soft UART on the same pins as the builtin software serial "Serial".

Improved granularity in menus.

Oodles of bugfixes.

DrAzzy:
Are you using the latest version of my core?

Much appreciated. I will check that out - but probably tomorrow.

...R

I downloaded the ZIP file from GitHub - SpenceKonde/ATTinyCore: Arduino core for ATtiny 1634, 828, x313, x4, x41, x5, x61, x7 and x8<, extracted it and copied it into my hardware folder

When I try to compile with it I get this error message and no compiling gets done.

avr-g++: error: {ltocppflags}: No such file or directory

In case it matters I am using Linux Mint

Just out of curiosity, how can I check the version of your Attiny core?

...R

Robin2:
When I try to compile with it I get this error message and no compiling gets done.

avr-g++: error: {ltocppflags}: No such file or directory

I can't reproduce that. {ltocppflags} is defined in boards.txt depending on your Tools > LTO(1.6.11+ only) menu selection, then used in platform.txt to set the appropriate compiler flags. This is the error we would expect if that property was not defined in boards.txt. I wonder if you might have installed your original outdated version of ATTinyCore via Boards Manager and never uninstalled it before doing the manual installation of the new version. It's possible that could create a situation where the boards.txt from the old version is used with the platform.txt of the new version.

Robin2:
Just out of curiosity, how can I check the version of your Attiny core?

There is typically a version property in platform.txt:

version=1.2.2

However, I don't think the Arduino IDE actually uses that for anything and I've definitely seen other hardware package authors forget to update it so it's not guaranteed to be correct.

If you just went straight to the homepage and downloaded ATTinyCore via GitHub's Clone or download > Download ZIP today then you are essentially using 1.2.2-beta. If you downloaded from the Releases page then it depends on which release you downloaded from.

If you do a Boards Manager installation, you will find the version at Tools > Board > Boards Manager. That is determined by the version specified in their Boards Manager JSON file. Still not guaranteed to match the Git tag version number, but it is less likely to simply be forgotten since a new entry needs to be created in the JSON file for every release.

Thanks. I had not noticed the “releases” page. I will try 1.2.1

I never installed the core with library manager.

I will have a look in boards.txt. I presume it would only “find” the problem in a boards.txt file relevant to the Attiny1634 that I am compiling for? I have other boards.txt files for other MCUs that I created myself and which may not be perfect.

…R

Robin2:
Thanks. I had not noticed the "releases" page. I will try 1.2.1

It's probably best to use a release version when you're having problems. Using the tip version is generally done for beta testing purposes. There is a tricky thing about the release versions of ATTinyCore. They are set up for Boards Manager installation, which requires a different folder structure (no architecture folder). If you're set on manual installation, you can create the avr folder and then move everything into it. However, I think Boards Manager installation makes the whole process much easier. As a bonus, the Arduino IDE will notify you when there is a new release (assuming you have turned on File > Preferences > Check for updates on startup).

Robin2:
I will have a look in boards.txt. I presume it would only "find" the problem in a boards.txt file relevant to the Attiny1634 that I am compiling for?

Correct. There are actually two different ATtiny1634 boards: ATtiny1634 (No bootloader) and ATtiny1634 (Optiboot)
ltocppflags is defined in the menu.LTO section. For example:

attiny1634.menu.LTO.disable=Disabled
attiny1634.menu.LTO.disable.ltocflags=
attiny1634.menu.LTO.disable.ltoelfflags=
attiny1634.menu.LTO.disable.ltocppflags=
attiny1634.menu.LTO.disable.ltoarcmd=
attiny1634.menu.LTO.enable=Enabled
attiny1634.menu.LTO.enable.ltocflags=-flto -fno-fat-lto-objects
attiny1634.menu.LTO.enable.ltoelfflags=-g -flto -fuse-linker-plugin
attiny1634.menu.LTO.enable.ltocppflags=-flto
attiny1634.menu.LTO.enable.ltoarcmd=gcc-

pert:
If you're set on manual installation, you can create the avr folder and then move everything into it.

Thanks. I did that. I never use the IDE

That LTO stuff made me wonder if I need some extra detail in my call to the command line. When I added ,LTO=disable to my command line it compiled without an error. (Not sure what that means, but it seems to work).

Again, many thanks.

...R

Robin2:
Thanks. I did that. I never use the IDE

You can do Boards Manager installation via the command line if you like. But with this sort of hardware package it’s easy enough to do a manual installation. The only real downside is the added difficulty determining versions. And if you want to do beta testing that’s the only option anyway. I’m sure DrAzzy would welcome more people doing beta testing.

Robin2:
That LTO stuff made me wonder if I need some extra detail in my call to the command line. When I added ,LTO=disable to my command line it compiled without an error. (Not sure what that means, but it seems to work).

I didn’t think of it until you said that about not using the IDE and then I had an “ah ha” moment. This sort of error can be caused by not specifying the full FQBN of the board in CLI commands. So you want something like this:

ATTinyCore:avr:attiny1634:LTO=enable,clock=8internal,eesave=aenable,bod=1v8,bodact=disabled,bodpd=disabled

Maybe the LTO option didn’t exist with the old ATTinyCore version you were using and so when you updated to the new version the old FQBN stopped working.

One of the Arduino developers just fixed arduino-cli so that it will use the default option when the option is not specified in the FQBN:

but that could take a while to make it into a production release since arduino-cli is still a work in progress.

Thanks for helping out with the debugging here pert. I haven't done much with the arduino cli, so I wasn't aware of this as a potential issue

LTO=enable should also work assuming you have a recent version of the AVR board package (and hence the compiler) installed, and will make the sketch smaller - which is a real boon on the attiny's with their limited flash. Likely you were using a very old version of my core that didn't have LTO support yet.