It started as an idea to handle DSP fixed-point features. However, the proposed ISO/IEC WDTR 18037 standard, also known as "Programming languages, their environments and system software interfaces—extensions for the programming language C to support embedded processors," now looks like it will be incorporated into the C standard in 2003.
The C extension isn't just applicable to DSPs, although it has its roots in a proposal from ACE Associated Compiler Experts (www.ace.nl) of Amsterdam. The extension includes three major enhancements: fixed-point arithmetic, multiple-address space support, and basic I/O hardware addressing.
Fixed-Point Arithmetic: Standard C includes integer and floating point as basic data types. It doesn't support fixed-point arithmetic. Unfortunately, DSPs often support fixed-point arithmetic, so only a number of undesirable alternatives have existed for developers wanting to use C and fixed-point support. Motorola takes a portable approach using macros and functions. Others use nonstandard compiler extensions. Of course, an assembler is always an option.
Fixed-point support in the extension addresses all aspects for a new fixed-point data type. This includes constant definitions, fixed-point functions, and formatted I/O. It also addresses rounding and overflow details. The function interface is contained in the new "stdfix.h" header file.
The fixed-point data types include fract (fractional) and accum. While the fract data type has a value between -1.0 and +1.0, the accum data type contains an integer and fractional part like 10.23HQ.
Adding a new data type is no mean feat. The mix of attributes, functions, and semantics are more extensive than those for integers and floating points combined. This is necessary to provide the necessary flexibility to support the range of hardware fixed-point implementations.
Fixed-point support isn't restricted to systems that provide hardware support. Fixed-point data types can provide a level of accuracy not easily obtained by using just integers and floating point values. Fixed-point support is expected to find a home in a wide range of applications.
Multiple Address Spaces: Today's crop of DSPs and microcontrollers (MCUs) incorporates a wide range of memory technologies, such as RAM, ROM, flash memory, and segmented memory and I/O spaces. Operating systems and compilers typically hide these differences behind a set of functions or naming conventions. The multiple-address space support in this C extension provided a unified mechanism for de-fining an address space as well as variables within a specified address space.
Programmers can specify which ad-dress space is used for a particular heap-allocated variable. There's no named stack support.
Multiple-address space support can be implemented on any CPU. But it will most likely be used with DSP and MCU systems.
I/O Hardware Addressing: "Ideally, it should be possible to compile C or C++ source code which operates directly on I/O hardware registers with different compiler implementations for different platforms and get the same logical behavior at runtime" (excerpt from ISO/IEC WDTR 18037).
It's rare for a vendor to sell just one processor chip. Most DSP and MCU vendors sell one or more product lines with many chips in each. These may differ by package, but more importantly, they can vary in the number of pins and on-chip peripherals.
A number of compiler vendors already support the Embedded C proposal. Initially, the feature was found in products for DSP hardware, but this will likely change in the future.
www.dsp-c.org
ISO/IEC WDTR 18037 |
|