Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24

On Sunday, in article
<j6d4l1d04mj3ctm28lqqacr5sgo2slj55i@xxxxxxx> keinanen@xxxxxx
"Paul Keinanen" wrote:

>On Sun, 16 Oct 2005 02:24:21 +0100 (BST),
>paul$ (Paul Carpenter) wrote:
>>Creating a custom printf is MUCH better than using a library function
>>many applications do not need
>> Floats
>> scientific of exponential notation
>> pointer printing
>> long modifiers
>> escape characters (form feed, line feed, bell)
>>Mnay only need single character or formatted strings with a byte or short
>>(signed/unsigned printing).

Forgot the one that is RARELY needed in embedded situations, and relying on
it, would mean a bad design anyway - printf returns the number of
characters output which I have not *yet* seen an application use.

>If the library sources are available, it should be easy to disable the
>floats etc.
>However, if the library sources are not available, but if the library
>object files have been divided intelligently, e.g. the actual printf
>function in printf.obj and the floating point printing routines in
>print_float.obj, it should be possible to create dummy_float.c
>containing e.g.
>void print_float (double d.....)
> return ;

Makes a lot of assumptions, works on one library, for better code reuse
for MINIMAL footprints, use a stripped down one for usability on more
compilers and targets.

>Put the dummy_float.obj on the linker command line _before_ the
>library files. When the linker detects the printf reference in he
>application program, it extracts the printf.obj from the library.
>Since that printf module contains a reference to print_float, the
>linker already knows where it is, since it has been provided by the
>dummy_float.obj and does not need to retrieve the print_float.obj from
>the library.

Assuming the library module for that function, is actually a separate
module whereby you can save space, otherwise you will have it *POTENTIALLY*
included but not used.

That solution is very compiler/linker/library dependant.

Paul Carpenter | paul@xxxxxxxxxxxxxxxxxxxxxxxxxxx
<> PC Services
<> GNU H8 & mailing list info
<> For those web sites you hate