Re: Microcontroller Compilers (C) (Neil Johnson)
15 Feb 2001 00:34:18 -0500

          From comp.compilers

Related articles
Microcontroller Compilers (C) (2001-02-12)
Re: Microcontroller Compilers (C) (Jan Gray) (2001-02-15)
Re: Microcontroller Compilers (C) (Klaus Rotter) (2001-02-15)
Re: Microcontroller Compilers (C) (2001-02-15)
Re: Microcontroller Compilers (C) (Kyle) (2001-02-15)
Re: Microcontroller Compilers (C) (2001-02-15)
Re: Microcontroller Compilers (C) (Preston Gurd) (2001-02-15)
Re: Microcontroller Compilers (C) (QarnoS) (2001-02-15)
Re: Microcontroller Compilers (C) (2001-02-15)
Re: Microcontroller Compilers (C) (2001-02-17)
[4 later articles]
| List of all articles for this month |

From: (Neil Johnson)
Newsgroups: comp.compilers
Date: 15 Feb 2001 00:34:18 -0500
Organization: University of Cambridge, England
References: 01-02-046
Keywords: C
Posted-Date: 15 Feb 2001 00:34:15 EST

>I work in a group that has several microcontrollers (ISAs) specified or
>being specified. Yet, we don't have a compiler yet.

Interesting -- are these processors described by a high-level
description, which is then used to generate the processor (a bit like
the ARC cores, or various other projects that can be found on the
net), or are they all handcrafted?

>I've been looking at GCC (Using and Porting the GNU Compiler Collection)
>and LCC. However, it seems that neither of these compilers is well adapted
>to 8- or 16-bit microcontrollers. GCC has only two 16-bit machine definition
>files (PDP11 and dsp16xx) and LCC has none.

A couple of years ago (sheesh ... time flies!!) I wrote an Intel 186
(16-bit) backend code generator for LCC, based a bit on the 386. It's
not that difficult to do it in LCC, helped a great deal by the fact
that it is described in pretty good detail in the Fraser/Hansen book.

BTW, I'm now using LCC as a C front end for my compiler research too.

>What would people recommend for the fastest way to get a prototype compiler
>working? GCC or LCC? Another compiler with a portable backend?

Depends on you, really. I liked LCC because it is quite simple
(which, IMHO, is actually a GOOD thing) but doesn't try to do anything
fancy, like aggressive code optimization. GCC, on the other hand, is
big and powerful, with industrial-grade optimizers, built-in support
for all manner of processors. You may thrive on complexity.

I know one guy who rattled off a backend for GCC one afternoon for a
hypothetical bytecode processor, just to see what size code it might
produce. So it can be used for quick jobs if the way it works fits
into your head.

Also, _both_ LCC and GCC have 8-bit ports. The ImageCraft C compilers
for the Motorola HC12 microcontrollers are based on LCC. And there is
(I think) a GCC port for the Atmel AVR microcontrollers. I also came
across a Z80 backend for LCC (used for writing games for the GameBoy).


Neil Johnson :::::::::::::::::::::::::::::::::::::: Computer Laboratory
                                                                                                              New Museums Site
email: Pembroke Street

Post a followup to this message

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