
Examine the Landscape 45
For each new board, you should create a header file that describes its most impor-
tant features. This file provides an abstract interface to the hardware. In effect, it
allows you to refer to the various devices on the board by name, rather than by
address. This has the added benefit of making your application software more por-
table. If the memory map ever changes—for example, if the 128 KB of RAM is
moved—you need only change the affected lines of the board-specific header file
and recompile your application.
As this chapter progresses, I will show you how to create a header file for the
Arcom board. The first section of this file is listed below. The part of the header
file below describes the memory map. The most notable difference between the
memory map in the header file and that in Figure 5-2 is the format of the
addresses. The sidebar “Pointers Versus Addresses” explains why.
/**********************************************************************
*
* Memory Map
*
* Base Address Size Description
* -------------- ----- -----------------------------------
* 0000:0000h 128K SRAM
* 2000:0000h Unused
* 7000:0000h Zilog SCC Registers
* 7000:1000h Zilog SCC Interrupt Acknowledge
* 7000:2000h Unused
* C000:0000h 128K Flash
* E000:0000h 128K EPROM
*
**********************************************************************/
#define SRAM_BASE (void *) 0x00000000
#define SCC_BASE ...