views:

1944

answers:

8

I am working on an embedded systems project and have run into an issue of the compiler being programatically embedded in the Paradigm C++ IDE. I would like to be able to automate building.

The processor is the AMD186ES. I am not working with the OS - just baremetal stuff. I need to generate real-mode 16-bit 8086 machine code from C++.

My googling indicates that G++ can build such code.

My questions are:

Can g++ be configured to build this machine code?

Are there other C++ compilers that can do it as well?

+4  A: 

Your best bet is probably OpenWatcom, which includes a C++ compiler. Back in the early-to-mid 90s, I believe this was the best C/C++ compiler around. It was open-sourced a few years ago.

Simon Howard
+3  A: 

Doesn't your chip vendor (AMD, I guess) have any pointers to compilers for the chip?

If not, you may be able to use some 16-bit DOS compilers - but you'll have several potential big problems:

  1. getting a library for the compiler that is not dependent on the BIOS or MS-DOS
  2. debugging
  3. linkers for embedded systems usually have specific support for locating code in specific memory regions. That's not usually included in compilers for DOS, but you may be able to find some sort of linker/locator that'll do the trick for you.

A couple of compilers that are still supported and generate 16-bit code are:

Michael Burr
+4  A: 

This google search shows a series of links for setting gcc up as a cross compiler. To get it to target something other than a standard ELF binary you can frig the output. This link discusses excluding the standard libraries and customising the output format. You may have to do some fiddling to get it to work.

As an alternative openwatcom.org has an open-source version of the Watcom C compiler, which might also be able to do what you want.

ConcernedOfTunbridgeWells
A: 

This should do the trick

EvilTeach
+2  A: 

Take a look at bcc, which is a 16-bit x86 C compiler. For example, there are also Debian packages for it.

David Schmitt
+1  A: 

Not sure but I think old version of borland c++ was able to do that. you can download version 5.5 t : here good luck

call me Steve
A: 

It has been a long time since I've looked at Paradigm stuff (are they still around?) -- are you sure they don't have command-line equivalents for the compiler? My recollection is that they were built on top of Borland's compiler toolchain... So maybe an old copy of Borland compilers might do the trick?

-- Ah, looking a little futher, I find that Paradigm is still around (www.devtools.com) selling X86 tools. (Must be a cash cow!)

Their professional product includes scripting... Depending on the amount of work you plan to do, it just might be worth it to bite the bullet and buy their full offering...

Good luck.

Toybuilder
I was given the "lite" version with my embedded board. Somehow Paradigm embedded the compiler into the IDE executable.
Paul Nathan