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



In article <43515ad8$0$6777$9b4e6d93@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
Andreas Schwarz <usenet@xxxxxxxxxxxxx> writes
>Ian Bell schrieb:
>> Andreas Schwarz wrote:
>>
>>
>>
>>>Printf was only an example, the same applies to strcmp, puts, and many
>>>more, not to mention your own functions that operate on constant arrays.
>>>And besides, I don't think there's anything wrong with using printf on 8
>>>bit controllers. It makes serial debugging, LCD usage and things like
>>>that much more comfortable, and the additional 2-3 kB scarcely matter.
>>
>>
>> LOL, that 2-3K makes a huge difference in products with 16K ROM or less and
>> there are very many of those.
>
>Optimization (writing a specialized function instead of using one from
>the library is nothing but optimization) is done when necessary, and no
>sooner. If your program with printf & Co. is 14k large and you target a
>16k microcontroller, replacing standard functions with specialized code
>will gain you absolutely nothing, but takes time, is error-prone, makes
>your code larger and hurts maintainability.

This is absolute rubbish. A simple function to put a character or two
out to a serial line will only be a few bytes long.

As printf has to use this functionality to address the hardware, and you
may want to re-direct printf, it is often made available in source form
in the library. All you have to do is get the routine. Typically it is
only 4-5 lines of C.

Or you could do it yourself but if writing a SIMPLE function like this
"takes time, is error prone" should you be programming embedded systems
at all?

It will make you code 2-3K smaller and does NOT hurt maintainability at
all. IT gains you a lot as it makes the test outputting smaller and
faster so it distorts the memory map less than printf and changes the
time by a lot less.


--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ chris@xxxxxxxxxxxx www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



.