Embedding X86 and beyond

Developing 32-bit protected-mode x86 real time systems involves choices by Dale Fittes

The x86 can rightly claim to be the world’s most successful computer architecture, with around 50-million x86-based PCs installed and a similar number of CPUs in embedded control systems.

Its dominance in the PC world is well known and looks set to continue for the foreseeable future, despite spirited attempts by DEC, IBM, Motorola, Sun , MIPS etc to get their chips into desktop systems.

In the embedded world, however, it’s a different story; for here the x86 has to compete on a more level playing field with the likes of Motorola 68k and Power-PC, DEC VAX and Alpha at the high-end, and a plethora of 8/16/32-bit CPUs from a hundred different suppliers at the lower end.

32-bit embedded systems are based on non-PC platforms, such as Multibus, VME, Q-Bus and Unibus running heavyweight operating systems like RMX, Xenix and VxWorks. Although these deliver substantial improvements over PCs in performance, there is a price to be paid in development and run-time licences.

In the 16/32-bit middle ground, where absolute performance and software quality are less important, system builders have been quick to adopt and adapt the PC architecture to real time applications. Such is the extent of the invasion of PC architecture into the process and real time control markets that the distinction between embedded and reprogrammable systems is blurring. PCs running real time operating systems, like iRMX and Xenix, are common here, while traditional PC system software, such as BIOS, DOS and Windows, is now embeddable for use in `black-box’ control systems.

At the low (8/16-bit) end, x86 CPUs, mainly 186, have found inumerable applications in process control, communications and so on. But, designs owe little or nothing to PC heritage; hardware conforms more to the ROM/RAM microprocessor model, and software runs under the control of a custom designed scheduler or kernel, frequently developed in-house.

With the introduction of new embedded-friendly variants of the x86 CPU, such as the 386EX from Intel, the NS486 from Nat-Semi, and the Elan family from AMD, a new market is being created – for embedded systems which promise the performance of high-end systems, including the all-important protected-mode virtual memory features, but with big price and power reductions.

However, users of these new devices are immediately faced with some hard choices in the areas of applications and system software, mainly as a consequence of the mixed parentage from which the chips are derived.

Main development routes include:

* The exotic and specialised (eg ADA, Coral, Chill, Modula-2) compilers and debug tools favoured by the military, used with a dedicated o/s like iRMX.

* PC C/C++ compiler plus embedded BIOS/DOS/Windows or similar.

* PC C/C++ compiler plus third-party locator, like CSi Link/Loc, SSi Tools, Phar Lap Link/Loc, etc.

* PC compiler plus dedicated run time support package – Phar Lap TNT Embedded Toolsuite.

* Dedicated cross compiler with integral Programmers’ Workbench and System Builder – Intel tools (now obsolete), CAD-UL, Microtec Research C/C++ compilers.

These choices are reviewed in depth in Hitex’s `386ex Tool Survey’ (available on request), which culminates in recommending CAD-UL’s CC386 compiler with integrated Programmers’ Workbench and System Builder. This supports the x86 SPM (segmented protected mode) and provides direct access to multi-tasking features like TSS and Task Gates. Other 32-bit embedded x86 compilers reviewed include MRI’s CC386 (also SRM-compatible and intended for use with the VRTX os), Watcom’s C/C++ and Metaware’s High C/C++ compiler.

Several demo programs have been prepared to illustrate these choices. They also cover programming for producing and debugging stand-alone 32-bit protected-mode x86 embedded systems, without recourse to special- ised run-time support from an embedded os, or DOS/BIOS.

Each is designed as a working example of a real time embedded control program running on a minimum-configuration ROM/RAM 386ex, and contains two independent tasks, each isolated from the other via the 386’s built-in hardware protection, with interrupt support, task-switching and inter-task comms written in C.

We chose the 386ex because it’s the first x86 family micro to provide embedded-friendly peripherals, like interrupts, timer/counters, DMA, watchdog, power-down, serial and parallel I/O on a 32-bit CPU core. It also supports the full set of x86 protected-mode virtual memory features – now de rigeur.

Finally, remember, in-circuit emulators are invaluable for developing real time programs; in addition to the usual download, single-step and run facilities, Hitex emulators allow setting of up to 256 breakpoints in ROM or RAM, and have up to eight hardware triggers.

* Dale Fittes is x86 specialist with Hitex, and has been with the company for 2 1/2 years. He spent seven years with Intel on technical support, and was formerly a design engineer on process control systems. He holds a BA degree in physics from York University.