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 printf optimisation ?


From: Weddington, Eric
Subject: RE: [avr-gcc-list] avr-gcc printf optimisation ?
Date: Tue, 16 Dec 2008 13:34:26 -0700

 

> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of Anton Erasmus
> Sent: Tuesday, December 16, 2008 1:25 PM
> To: address@hidden
> Subject: [avr-gcc-list] avr-gcc printf optimisation ?
> 
> Hi,
> 
> I notice that gcc replaces printf with puts if the argument 
> is a simple string
> which ends in "\r\n". Is there way one can disable this 
> optimisation ? I use a
> macro which replaces printf(<format string>, ...)  with 
> printf(PSTR(<format string>), ...).
> i.e. puts the format string in flash. Unfortunately when 
> printf is replaced with puts, the format 
> string ends up in RAM in stead of in flash. 
> 

Hi Anton,

Aren't you suppose to be using printf_P() when the format string is in flash? 
Like so?:
printf_P(PSTR(<format string>, ...);

Does the printf_P function get optimized the same way as printf?




reply via email to

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