ROM Library Startup File

A ROM Library requires a very simple startup file, containing only the definition from the startup structure. Usually a ROM library startup file looks as follows:

#include "startup.h"

/* read-only: _startupData is allocated in ROM and ROM 
Library PRM File */

struct _tagStartup _startupData;

You must generate a PRM file to set code placement in RAM. Because the compiler generates absolute code, the linker must know the final location of the code to generate correct code for the function call.

In the PRM file, you must:

The following listing shows a PRM file that copies and executes code at address 0x7000.

Listing: Linker Parameter File


LINK fiboram.abs AS ROM_LIB
NAMES  myFibo.o start.o

END

SECTIONS

  MY_RAM = READ_WRITE 0x4000 TO 0x43FF;

  MY_ROM = READ_ONLY  0x7000 TO 0xBFFF; /* Dest. Address in RAM area */

PLACEMENT

  DEFAULT_ROM, ROM_VAR, STRINGS  INTO  MY_ROM;

  DEFAULT_RAM                    INTO   MY_RAM;

END

ENTRIES

  myMain

END
Note: You cannot use a main function in a ROM library. Use another name for the application's entry point. In the example above, we used myMain.