Program no longer compiles

I updated my arduino software and suddenly my program no longer compiles.

First error:

I declared a bunch of char arrays (for the speech engine) in progmem. It said I have to declare them all as const. Ok fine

Second error:

After that, now it doesn't like the say() method because apparently that function takes arguments that are NOT const. So now I have to cast everything in a say() method back to unsigned char. Ok... done.

Third error:

Now it won't compile because it's whining about loss of precision. It didn't report this as a problem until AFTER i'd cast all 100 or so instances of the second error. Nice. Anyway I stopped here because I dunno how deep this error tree goes and the thing was working fine until I updated my software.

My questions are:

1) Why is this new version breaking my programs?

2) How can I fix this loss of precision issue? It doesn't like that I converted a const unsigned char back to unsigned char. How can I do this cast without causing the loss of precision error?

Thanks.

Use the old version of the IDE, wait for 2 years then try to upgrade again.

.

What happens in 2 years?

Also which IDE version is recommended?

I use 1.06, but I am trying out 1.69

So far 1.69 has worked on all my old sketches (with few changes).

IMO the only reason for me to use 1.69 is the interface allows scrolling which is nice as 1.06 does not show everything that is there.

What happens in 2 years?
Maybe all the kinks will be worked out. :wink:

All this said 1.06 is still fine for everything that I do.

Some here use 1.65 with no problems.

2016-06-19_21-59-38.png
.

What is the exact text of the error? Where is the code?

The compiler was updated in 1.6.x, and it is no longer valid to declare something in progmem without declaring it const - this isn't Arduino. It's the avr-gcc compiler (the new version also supports more parts and produces smaller binaries). The board manager features in 1.6.x are really nice if you use third party hardware definitions.

You neglected to tell us which speech engine you're using. Do you mean the "Talkie" library? (I can get that one working, in IDE V1.6.5 at least.)

That’s correct, it’s talkie. I didn’t do anything but uncomment the stuff I needed at the top, which was fine in the old IDE.

Gahhhrrrlic: First error: I declared a bunch of char arrays (for the speech engine) in progmem. It said I have to declare them all as const. Ok fine

Second error: After that, now it doesn't like the say() method because apparently that function takes arguments that are NOT const. So now I have to cast everything in a say() method back to unsigned char. Ok... done.

I'm pretty sure that the 'const' is not your problem. If you put the data in PROGMEM and pass a pointer to it to say() then say() is going to assume that the data is in SRAM and fetch from the wrong address space. There are two ways to 'fix' the problem: 1: Copy the data into an SRAM buffer before passing the buffer to say(). Since the buffer is not 'const' and is in SRAM it should work fine. or 2: Make a modified version of say() (call it say_p()) that takes a const byte pointer and knows enough to fetch the bytes directly from PROGMEM.

When I tested out the “Talkie” library, I had to make changes to make it work too. I tested with the “Tom’s Diner” song.

I declared the data array like this:-

const uint8_t spDINER[] PROGMEM = {0x0A, 0x28, 0xA5, /* Lots more data here */ , 0x00, 0xC0, 0x03};

Then you need to cast to a pointer to ‘say()’:-
(Cast away the ‘const’.)

voice.say((uint8_t*)spDINER);

I’ve attached the full modified “Tom’s Diner” sketch below, (zipped up), in case you want to test it before making mods to your code.

It works fine when compiling for an UNO, with IDE V1.6.5.

There’s no need to copy any data to SRAM first, or to make a modified version of ‘say()’. (In IDE V1.6.5, at least.)

Talkie_Toms_Diner.zip (39.5 KB)