Beispiel #1
0
void __thumb_startup(void)
{
		// Setup registers
		__init_registers();

		// setup hardware
		__init_hardware();


#if defined(__APCS_ROPI) || defined(__APCS_RWPI)
		//	static base register initialization
		__load_static_base();
#endif
#if defined(__APCS_RWPI)
		//	-pid
		//	setup static base for SB relative position independent data
		//	perform runtime relocation
		__init_pid();
#endif
#if defined(__APCS_ROPI)
		//	-pic
		//	perform runtime relocation for position independent code
		__init_pic();
#endif
		//	zero-fill the .bss section
		zero_fill_bss();

#if SUPPORT_ROM_TO_RAM
		if (__S_romp != 0L)
			__copy_rom_sections_to_ram();
#endif


		//      initialize the floating-point library
#ifdef __VFPV4__
		__fp_init();
#endif

		//	call C++ static initializers
		__call_static_initializers();

		// initializations before main, user specific
		__init_user();

#if defined(__SEMIHOSTING)
		// semihost initializations
		__init_semihost();
#endif

		//	call main(argc, &argv)
#if SUPPORT_SEMIHOST_ARGC_ARGV
		exit(main(__argc_argv(argv, __MAX_CMDLINE_ARGS), argv));
#else
		exit(main(0, argv));
#endif

		//	should never get here
		while (1);

}
Beispiel #2
0
extern "C" void *MSL_Initialize(void *first_available_memory) {
#ifdef _ODYSSEY
	
	Init_Hardware();
	
	Init_Address();

	// The system heap must be initialized first, before any other static initializers.

	// Build a list of reserved memory.
	int nReserved=3 + (gSizeReserved? 1 :0);

	// Pci slave memory is reserved
	aPaRes[0] = memmaps.paSlave;
	aCbRes[0] = memmaps.cbSlave;
	
	// 1MB from zero belongs to boot rom
	aPaRes[1]=0;
	aCbRes[1]=0x00100000;

	// Operating system code
	aPaRes[2]=PA_P(_ftext);
	aCbRes[2]=((char*)first_available_memory - _ftext);

	// Any reserved memory
	if (gSizeReserved) {
		aPaRes[3]=PA_P(first_available_memory);
		aCbRes[3]=gSizeReserved;
		}

	// Copy memmap fragment list to static array so there is room to expand.
	bcopy(&memmaps.aPa[0], &aPa[1], memmaps.nFragment * sizeof(aPa[0]));
	bcopy(&memmaps.aCb[0], &aCb[1], memmaps.nFragment * sizeof(aCb[0]));

	// Pci slave memory is 1st fragment.
	aPa[0]=memmaps.paSlave;
	aCb[0]=memmaps.cbSlave;

	OsHeap_Initialize(memmaps.nFragment+1, aPa, aCb, nReserved, aPaRes, aCbRes, ((bootblock.b_cbHeap && bootblock.b_cbHeap != 0xDEADDEAD)? bootblock.b_cbHeap : gSize_small_heap));

#else	// eval
	// Pci slave memory is 1st fragment.
	aPa[0]=PA_P((U32)first_available_memory + gSizeReserved);
	aCb[0]=gSize_small_heap * 3;

	// Available memory is 2nd fragment
	aPa[1]=aPa[0] + aCb[0];
	aCb[1]=gSize_total_memory - aPa[1];

	// Build a list of reserved memory.
	int nReserved=3 + (gSizeReserved? 1 :0);

	// Pci slave memory is reserved
	aPaRes[0] = aPa[0];
	aCbRes[0] = aCb[0];
	
	// 1MB from zero belongs to boot rom
	aPaRes[1]=0;
	aCbRes[1]=0x00100000;

	// Operating system code
	aPaRes[2]=PA_P(_ftext);
	aCbRes[2]=((char*)first_available_memory - _ftext);

	// Any reserved memory
	if (gSizeReserved) {
		aPaRes[3]=PA_P(first_available_memory);
		aCbRes[3]=gSizeReserved;
		}

	OsHeap_Initialize(2, aPa, aCb, nReserved, aPaRes, aCbRes, gSize_small_heap);
#endif

	__call_static_initializers(__static_init);

	// Some memory left over for debugging.
	return first_available_memory;
	}