_INITSCT_RH


Copies initial values to or clears sections in RAM

[Classification]

Standard library

[Syntax]

#include <_h_c_lib.h>

void _INITSCT_RH(void * datatbl_start, void * datatbl_end, void * bsstbl_start, void * bsstbl_end)

[Argument(s)/Return value]

Argument

Return Value

datatbl_start :

First address of the initialization table for a section with the data attribute

datatbl_end:

Last address of the initialization table for a section with the data attribute

bsstbl_start :

First address of the initialization table for a section with the bss attribute

bsstbl_end:

Last address of the initialization table for a section with the bss attribute

None

[Description]

For sections in RAM, this function copies initial values for a section with the data attribute from the ROM area and clears a section with the bss attribute to 0.

The first and second parameters are used to pass the first and last addresses of the initialization table for a section with the data attribute.

The third and fourth parameters are used to pass the first and last addresses of the initialization table for a section with the bss attribute.

 

If the value of the first parameter is greater than or equal to that of the second parameter, the section with the data attribute is not initialized.

If the value of the third parameter is greater than or equal to that of the fourth parameter, the section with the bss attribute is not cleared to zero.

[Example]

struct {
    void *rom_s; //The first address of the section with the data attribute in the ROM
    void *rom_e; //The last address of the section with the data attribute in the ROM
    void *ram_s; //The first address of the section with the data attribute in the RAM
} _C_DSEC[M];
 
struct {
    void *bss_s; //The first address of the section with the bss attribute in the RAM
    void *bss_e; //The last address of the section with the bss attribute in the RAM
} _C_BSEC[N];
 
_INITSCT_RH(_C_DSEC, _C_DSEC + M, _C_BSEC, _C_BSEC + N);

Remark

When the start address of the .bss section is 0x100 and the size of the section is 0x50 bytes, the memory addresses that are actually cleared to 0 are 0x100, 0x101, ..., 0x14e, and 0x14f but specify addresses 0x100 and 0x150 in the initialization table.