[comp.lang.c] C compiler for Intel 8051

hank@moogvax.UUCP (04/01/87)

Does anyone have any experience and/or info on C compilers for the Intel 8051
microcontroller. Preferably it should be MS-DOS based and be compatible with 
Intel's ICE.

					Thanks a lot,
				
					Hank

farren@hoptoad.UUCP (04/04/87)

In article <569@moogvax.UUCP> hank@moogvax.UUCP (Hank Kowal) writes:
>
>Does anyone have any experience and/or info on C compilers for the Intel 8051
>microcontroller. Preferably it should be MS-DOS based and be compatible with 
>Intel's ICE.

Haven't seen one, and I don't believe that such a beastie exists, or should.
First, C compilers for 8-bit machines tend to be highly inefficient (very
difficult to do pointers if you're limited to 8 bit registers!).  Second,
the extremely limited stack space in an 8051 would make a C implementation
wierd, to say the least.  Third, you'd lose a lot of what makes the 8051 so
attractive; there's no clean way to implement things like the seperate data and
code space, bit-addressable memory, register banks, multipurpose i/o, and
interrupts.

  Why not become a human C compiler?  Work in C (or pseudo-C) and then trans-
late into assembler.  Better still, bite the bullet and work in assembler to
start with.


-- 
----------------
                 "... if the church put in half the time on covetousness
Mike Farren      that it does on lust, this would be a better world ..."
hoptoad!farren       Garrison Keillor, "Lake Wobegon Days"

gemini@homxb.UUCP (04/05/87)

In article <1955@hoptoad.uucp>, farren@hoptoad.uucp (Mike Farren) writes:
> In article <569@moogvax.UUCP> hank@moogvax.UUCP (Hank Kowal) writes:
> >
> >Does anyone have any experience and/or info on C compilers for the Intel 8051
> >microcontroller. Preferably it should be MS-DOS based and be compatible with 
> >Intel's ICE.
> 
> Haven't seen one, and I don't believe that such a beastie exists, or should.

But there are several, and you are right, they shouldn't exist.  The
Archimedes 8051 compiler comes closest to being C, but not full C.
Unless your application doesn't care how slow or large the code is, you
don't want to even think of using these compilers, at least not until
they provide an option to define 'int' as 8 bits.  It takes the compiler
on the order of 20 instructions just to do:
	++i;
if you optimize for speed (hah!).  Optimizing for space turns the 20
instructions into about 10, with several function calls!  Everything
gets done in 16 bit arithmetic, which the 8051 doesn't have.

None of them would compile the Dhrystone benchmark.  One of the ones
we tried couldn't hack that much 'C', and one couldn't
tolerate more than a handful of locals (guess where locals are stored
in the 8051!).

If you are still interested, I could get you names, numbers, and prices.
Send mail to:
	ihnp4!polux!rer
which is where I'll be when I have easy access to the info.

Rick Richardson, PC Research, Inc: (201) 922-1134  ..!ihnp4!castor!pcrat!rick
	         when at AT&T-CPL: (201) 834-1378  ..!ihnp4!castor!polux!rer