Example: Defining multiple RAM and ROM areas

When all constant and code sections as well as data sections cannot be allocated consecutively, the PRM file used to link the example above can be defined as the following listing displays:

Listing: PRM file for defining multiple RAM and ROM areas
LINK test.abs  /* Name of the executable file generated.      */
NAMES

  test.o       /* Name of the object file in the application. */

END

SECTIONS

 /* Two READ_ONLY memory areas */

  ROM_AREA_1= READ_ONLY  0x8000 TO 0x800F;

  ROM_AREA_2= READ_ONLY  0x8010 TO 0xFDFF;

/* Three READ_WRITE memory areas */

  RAM_AREA_1= READ_WRITE 0x0040 TO 0x00FF; /* zero-page memory area */

  RAM_AREA_2= READ_WRITE 0x0100 TO 0x01FF;

  MY_STK    = READ_WRITE 0x0200 TO 0x023F; /* Stack memory area     */

END

PLACEMENT

/* Relocatable variable sections are allocated in MY_RAM. */

  dataSec              INTO RAM_AREA_2;

  DEFAULT_RAM          INTO RAM_AREA_1;

  SSTACK               INTO MY_STK; /* Stack allocated in MY_STK   */

/* Relocatable code and constant sections are allocated in MY_ROM. */

  constSec             INTO ROM_AREA_2;

  codeSec, DEFAULT_ROM INTO ROM_AREA_1;

END

INIT   entry                /* Application's entry point.          */

VECTOR 0 entry /* Initialization of the reset vector. */

The linker PRM file contains at least:

According to the PRM file listed above: