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!!
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.
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.
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 --
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.
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.
That's my understanding.
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
formatting link
for more info.
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...)
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.
"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.
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.
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.
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.
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.
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.
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...
formatting link
:-)
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 :-)
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 :-).
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.