The Dynamic C Environment

Rabbit Semiconductor is owned by Z-World, who sells compilers, assemblers, and development tools for embedded systems, primarily based on Z80 and 386EX embedded processors. Their Dynamic C system for the Rabbit 2000 microprocessor is available in two versions under Windows, called Special Edition (SE) and Premier. The SE version is included with the Rabbit development kits at no extra cost, while the Premier version can be purchased for a reasonable fee. It adds the ?C/OS-II real-time operating system, TCP/IP and Ethernet libraries and other features to the SE version.

Dynamic C will first attempt to locate and boot the Rabbit 2000 system attached to a serial port when launched. It then compiles and downloads a simple, yet effective, debugging BIOS to the CPU. The BIOS sets up a multi-tasking operating system, with hooks that allow debugging and stream oriented I/O between the Rabbit and the host computer. This eliminates the need for a separate CPU simulator program and makes some things like timing issues easier to debug.

This environment differs from an ANSI-compatible compiler in some ways, primarily so it can support extra features specific to both embedded systems in general, and the Rabbit 2000 specifically. One feature that sometimes surprises programmers is the lack of 'include' pragmas. This is done in order to save precious memory on the embedded system mainly. All source code to Dynamic C functions are provided in the .LIB files. In addition, special comment sections in the files document the functions for both the end-user and the compiler.

One of the things the compiler does upon startup is to open and read through all the .LIB files. It loads the function and variable declarations for later use when compiling user programs. When a user application is compiled it is as if all the .H files have already been read, which speeds up compiling significantly. Since the source code for the BIOS is included in the .LIB files, advanced programmers can customize it if desired.

For most of us though, it will be sufficient to rely on the compiler to keep track of the list of functions we are using in our program and only compile the ones we actually use. This makes the resultant program as small as possible. Many of the functions in the Dynamic C libraries are mostly assembly language, with a few C or C-wrapped functions mixed in throughout the system.

Every line of code in C functions that do not use the special 'nodebug' attribute have a special RST instruction inserted by the compiler. The RST instructions are a special kind of debugging interrupt, which allows the downloaded BIOS to interrupt almost any and all instructions. When debugging code, the RST instruction is moved just ahead of the next spot required to stop either instruction-by-instruction, or C source code line to line. The BIOS provides the ability to read variables and send the values back to the host computer via the serial port.

When compiling, the system normally only does this using host computer RAM. Only under user direction will the system write the resultant program to disk. This is used with the Rabbit Field Utility (RFU) to reprogram many Rabbit-based systems quickly, without needing the Dynamic C environment at all.

Dynamic C also adds several other non-ANSI keywords and features. Some are related to multi-tasking operations and others are specific to the Rabbit processor. The 'costate' and 'slice' statements allow you write multi-tasking programs quite easily. Other special keywords and pragmas include 'interrupt' for interrupt handlers in C, 'root' to force code into the lower 64K of memory, the 'debug' and 'nodebug' options for functions and many others. We will examine some of these during the course, others you can read in the online manuals or Dynamic C book.

The environment includes not only the compiler and debugger, but also integrates an editor and help system. Inside the .LIB files along with the source code and the header definitions, user documentation for the functions are also included. You can browse them in the online documentation, or if you know the name of a function, you can use the help system to read the documentation. The help system can even insert the function into your code for you if desired. When debugging code, Dynamic C offers several windows that can be used to watch variables, examine registers or memory, view the stack, etc? It is a feature-rich environment and a nice programming tool. I miss bitmapped structures, but other than that, no complaints.