C for embedded controllers (was Re: Timed mechanical fuel injection )
John S Gwynne
jsg
Wed Nov 22 07:25:21 GMT 1995
--------
In message <199511220503.XAA06506 at net.dris.com> , you write:
| going to market it. It continually is improving, and I agree with Larry,
| use machine language. Although something like C is easier to program,
| machine code is more direct to the point, requires less memory, and the
| hardware often can be made simpler. My fuel injection system uses one HC11,
ok, I don't want to start a debate nor a flame war on this, but some of
the advantages of *not* using assembly should also be discussed
(again?).
| C is easier to program
Absolutely. From conception to the final debugged program, assembly
language takes me at least 4 times longer to develope for *small*
programs (YMMV, the ratio is worse for RISC). Once you get used to
using a high level debugger, like gdb, its very hard to revert back
(and unnecessary) to a low level monitor. RTOS, math libraries, and
other software tools are much more available for C (gnu bin-utilities,
gcc, gdb, newlib, glibc, RTEMS,... are examples currently ported to
efi332. Programming efi332 is *no* different than programming under any
unix system. I've often ran the same program on an SGI workstation,
linux PC, and efi332 *without* any modifications.).
| machine code is more direct to the point
I don't understand this comment... do not the two programs (C vs
assembly) do the same thing?
| requires less memory
True, but maybe only by 10-20% with a good optimizing C compiler (gcc
for the 68k is a good example. Optimization is cpu dependent.). With
larger programs it is conceivable the C will be smaller since it
generally promotes better structure. The archive has examples
comparing assembly to C for the 68000 (efi68k).
| hardware often can be made simpler
This is nonsense. Remember, assembly can easily be placed in-line
within any C code. Functionally there can be no difference. Execution
maybe slightly slower for C in general, but time critical routines can
be written in assembly.
John S Gwynne
Gwynne.1 at osu.edu
_______________________________________________________________________________
T h e O h i o - S t a t e U n i v e r s i t y
ElectroScience Laboratory, 1320 Kinnear Road, Columbus, Ohio 43212, USA
Telephone: (614) 292-7981 * Fax: (614) 292-7297
-------------------------------------------------------------------------------
More information about the Diy_efi
mailing list