A.1.6 Referencing Addresses of a Section

The addresses and size of a section can be referenced by using section address operators.

__sectop ("<section name>"): References the start address of <section name>

__secend ("<section name>"): References the sum of the size of <section name> and the address where <section name> starts.

__secsize ("<section name>"): References the size of <section name>

[Example]

#pragma section $DSEC
static const struct {
   void *rom_s; /* Acquires the start address value of the initialized data section in ROM */
   void *rom_e; /* Acquires the last address value of the initialized data section in ROM */
   void *ram_s; /* Acquires the start address value of the initialized data section in RAM */
} DTBL[]={__sectop("D"), __secend("D"), __sectop("R")};

The INITSCT function in the resetprg.c file of the startup routine executes transfer from ROM to RAM and initialization of uninitialized areas. The addresses acquired by __sectop and __secend written in the dbsct.c file are referenced during execution.