2008年8月28日 星期四

寫一個能在 U-boot 上單獨執行的程式

U-Boot 支援在其 console 上單獨執行程式,這些程式能夠動態載入和單獨運行,這些單獨運行的應用程式能夠利用U-BOOT console 的 I/O 函數、記憶體管理和中斷服務等。讓這些應用程式能夠在沒有作業系統的情況下單獨執行,是測試硬體系統很好的方式。


先修改一支範例( U-Boot Examples 提供 ),程式如下:


/*
 * (C) Copyright 2000
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 * See file CREDITS for list of people who contributed to this
 * project.
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 *
 * Modify by Yi-Hua, Chiang. microcyh@seed.net.tw
 */


#include
#include


int hello_world (int argc, char *argv[])
{
  int i;


  /* Print the ABI version */
  app_startup(argv);


  printf ("Example expects ABI version %d\n", XF_VERSION);
  printf ("Actual U-Boot ABI version %d\n", (int)get_version());


  printf ("Hello World by CYH\n");


  printf ("argc = %d\n", argc);


  for (i=0; i<=argc; ++i)
  {
    printf ("argv[%d] = \"%s\"\n",
      i,
      argv[i] ? argv[i] : " ");
  }


  return (0);
}



程式執行結果:



沒有留言:

張貼留言

FPGA Verilog 的學習經驗,提供給要入門的新手

今天簡單說說 FPGA Verilog 的學習經驗,提供給要入門的新手: 1.對自己寫的FPGA Verilog程式,所生成的數位電路要心中有數。 這一點個人認為很重要,就正如寫 C語言,心中要能生成對應的組合語言一樣,我是這樣要求自己的。 雖然 FPGA Verilog語言...