Allocating .econst to Program Memory

NOTE

This section applies to applications that use the COFF ABI.

If your system configuration does not support allocating an initialized section such as .econst to data memory, then you have to allocate the .econst section to load in program memory and run in data memory. At boot time, copy the .econst section from program to data memory. The following sequence shows how you can perform this task.

  1. Extract boot.asm from the source library:
  2. ar2000 -x rts.src boot.asm
  3. Edit boot.asm and change the CONST_COPY flag to 1:
  4. CONST_COPY .set 1
  5. Assemble boot.asm:
  6. cl2000 boot.asm
  7. Archive the boot routine into the object library:
  8. ar2000 -r rts2800_ml.lib boot.c.obj

For an .econst section, link with a linker command file that contains the following entries:

SECTIONS { ... .econst : load = PROG PAGE 1, run = DATA PAGE 1 { /* GET RUN ADDRESS */ __econst_run = .; /* MARK LOAD ADDRESS */ *(.ec_mark) /* ALLOCATE .econst */ *(.econst) /* COMPUTE LENGTH */ __econst_length = - .__econst_run; } }

In your linker command file, you can substitute the name PROG with the name of a memory area on page 0 and DATA with the name of a memory area on page 1. The rest of the command file must use the names as above. The code in boot.asm that is enabled when you change CONST_COPY to 1 depends on the linker command file using these names in this manner. To change any of the names, you must edit boot.asm and change the names in the same way.