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

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

RE: [avr-gcc-list] AVR-GCC question


From: Matt.VanDeWerken
Subject: RE: [avr-gcc-list] AVR-GCC question
Date: Mon, 23 May 2005 10:21:24 +1000

Hi James:

I've just recently struck this issue in my project, although I didn't
need to port any existing code, so it was a lot less painfull than your
endeavour.

Anyway, here's what I did (thanks to Peter Fleury who gave me the idea
in his excellent uart library):

In a header file, probably in your uart header, put the following:

#ifdef __AVR_GCC__
#define puts_P(x) puts_p(PSTR(x))
#else
#define puts_P(x) puts_p(x)
#endif

Now, change all the existing calls to puts with puts_P. This will stop
all the string copying from happening at startup.

You also have to write puts_P, which is pretty straightforward.

Cheers,
Matthew van de Werken - Electronics Engineer
CSIRO E&M - Mining Geoscience - 1 Technology Court - Pullenvale - 4069
p: (07) 3327 4142 * f: (07) 3327 4455 * e: address@hidden
"Pressure, I'll tell you what pressure is. Pressure is a Messerschmitt 
up your arse, playing cricket is not" 
- Cricketer and WWII Fighter Pilot Keith Miller (1919-2004)

-----Original Message-----
From: address@hidden
[mailto:address@hidden On
Behalf Of James A. Kinnard
Sent: Friday, 20 May 2005 9:24 AM
To: address@hidden
Subject: [avr-gcc-list] AVR-GCC question


I first want to say thanks to all those on this list who have
contributed to the development of AVR-GCC.  You've done a fine job.

My question is related to the dreaded "Strings in Flash" issue.  I have
read all of the documentation and most of the postings on this list and
I understand the published techniques available for handling this issue.
My situation is this: I am porting an existing application (written for
the ImageCraft compiler) which has several HUNDRED string literals
("MyString") which are largely defined on-the-fly as function arguments.
ImageCraft has a global compiler option to place these strings in FLASH,
as I'm guessing that IAR does as well from the postings I've read.  The
best option that it seems I have to port this application using AVR-GCC
is to use the PSTR(s) macro around EACH of these string literals in
order to force the compiler to place them into FLASH and ONLY FLASH.  I
can define a null PSTR(s) to maintain backward compatibility with
ImageCraft, which I must have.  Is this the best option I have or is
there something in the documentation I have missed?

Is there a plan to add the 'global string literals in FLASH' option to a
future release of AVR-GCC?

Thanks in advance!

James Kinnard
Adaptive Solutions



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




reply via email to

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