コード例 #1
0
ファイル: __ppc_eabi_init.c プロジェクト: balisa/salut-lume
extern void __init_data(void)
{
	__pic_rom_copy_info *dci;
	__pic_bss_init_info *bii;
	int					delta = __get_runtime_linktime_delta();
	unsigned int		size;
	unsigned char 		*ram_addr;		/* address in ram (executing address) */
	unsigned char 		*ram_end;		/* end address in ram (executing address) */
	unsigned char 		*rom_addr;		/* address in rom */
	unsigned char 		*rom_end;		/* end address in rom */
	int					internal;
		
	/* for sda pic pid, if ram_end and ram_addr are swapped so that ram_end < ram_addr, 		*/
	/* then segment is internal, otherwise it is external.  for eabi, addresses are external 	*/

	dci = _pic_rom_copy_info;
	while (1) {
		if (dci->rom_addr == 0 && dci->ram_addr == 0 && dci->ram_end == 0) break;
		internal = (dci->rom_end < dci->rom_addr);
		if (internal) {
			rom_addr = dci->rom_end + delta;
			rom_end = dci->rom_addr + delta;
		} else {
			rom_addr = dci->rom_addr;
			rom_end = dci->rom_end;
		}
		internal = (dci->ram_end < dci->ram_addr);
		if (internal) {
			ram_addr = dci->ram_end + delta;
			ram_end = dci->ram_addr + delta;
		} else {
			ram_addr = dci->ram_addr;
			ram_end = dci->ram_end;
		}
		size = (unsigned int) (ram_end - ram_addr);
 		__copy_rom_section(ram_addr, rom_addr, size);
 		dci++;
	}
 
 	/* Initialize with zeros: */

	bii = _pic_bss_init_info;
	while (1) {
		if (bii->ram_addr == 0 && bii->ram_end == 0) break;
		internal = (bii->ram_end < bii->ram_addr);
		if (internal) {
			ram_addr = bii->ram_end + delta;
			ram_end = bii->ram_addr + delta;
		} else {
			ram_addr = bii->ram_addr;
			ram_end = bii->ram_end;
		}
		size = (unsigned int) (ram_end - ram_addr);
 		__init_bss_section(ram_addr, size);
 		bii++;
	}
	
	/* now that data is copied to ram, we can fix up initialized pointers */
	__mwerks_fixup_relocations();	
}
コード例 #2
0
ファイル: startcf.c プロジェクト: barriquello/brtos-gpsnet
/*
 *	Routine that copies all sections the user marked as ROM into
 *	their target RAM addresses ...
 *
 *	__S_romp is automatically generated by the linker if it
 *	is referenced by the program.  It is a table of RomInfo
 *	structures.  The final entry in the table has all-zero
 *	fields.
 */
static void __copy_rom_sections_to_ram(void)
{
	RomInfo		*info;

	/*
	 *	Go through the entire table, copying sections from ROM to RAM.
	 */
	for (info = _S_romp; info->Source != 0L || info->Target != 0L || info->Size != 0; ++info)
    __copy_rom_section( (char *)info->Target,(char *)info->Source, info->Size);
							
}
コード例 #3
0
ファイル: ROMCopy.c プロジェクト: rogercollins/bare_core
/*
 *	Routine that copies all sections the user marked as ROM into
 *	their target RAM addresses ...
 *
 *	__S_romp is defined in the linker command file
 *  It is a table of RomInfo
 *	structures.  The final entry in the table has all-zero
 *	fields.
 */
void __copy_rom_sections_to_ram(void)
{

	int				index;

	if (__S_romp == 0L) return;

	/*
	 *	Go through the entire table, copying sections from ROM to RAM.
	 */
	for (index = 0;
		 __S_romp[index].Source != 0 ||
		 __S_romp[index].Target != 0 ||
		 __S_romp[index].Size != 0;
		 ++index)
	{
		__copy_rom_section( __S_romp[index].Target,
							__S_romp[index].Source,
							__S_romp[index].Size );
	}
}