Re: CC to small CPU still doesn't work?

dhansen@btree.com (Dave Hansen)
9 Nov 1999 01:42:03 -0500

          From comp.compilers

Related articles
CC to small CPU still doesn't work? ppaatt@aol.com (1999-11-05)
Re: CC to small CPU still doesn't work? raugfer@uol.com.br (Rodrigo Augusto B. Ferreira) (1999-11-09)
Re: CC to small CPU still doesn't work? dhansen@btree.com (1999-11-09)
Re: CC to small CPU still doesn't work? albaugh@agames.com (1999-11-09)
Re: CC to small CPU still doesn't work? htak@eskimo.com (1999-11-09)
| List of all articles for this month |
From: dhansen@btree.com (Dave Hansen)
Newsgroups: comp.compilers
Date: 9 Nov 1999 01:42:03 -0500
Organization: B-Tree Systems, Inc.
References: 99-11-035
Keywords: C, architecture

On 5 Nov 1999 01:31:33 -0500, in comp.compilers you wrote:


>Am I correct to think the world still lacks a C compiler that can
>effectively target a CPU existing on just x100 bytes of Ram?


Depending on your definition of C, you're probably wrong. There are
several good C compilers for (e.g.) the 8051 family of
microcontrollers. If you can live with all your data in one space
(i.e., all directly accessed in the first 128 bytes, all indirectly
accessed in the first 256 bytes, or all indirectly accessed in the
external data space), you can get quite close to ANSI conforming code.
If ANSI is less important, you can exploit all the capabilities of the
architecture, including direct operations on bits (e.g., EA = 1; will
enable interrupts with with a SETB instruction on all the compilers
I'm familiar with).


There are still incompatibilities, however. Things like non-standard
reserved words (e.g., data, idata, xdata, code), the fact that
functions cannot be made reentrant without a special keyword,
deficiencies in the floating-point support. But I've been able to
port (for example) a 16-bit CCITT CRC calculation routine from an
80186 to an 87C51 with only one small change (the name of a formal
parameter in one of the functions was "data." Oh well...)


The compilers I've used don't pass parameters on the stack (by default
-- you can force this behavior for reentrant functions). Rather, they
perform a call-tree analysis and overlay the parameters of functions
in different branches of the tree into static memory locations. Works
pretty slick...


Commercial vendors I'm aware of include Keil, IAR, Franklin,
Archimedes, and I'm sure there are many others.


There's also a freeware effort called SDCC at
http://www.geocities.com/ResearchTriangle/Forum/1353/


Regards,


                                                    -=Dave
Just my (10-010) cents


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.