Since values in RAM are undefined after a reset, the initial information which is in sections with the data attribute should be saved in ROM, and the information should be copied to RAM from ROM before running the application. This sequential process is called “ROMization”.
For example, the code to save an .sdata section at the address 0x100 (in ROM) and copy it to the address 0xFEDE0000 (in RAM) for execution is given below. [Linkage options]
Designated from the [Link Options] tabbed page -> [Section] category -> [ROM to RAM mapped section] in CS+.
Designated from the [Link Options] tabbed page -> [Section] category -> [Section start address] in CS+.
Include the address information for .sdata/.sdata.R section in the section initialization table which is defined in the startup routine. Section names with “#_s” and “#_e” appended as prefixes are the addresses where sections start and end, respectively.
.section ".INIT_DSEC.const", const .align 4 .dw #__s.data, #__e.data, #__s.data.R .dw #__s.sdata, #__e.sdata, #__s.sdata.R
Expand the information on initializing data-attribute sections to include RAM by including the copying function "_INITSCT_RH" at the end. "_INITSCT_RH" also initializes sections with the bss attribute to zero.
mov #__s.INIT_DSEC.const, r6 mov #__e.INIT_DSEC.const, r7 mov #__s.INIT_BSEC.const, r8 mov #__e.INIT_BSEC.const, r9 jarl32 __INITSCT_RH, lp
|C Compiler Package for RH850 Family|