Esempio n. 1
0
/** Startup the C/C++ runtime environment.
 */
void reset_handler(void)
{
	int count;
	unsigned long *section_table_addr = &__data_section_table;

	/* copy ram load sections from flash to ram */
	while (section_table_addr < &__data_section_table_end)
	{
		unsigned long *src = (unsigned long *)*section_table_addr++;
		unsigned long *dst = (unsigned long *)*section_table_addr++;
		unsigned long  len = (unsigned long)  *section_table_addr++;

		for ( ; len; len -= 4)
		{
			*dst++ = *src++;
		}
	}

	/* zero initialize bss segment(s) */
	while (section_table_addr < &__bss_section_table_end)
	{
		unsigned long *zero = (unsigned long *)*section_table_addr++;
		unsigned long  len  = (unsigned long)  *section_table_addr++;

		for ( ; len; len -= 4)
		{
			*zero++ = 0;
		}
	}

	hw_preinit();

	/* call static constructors */

	count = __preinit_array_end - __preinit_array_start;
	for (int i = 0; i < count; i++)
	  __preinit_array_start[i] ();

	// If you need to run the code in the .init section, please use
	// the startup files, since this requires the code in crti.o and crtn.o
	// to add the function prologue/epilogue.
	//_init(); // DO NOT ENABE THIS!

	count = __init_array_end - __init_array_start;
	for (int i = 0; i < count; i++)
	  __init_array_start[i] ();
	//__libc_init_array();

	// allow interrupts
	asm("cpsie i");

	/* execute main */
	char *argv[] = {0};
	main(0, argv);

	for ( ; /* forever */ ;)
	{
		/* if we ever return from main, loop forever */
	}
}
Esempio n. 2
0
void wind_os_prelaunch(void)
{
    hw_preinit();
    exram_init();
    data_bss_init();
    wind_os_launch();
}
Esempio n. 3
0
/** Startup the C/C++ runtime environment.
 */
void reset_handler(void)
{
    unsigned long *section_table_addr = &__data_section_table;

    /* copy ram load sections from flash to ram */
    while (section_table_addr < &__data_section_table_end)
    {
        unsigned long *src = (unsigned long *)*section_table_addr++;
        unsigned long *dst = (unsigned long *)*section_table_addr++;
        unsigned long  len = (unsigned long)  *section_table_addr++;

        for ( ; len; len -= 4)
        {
            *dst++ = *src++;
        }
    }

    /* zero initialize bss segment(s) */
    while (section_table_addr < &__bss_section_table_end)
    {
        unsigned long *zero = (unsigned long *)*section_table_addr++;
        unsigned long  len  = (unsigned long)  *section_table_addr++;
        
        for ( ; len; len -= 4)
        {
            *zero++ = 0;
        }
    }

    //while(1);

    hw_preinit();

    /* call static constructors */
    __libc_init_array();

    /* execute main */
    char *argv[] = {0};
    main(0, argv);

    for ( ; /* forever */ ;)
    {
        /* if we ever return from main, loop forever */
    }
}