Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

80186 free C compiler

539 views
Skip to first unread message

John Wilkinson

unread,
Sep 30, 2005, 7:02:07 AM9/30/05
to
Hi,
I am new to all this but I am about to try my first embedded design using
an 80C186 processor.
Is there a free C compiler available?
Am I correct in thinking gcc can't target the 80186 processor?

I understand I need a locator as well?
Again is there a free one?

Where can I get startup code? The book I have is Programming Embedded
Systems by Michael Barr, and he says that you could use libgloss, but I
can't find it anywhere on the internet!!

Best regards,
John.

Richard

unread,
Sep 30, 2005, 7:31:42 AM9/30/05
to

"John Wilkinson" <john.wi...@philips.com> wrote in message
news:ff0yg393dw7q$.x6somhk77uvk$.dlg@40tude.net...


http://www.openwatcom.org/ can target 186 and is free. It creates .exe's
however that run on top of DOS and it sounds like you just have a bare
board. However the compiler source code is available so if nothing else you
might be able to get the startup code. There are free DOS versions around
should that make it easier for you.

Looking at your email address - Philips and x86?

Regards,
Richard.


http://www.FreeRTOS.org

Michael N. Moran

unread,
Sep 30, 2005, 7:46:35 AM9/30/05
to
John Wilkinson wrote:
> Where can I get startup code? The book I have is Programming Embedded
> Systems by Michael Barr, and he says that you could use libgloss, but I
> can't find it anywhere on the internet!!

IIRC, libgloss is included with newlib.
ftp://sources.redhat.com/pub/newlib/index.html

--
Michael N. Moran (h) 770 516 7918
5009 Old Field Ct. (c) 678 521 5460
Kennesaw, GA, USA 30144 http://mnmoran.org

"So often times it happens, that we live our lives in chains
and we never even know we have the key."
The Eagles, "Already Gone"

The Beatles were wrong: 1 & 1 & 1 is 1

Jens Gydesen

unread,
Sep 30, 2005, 8:39:28 AM9/30/05
to
Hi,

htsoft.com has the pacific C

Regards Jens

"John Wilkinson" <john.wi...@philips.com> skrev i en meddelelse
news:ff0yg393dw7q$.x6somhk77uvk$.dlg@40tude.net...

Andrew Jackson

unread,
Sep 30, 2005, 9:22:26 AM9/30/05
to

You can download TurboC 2.01 from Borland's museum. This includes the
startup code. YOu would have to avoid most of the library stuff if you
aren't using DOS in any form.

You will need a locator; I'd Google for one. I found several articles on
them a couple of years ago.

Andrew


Norm Dresner

unread,
Sep 30, 2005, 9:47:04 AM9/30/05
to
"John Wilkinson" <john.wi...@philips.com> wrote in message
news:ff0yg393dw7q$.x6somhk77uvk$.dlg@40tude.net...

My first choice -- because I have it -- is the ancient Borland C++ v3.1
which you can probably find on eBay for a song or two. I've used it in
years past to create stand-alone programs that ran on an 80188 but it takes
some custom startup code to get rid of the dependency on DOS. Second choice
would be Microsoft C++ v1.5x with the same caveats. You might even be able
to get by with the DJGPP MS-DOS compiler if you can limit the processor
target to 8086/186. Again you'll have to write your own startup code.

As for startup code, decades ago the company I worked for bought a product
called C_Thru_ROM which was a library of startup and simple
CRTL-substitutions to enable writing embedded software for x86 processors
with commercial (MS-DOS) compilers. It was rare then and I haven't seen any
in the years since but you might find a copy. Also, the company that makes
it -- http://www.datalight.com -- now makes a ROM-able MS-DOS emulator.

Norm

Tauno Voipio

unread,
Sep 30, 2005, 10:32:27 AM9/30/05
to

