[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] [Fwd: Re: Strings in ROM]
From: |
Andy Warner |
Subject: |
Re: [avr-gcc-list] [Fwd: Re: Strings in ROM] |
Date: |
Mon, 16 Mar 2009 12:04:45 -0500 |
On Mon, Mar 16, 2009 at 11:00 AM, Robert von Knobloch <address@hidden> wrote:
> [...]
> What really had me confused is something that I consider may be be a bug.
> If I define a string (OK - array of char, but colloquially string) in a
> defined section:
> e.g.
> SECTION1 char mystring[] = "This is a string";
>
> then this will be stored and used correctly only if no function appears
> in the same section.
> BUT
> if a function is placed in the same section:
> e.g.
> extern char mystring[];
> SECTION1 void myfunc(void)
> {
> some function;
> };
> SECTION1 char mystring[] = "This is a string";
>
> Then the compiler complains "mystring causes a section type conflict".
> I postulate that this could be an error if mystring were deemed to be in
> ram and should then be initialised from flash, as the function may get
> in the way of the initialisation loop.
I think this is the linker complaining that you're jamming text and data
into the same section.
I would think there is a way of forcing the string to be viewed as
text, thereby making the linker happy and it's all in flash, so the
string access functions shouldn't care - at least as long as you
avoid near/far problems.
--
Andy