Beispiel #1
0
/* This is called from a tiny assembly stub.  */
void __start1 (void *heap_limit)
{
  unsigned ix;
  
  if (hardware_init_hook)
    hardware_init_hook ();
  
  /* Initialize memory */
  if (__data_load != __data_start)
    memcpy (__data_start, __data_load, __bss_start - __data_start);
  memset (__bss_start, 0, __end - __bss_start);
  
  __heap_limit = heap_limit;
  
  if (software_init_hook)
    software_init_hook ();

  __INIT_SECTION__ ();

  /* I'm not sure how useful it is to have a fini_section in an
     embedded system.  */
  atexit (__FINI_SECTION__);
  
  ix = main (0, NULL, NULL);
  exit (ix);
  
  while (1)
    __reset ();
}
Beispiel #2
0
AFTER_VECTORS void ResetISR(void) {
    unsigned int LoadAddr, ExeAddr, SectionLen;
    unsigned int *SectionTableAddr;
    
    // Data Init
    SectionTableAddr = &__data_section_table;
    while (SectionTableAddr < &__data_section_table_end) {
        LoadAddr = *SectionTableAddr++;
        ExeAddr = *SectionTableAddr++;
        SectionLen = *SectionTableAddr++;
        data_init(LoadAddr, ExeAddr, SectionLen);
    }
    
    // BSS Init
    while (SectionTableAddr < &__bss_section_table_end) {
        ExeAddr = *SectionTableAddr++;
        SectionLen = *SectionTableAddr++;
        bss_init(ExeAddr, SectionLen);
    }
    
    SystemInit();
    if (software_init_hook) // give control to the RTOS
        software_init_hook(); // this will also call __libc_init_array
    else {
        __libc_init_array();
        main();
    }
    while (1) {;}
}
Beispiel #3
0
AFTER_VECTORS void ResetISR(void) {
    unsigned int LoadAddr, ExeAddr, SectionLen;
    unsigned int *SectionTableAddr;
    
    SectionTableAddr = &__data_section_table;
    
    while (SectionTableAddr < &__data_section_table_end) {
        LoadAddr = *SectionTableAddr++;
        ExeAddr = *SectionTableAddr++;
        SectionLen = *SectionTableAddr++;
        data_init(LoadAddr, ExeAddr, SectionLen);
    }
    while (SectionTableAddr < &__bss_section_table_end) {
        ExeAddr = *SectionTableAddr++;
        SectionLen = *SectionTableAddr++;
        bss_init(ExeAddr, SectionLen);
    }
    
    SystemInit();
    if (pre_main) { // give control to the RTOS
        software_init_hook();  // this will also call __libc_init_array
    }
    else {          // for BareMetal (non-RTOS) build
        __libc_init_array();
        main();
    }
    while (1) {;}
}
Beispiel #4
0
AFTER_VECTORS void ResetISR(void) {
    unsigned int LoadAddr, ExeAddr, SectionLen;
    unsigned int *SectionTableAddr;
    
    SectionTableAddr = &__data_section_table;
    
    while (SectionTableAddr < &__data_section_table_end) {
        LoadAddr = *SectionTableAddr++;
        ExeAddr = *SectionTableAddr++;
        SectionLen = *SectionTableAddr++;
        data_init(LoadAddr, ExeAddr, SectionLen);
    }
    while (SectionTableAddr < &__bss_section_table_end) {
        ExeAddr = *SectionTableAddr++;
        SectionLen = *SectionTableAddr++;
        bss_init(ExeAddr, SectionLen);
    }
    
    SystemInit();
    if (software_init_hook) 
        software_init_hook(); 
    else {
        __libc_init_array();
        main();
    }
    while (1) {;}
}
Beispiel #5
0
void _start(void)
{
    int bssSize = (int)&__bss_end__ - (int)&__bss_start__;
    int mainReturnValue;
    
    memset(&__bss_start__, 0, bssSize);
    
    if (MRI_ENABLE)
    {
        __mriInit(MRI_INIT_PARAMETERS);
        if (MRI_BREAK_ON_INIT)
            __debugbreak();
    }
    
    software_init_hook();
    __libc_init_array();
    mainReturnValue = main();
    exit(mainReturnValue);
}