2.2.4 Language Tools

Language tools are programs such as cross-assemblers and cross-compilers. Most people are familiar with some of the language tools that run on a computer, e.g., Visual Basic or C compilers.

When using language tools for embedded systems, a “cross-assembler” or “cross-compiler” is used. These tools differ from typical compilers in that they run on a computer, but they produce code to run on another microprocessor (or microcontroller).

Language tools also produce a debug file that MPLAB X IDE uses to correlate the machine instructions and memory locations with the source code. This bit of integration allows the MPLAB X IDE editor to set breakpoints, allows Watches windows to view variable contents, and lets you single step through the source code, while watching the application execute.

Embedded system language tools also differ somewhat from compilers that run and execute on a computer because they must be very space conscious. The smaller the code produced, the better, because that provides the smallest possible memory usage for the target, which reduces cost. This means that techniques to optimize and enhance the code, using machine-specific knowledge, are desirable.

The size of programs for computers typically extends into the megabytes for moderately complex programs. The size of simple embedded systems programs may be as small as a thousand bytes or less. A medium size embedded system might need 32K or 64K of code for relatively complex functions. Some embedded systems use megabytes of storage for large tables, user text messages or data logging.

Figure 2-15. A Compiler Converts Source Code Into Machine Instructions