Problems with F() macro

Hello,

I'm having some problems with F() macro, the problems came when I programmed more variables using PROGMEM modifier,

After this code works fine:

Serial.println(F("Test line"));

now the same code give this error when I compile my code:

error: __c causes a section type conflict

Best regards and thanks in advance.

Let's see your whole program otherwise it will be difficult to provide an answer and/or try it for ourselves.

UKHeliBob:
Let's see your whole program otherwise it will be difficult to provide an answer and/or try it for ourselves.

The whole program is 1380 lines.

The F() macro worked fine untill I entered lines like this:

char string_1[] PROGMEM = "hello world";

The whole program is 1380 lines.

We still need to see it.

PaulS:
We still need to see it.

Sorry but is not possible for me copy here the whole program, any idea?

xload:
now the same code give this error when I compile my code:

error: __c causes a section type conflict

The PROGMEM segment is limited to 64 kB size, even on an Arduino MEGA.

64 kB all together in your sketch, libraries that might use PROGMEM included.

Might it be possible that you are trying to use more than 64 kB of PROGMEM flash memory?

Sorry but is not possible for me copy here the whole program, any idea?

You could attach it to your post.

jurs:
The PROGMEM segment is limited to 64 kB size, even on an Arduino MEGA.

64 kB all together in your sketch, libraries that might use PROGMEM included.

Might it be possible that you are trying to use more than 64 kB of PROGMEM flash memory?

A lot of thanks jurs, the binary is 30.888 bytes, less than 64kB

UKHeliBob:
You could attach it to your post.

The problem is that the code is for a private work.

OK. That makes it more difficult.

So, shrink it down to more public type stuff that still shows the problem occurring.

It's up to you.

I tried this:

char string_1[] PROGMEM = "hello world";

void setup() {
  // put your setup code here, to run once:
  Serial.println(F("Test line"));
}

void loop() {
  // put your main code here, to run repeatedly:

}

and I got this error, as I expected:

sketch_jun17a:1: error: variable 'string_1' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

I added the required 'const' keyword and it verified without error:

const char string_1[] PROGMEM = "hello world";

void setup() {
  // put your setup code here, to run once:
  Serial.println(F("Test line"));
}

void loop() {
  // put your main code here, to run repeatedly:

}

Hi johnwasser

My PROGMEM code is like this:

char string_0[] PROGMEM = "String 0";
char string_1[] PROGMEM = "String 1";

PGM_P stringss[] PROGMEM =
{
string_0,
string_1,
};

Can be the const word the problem?

What happened when you added it?

LarryD:
http://www.arduino.cc/en/Reference/PROGMEM

What happened when you added it?

When I added it all lines that contain a F() macro, used for serial debug, returned me the
error: __c causes a section type conflict

What version of the IDE are you using ?

xload:
Sorry but is not possible for me copy here the whole program, any idea?

• Click Reply

• Click Attachments and other options

• Click Browse

• Locate and select the file

• Click OK / Open

• Click Post

• Click Reply

• Click Attachments and other options

• Click Browse

• Locate and select the file

• Click OK / Open

• Click Post

The problem is that the code is for a private work. #8

Top secrete :astonished:

UKHeliBob:
What version of the IDE are you using ?

IDE 1.0.6