Specifications
CAVR-4
88
Input and output
AVR® IAR C/C++ Compiler
Reference Guide
_medium_write
The _medium_write formatter has the same functions as _formatted_write, except
that floating-point numbers are not supported. Any attempt to use a
%f, %g, %G, %e, or
%E specifier will produce a runtime error:
FLOATS? wrong formatter installed!
_medium_write
is considerably smaller than _formatted_write.
_small_write
The _small_write formatter works in the same way as _medium_write, except that
it supports only the %%, %d, %o, %c, %s, and %x specifiers for integer objects, and does
not support field width or precision arguments. The size of
_small_write is 10–15%
that of _formatted_write.
Specifying the printf formatter in IAR Embedded Workbench
1
Choose Project>Options and select the General Options category. Click the Library
options tab.
2 Select the appropriate Printf formatter option, which can be either Small, Medium,
or Large.
Specifying the printf formatter from the command line
To use the _small_write or _medium_write formatter, add the corresponding line in
the linker command file:
-e_small_write=_formatted_write
or
-e_medium_write=_formatted_write
To use the full version, remove the line.
Customizing printf
For many embedded applications, sprintf is not required, and even printf with
_small_write provides more facilities than are justified, considering the amount of
memory it consumes. Alternatively, a custom output routine may be required to support
particular formatting needs or non-standard output devices.
For such applications, a much reduced version of the
printf function (without
sprintf) is supplied in source form in the file intwri.c. This file can be modified to
meet your requirements, and the compiled module inserted into the library in place of
the original file; see Overriding library modules, page 61.