bcc (Bruce's C Compiler) would do that.

GCC i not targeted for 16 bit 80x86 code.

Why 80186 (or 80188)? The architecture is obsolete, so
I'd avoid it in new designs. An ARM could do the same
with modern tools and plenty of more power.

The 80186 startup code is much dependent on the hardware
environment - the first thing is to open up the ROM
chip select so the whole chip is available, and next,
to open the other chip selects.

--

Tauno Voipio
tauno voipio (at) iki fi

Dave Hansen

unread,
Sep 30, 2005, 11:02:39 AM9/30/05
to
On Fri, 30 Sep 2005 12:02:07 +0100, John Wilkinson
<john.wi...@philips.com> wrote:

>Hi,
>I am new to all this but I am about to try my first embedded design using
>an 80C186 processor.
>Is there a free C compiler available?

IIRC, there was a book on programming embedded DOS systems that
included a Borland 3.something C compiler. You might look in the
Borland Museum as well, though I think that stuff is older.

Someone else mentioned OpenWatcom, which might work as well.

>Am I correct in thinking gcc can't target the 80186 processor?

That's my understanding.

>
>I understand I need a locator as well?
>Again is there a free one?

John Fine has written jloc which should do what you want. He calls it
"zero price shareware," which means he wants you to register it if you
use it, but he dosn't charge you anything for it. See
http://my.execpc.com/~geezer/johnfine/ for more info.

>
>Where can I get startup code? The book I have is Programming Embedded
>Systems by Michael Barr, and he says that you could use libgloss, but I
>can't find it anywhere on the internet!!

The 80C186 user's manual from Intel (if you can find one) pretty much
describes most of what you need for the chip. And it's important for
things like setting up the chip selects. libgloss I suspect is for
handling C initialization requirements and to call main.

With a locator, you don't necessarily have to do all that, just jump
to a routine called "_start" or some such. Although you should
probably have a routine to zero static RAM, etc. That means you'll
have to explicitly initialize static variables in your code (rather
than declaring them with an initializer), but usually that's a small
price to pay (as long as you don't forget...)

HTH,

-=Dave
--
Change is inevitable, progress is not.

Mat Nieuwenhoven

unread,
Sep 30, 2005, 3:34:59 PM9/30/05
to

The next release of Openwatcom (1.4) has specific support for embedded work,
you do not need a locator anymore, the linker will do it for you.
Note that OW is a cross-compiler, you can use it to create embedded code
whether you run the Windows, OS/2 or DOS.

Mat Nieuwenhoven


Richard

unread,
Sep 30, 2005, 3:55:05 PM9/30/05
to

> The next release of Openwatcom (1.4) has specific support for embedded
work,
> you do not need a locator anymore, the linker will do it for you.

That is good news. I just had a quick look on the site and cannot see a
release date mentioned. Do you know roughly when this might be?

Regards,
Richard.


http://www.FreeRTOS.org

Mat Nieuwenhoven

unread,
Oct 1, 2005, 4:39:36 AM10/1/05
to
On Fri, 30 Sep 2005 19:55:05 GMT, Richard wrote:

>
>> The next release of Openwatcom (1.4) has specific support for embedded
>work,
>> you do not need a locator anymore, the linker will do it for you.
>
>That is good news. I just had a quick look on the site and cannot see a
>release date mentioned. Do you know roughly when this might be?

"if it's finished" is the common answer. I don't think there's a specific
date set, but my feeling that it's near.
For the 'locator' functions, the enhancements were only in the linker. I
think the linker will not change between now and the release, I can mail you
the new linker if you want to try it. Mail be privately at my (mangled) email
address in the header.

Mat Nieuwenhoven


rziak

unread,
Oct 1, 2005, 2:26:45 PM10/1/05
to
> Why 80186 (or 80188)? The architecture is obsolete, so
> I'd avoid it in new designs. An ARM could do the same
> with modern tools and plenty of more power.

I would not call it obsolete, it is a mature core with mature tools
very suitable for small non-battery operrated embedded systems and
components. There exist various mutations still in production and one
can also see on Lantronix website that this core is successfuly used in
new products (like XPort and WiPort).

Speaking of Lantronix, I quite like their DSTni-EX for the optimized
instruction set and high amount of integrated prefipherals. However, I
did not use it myself, just read the datashet.

larwe

unread,
Oct 1, 2005, 2:31:13 PM10/1/05
to
> > Why 80186 (or 80188)? The architecture is obsolete, so
>
> I would not call it obsolete, it is a mature core with mature tools
> very suitable for small non-battery operrated embedded systems and

Rue McLanahan is a mature actress, but I wouldn't choose her to play
the part of sex kitten in a new movie.

Programming the 186 gets you all the disadvantages of real-mode x86
programming with none of the advantages of, well, anything really. ARM
tools are mature and readily available, operating systems abound, and
peers to ask for help are everywhere.

Donald

unread,
Oct 1, 2005, 8:46:59 PM10/1/05
to
larwe wrote:
>>>Why 80186 (or 80188)? The architecture is obsolete, so
>>
>>I would not call it obsolete, it is a mature core with mature tools
>>very suitable for small non-battery operrated embedded systems and
>
>
> Rue McLanahan is a mature actress, but I wouldn't choose her to play
> the part of sex kitten in a new movie.
>

Ahhh, it always comes back to sex. ;-)

rziak

unread,
Oct 1, 2005, 10:26:01 PM10/1/05
to
> Programming the 186 gets you all the disadvantages of real-mode x86

What of the real mode intimidates you ? Name some.

> programming with none of the advantages of, well, anything really. ARM
> tools are mature and readily available, operating systems abound, and
> peers to ask for help are everywhere.

However, ARM is off-topic in this thread.

larwe

unread,
Oct 1, 2005, 10:41:21 PM10/1/05
to

rziak wrote:
> > Programming the 186 gets you all the disadvantages of real-mode x86
>
> What of the real mode intimidates you ? Name some.

Well damn, I don't need to go anywhere past the memory model or the
scarce and narrow registers to make my point more than adequately. It's
the 21st century now, I have my VIC-20s for nostalgia but don't use
them for any production purpose.

> However, ARM is off-topic in this thread.

Welcome to the Internet, lad - here's a lemon-scented towel and a
coupon good for two bananas and a ferret. Once you redeem it, maybe you
can come back and see if you have any better luck controlling what is
"on-topic" in a Usenet group, particularly when the content of the
message is utterly appropriate to the group and merely doesn't agree
with what you were thinking in a particular thread.

Anyway, anyone asking about coming up on the 186 in this day and age
had better be supporting a legacy project or working with an ASIC that
has a 186 inside it. At a stretch, I could swallow a short-run design
intended to use up a huge drawer full of dusty 186 parts. But there are
so many other products so much better in so many ways that
intentionally selecting a 186 except in the sorts of circumstances I
illustrated is quite insane.

Jim Stewart

unread,
Oct 1, 2005, 11:36:53 PM10/1/05
to

Know any ARM operating systems that can boot
in 500ms?

Anton Erasmus

unread,
Oct 2, 2005, 2:41:31 AM10/2/05
to
On Sat, 01 Oct 2005 20:36:53 -0700, Jim Stewart <jste...@jkmicro.com>
wrote:

Linux.
If I recall correctly there was a discussion on boot times for
embedded Linux on comp.os.linux.embedded a while ago.
Someone pointed to some work done by Samsung on shortning
the boot time of Linux on their ARMs. They got this down to below
500ms. Most other OSes available for ARM should boot much
faster than this.
I agree with larwe. Choosing a 186 for a new design if there are not
some sort of unusual circumstances is insane.

Regards
Anton Erasmus

Hans

unread,
Oct 2, 2005, 4:47:03 AM10/2/05
to
If you are building an embedded controller using standard parts then perhaps
the 80186 is not the best choice, but if you are building your own FPGA/ASIC
than it makes perfect sense to look at some of the mature cores like the
8051, Z80 and 8086. Although having said that, the old *obsolete* 8051 part
is still in full production by Philips/Siemens/Atmel after 25 years! This
can't be all for maintaining legacy designs, they must be selected for new
designs as well?

As Rziak were saying there are lots of good development tools available for
the 86/186 not to mention the enormous amount of legacy code, also to test
your code just open a DOS box on your 64bits desktop and run the code, works
like a charm :-)

