On Mon, Mar 16, 2009 at 11:00 AM, Robert von Knobloch <b...@engelking.de> 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


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to