コード例 #1
0
ファイル: main.c プロジェクト: fjrti/remix
int main( void )
{
    int i;
    FILE* fp;

    // Initialize platform first
    if( platform_init() != PLATFORM_OK )
    {
        // This should never happen
        while( 1 );
    }

    // Initialize device manager
    dm_init();

    // Register the ROM filesystem
    dm_register( romfs_init() );

    // Register the MMC filesystem
    dm_register( mmcfs_init() );

    // Register the Semihosting filesystem
    dm_register( semifs_init() );

    // Search for autorun files in the defined order and execute the 1st if found
    for( i = 0; i < sizeof( boot_order ) / sizeof( *boot_order ); i++ )
    {
        if( ( fp = fopen( boot_order[ i ], "r" ) ) != NULL )
        {
            fclose( fp );
            char* picoc_argv[] = { "picoc", boot_order[i], NULL };
            picoc_main( 2, picoc_argv );
            break; // autoruns only the first found
        }
    }

    // Run the shell
    if( shell_init() == 0 )
    {
        // Start picoc directly
        char* picoc_argv[] = { "picoc", NULL };
        picoc_main( 1, picoc_argv );
    }
    else
        shell_start();

    while( 1 );
}
コード例 #2
0
ファイル: main.c プロジェクト: ramangopalan/elua
int main( void )
{
  int i;
  FILE* fp;

  // Initialize platform first
  if( platform_init() != PLATFORM_OK )
  {
    // This should never happen
    while( 1 );
  }

  // Initialize device manager
  dm_init();

  // Register the ROM filesystem
  romfs_init();

  // Register the MMC filesystem
  mmcfs_init();

  // Register the Semihosting filesystem
  semifs_init();

  // Register the remote filesystem
  remotefs_init();

  // Register NIFFS
  nffs_init();

  // Search for autorun files in the defined order and execute the 1st if found
  for( i = 0; i < sizeof( boot_order ) / sizeof( *boot_order ); i++ )
  {
    if( ( fp = fopen( boot_order[ i ], "r" ) ) != NULL )
    {
      fclose( fp );
      char* lua_argv[] = { (char *)"lua", (char *)boot_order[i], NULL };
      lua_main( 2, lua_argv );
      break; // autoruns only the first found
    }
  }

#ifdef ELUA_BOOT_RPC
  boot_rpc();
#else
  
  // Run the shell
  if( shell_init() == 0 )
  {
    // Start Lua directly
    char* lua_argv[] = { (char *)"lua", NULL };
    lua_main( 1, lua_argv );
  }
  else
    shell_start();
#endif // #ifdef ELUA_BOOT_RPC

#ifdef ELUA_SIMULATOR
  hostif_exit(0);
  return 0;
#else
  while( 1 );
#endif
}