I might be biased... http://www.ht-lab.com/freecores/cpu8086/cpu86.html :-)

Hans

PS I didn't know who Rue Mcclanhan was, but after a quick google search
guess what? she played the sexy one in the Golden Girls TV series, so I
guess given the success of the series she was a good choice :-)


"larwe" <zwsd...@gmail.com> wrote in message
news:1128191473.5...@g47g2000cwa.googlegroups.com...

Paul Keinanen

unread,
Oct 2, 2005, 5:44:50 AM10/2/05
to
On 1 Oct 2005 19:41:21 -0700, "larwe" <zwsd...@gmail.com> wrote:

>rziak wrote:
>> > Programming the 186 gets you all the disadvantages of real-mode x86
>>
>> What of the real mode intimidates you ? Name some.
>
>Well damn, I don't need to go anywhere past the memory model or the
>scarce and narrow registers to make my point more than adequately.

While I agree that programming a large single thread application in
real mode can become quite messy, but using some kind of RTOS and
allocating separate code, data and stack segments for each task and
keeping each of them below 64 KiB should not be too hard in most
cases.

Common library calls would have to use far calls, but would
automatically use task specific static data and stack areas etc. The
task switching in the OS would be slightly more complicated and the
communication between tasks would go through OS supplied communication
primitives (which is usually considered a good thing rather than
poking around in a foreign task data space :-).

