##
Data in ROM

The PIC-18 processors are based on two separate program and data spaces. Data space is RAM, and program space is ROM. This architecture causes problem to store initialized data (such as literals like `"hello !"`). Indeed, the only way to store initialized data is to place them in program space.

In order to keep the compiler simple, `cpik` adds a loader routine to startup code. This routine is automatically activated before the `main()` function and copies all initialized data from program space to data space9.

As a consequence, initialized data is located in RAM during execution. This feature is necessary when the data can be modified, but is not desirable when the data is read-only because it wastes RAM space.

Since version 0.5.3 `cpik` offers several simple ways to use data located in program space. In the following sections, program space is simply called ROM. The ROM support presented here is fully implemented with macros and a couple of run-time routines. These macros are defined in the `rom.h` header.

The support presented below is experimental because it prepares a definitive implementation based on a `__rom` keyword. However, it is perfectly usable and very efficent from both time and memory points of view.

#### Footnotes

... space 9
  The loader is not included if your program does not use statically initialized data.

Subsections

- Creating a block of data in ROM
- Passing immediate ROM data to a subroutine
- Passing ROM data to a subroutine with a pointer to ROM
- Accessing data in ROM with a ROM accessor