avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] [Fwd: Re: Strings in ROM]


From: Robert von Knobloch
Subject: [avr-gcc-list] [Fwd: Re: Strings in ROM]
Date: Mon, 16 Mar 2009 17:00:10 +0100
User-agent: Thunderbird 1.5.0.14 (X11/20060911)

I hope this doesn't appear twice, it bounced although the address appears ok.

Thanks for your input Stu and Eric.

I have solved the problem by creating separate sections for the strings.
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.
In this case, however, the string is stored directly in flash and also
used directly from flash:
e.g.
    test_lcd_2(press_button);
    2f58:    80 e8           ldi    r24, 0x80    ; 128
    2f5a:    96 e3           ldi    r25, 0x36    ; 54
    2f5c:    0e 94 80 7f     call    0xff00    ; 0xff00 <test_lcd_2>

Where =x3680 is the flash address of my string and 0xff00 my routine to
print to an lcd display.

Apart from this I have solved my problem (although with a much more
fragmented memory map than I wanted) and would like to thank you both
for your help.

Robert







reply via email to

[Prev in Thread] Current Thread [Next in Thread]