Paul

larwe

unread,
Oct 2, 2005, 8:07:30 AM10/2/05
to

> While I agree that programming a large single thread application in
> real mode can become quite messy, but using some kind of RTOS and
> allocating separate code, data and stack segments for each task and
> keeping each of them below 64 KiB should not be too hard in most
> cases.

So if I can summarize this argument: "Yes, working with this core is
like jumping through blazing hoops but, really, they're not blazing
quite as vigorously as it appears from a distance, and you'd be
surprised at just how much pain a human can endure before blacking
out".

Grant Edwards

unread,
Oct 3, 2005, 10:12:58 AM10/3/05
to
On 2005-10-02, Jim Stewart <jste...@jkmicro.com> wrote:

> Know any ARM operating systems that can boot
> in 500ms?

Um, yes. Pretty much all of the RTOSes I've ever seen?

--
Grant Edwards grante Yow! An air of FRENCH
at FRIES permeates my
visi.com nostrils!!

Tauno Voipio

unread,
Oct 3, 2005, 3:38:59 PM10/3/05
to


You seem to have already plenty of responses.

Why I'm thinking of the core being obsolete?
After using the 80186's for nearly 20 years successfully,
many of my customers had to change the processor, as the
chip manufacturers announced EOL for the parts.

Though it may be OT: After 2 years of search for
a replacement, I found the Atmel AT91 series ARMs
with functionality covering well that of an 80186.

As an example: Porting the software of a real-time
controller with 40 kbytes of 80186 code to the ARM
took a week, as both were programmed with C without
ant dirty tricks used. Surprisingly, the code size
was about the same (40064 bytes vs. 40036 bytes). The
compilers used were Borland C v. 4.5 and GCC v. 3.2.1
in Thumb mode.

Even as I used the 8086 family chips from the very
beginning (I still have one in engineering sample 8088's),
I definitely advise against making any new designs
based on a plain 16 bit 80x86.

Please think that for a successful embedded product
used in any non-consumer use, the parts should be
available for 15 to 20 years from the design.

rziak

unread,
Oct 3, 2005, 11:41:24 PM10/3/05
to
> Why I'm thinking of the core being obsolete?
> After using the 80186's for nearly 20 years successfully,
> many of my customers had to change the processor, as the
> chip manufacturers announced EOL for the parts.

I see. Well, it has not been such a bad CPU for its times.

> Even as I used the 8086 family chips from the very
> beginning (I still have one in engineering sample 8088's),
> I definitely advise against making any new designs
> based on a plain 16 bit 80x86.

I admit, I was impressed by amount of peripherals Lantronix stuffed
onto their chip, so I may be biased. (Impressed not realy by the core
but by those 2x CAN channels, 2x Ethernet channels, 4x UART and other
goodies on DSTni-EX).

> Please think that for a successful embedded product
> used in any non-consumer use, the parts should be
> available for 15 to 20 years from the design.

Quite good point.

0 new messages