• <li id="00i08"><input id="00i08"></input></li>
  • <sup id="00i08"><tbody id="00i08"></tbody></sup>
    <abbr id="00i08"></abbr>
  • 新聞中心

    EEPW首頁 > 嵌入式系統 > 設計應用 > 在20分鐘內建立一個NIOS II開發環境的方法

    在20分鐘內建立一個NIOS II開發環境的方法

    作者: 時間:2012-03-17 來源:網絡 收藏

    經過以上處理,就可以編譯和下載程序了。
    編譯項目
    從 Processing 菜單選Start compilation,或者Cntl+L,開始編譯。出現警告信息可以不管,等待編譯結束。

    配置 FPGA
    從Tools 菜單選擇Programmer,選擇JTAG 模式和對應的sof 文件,點擊Start,
    開始下載,如果成功,那么開始進入軟件調試

    啟動 IDE
    關閉 Programmer,打開頂層文件。快捷就是點圖標

    雙擊 low_cost_1C20 系統模塊,進入SOPC Builder。

    選擇 Run Nios IDE,進入IDE

    軟件工程文件
    選擇 File-》New -》Project 選項。

    選擇 C/C++ Application, 點擊Next。

    從模板中選擇 Hello LED,其他設置按默認設置,點擊Finish。

    編譯工程文件
    選中 hello_led_0,按右鍵,選擇 Build Project

    結束后,右下方的控制臺會提示編譯結束。

    運行程序
    從菜單中選擇 Run-》Run…,彈出對話框

    點擊 New,會自動生成系統配置。

    點擊 Apply,然后點擊Run。
    開始下載程序到 SDRAM,并運行起來。

    觀察板上的 4 個LED,大概沒隔4 秒,LED 會輪流閃爍一次。
    恭喜您,第 C 程序在 CPU 上已經運行起來了。
    如果感興趣,可以修改源文件,然后在編譯,運行,看看 LED 有什么變化
    以下是讓 LED 閃爍更頻繁的例子:
    int main (void) __attribute__ ((weak, alias (alt_main)));
    /*
    * Use alt_main as entry point for this free-standing application
    */
    int alt_main (void)
    {
    alt_u8 led = 0x2;
    alt_u8 dir = 0;
    volatile int i;
    /*
    * Infinitly shift a variable with one bit set back and forth, and write
    * it to the LED PIO. Software loop provides delay element.
    */
    while (1)
    {
    if (led 0x09) // 我們板上只有4個LED,所以當led的Bit3和Bit0有效的時候,
    //就改變方向;
    {
    dir = (dir ^ 0x1);
    }
    if (dir)
    {
    led = led >> 1;
    }
    else
    {
    led = led 1;
    }
    IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, led);
    /*
    * The delay element in this design has been written as a while loop
    * to avoid confusing the software debugger. A tight, one line software
    * delay loop such as:
    * for(i=0; i200000; i++);
    * can cause problems when it is stepped through using a software
    debugger.
    * The while loop below produces the same behavior as the for loop shown
    * above, but without causing potential debugger problems.
    */
    i = 0;
    while (i100000) //加快閃爍間隔
    i++;
    }
    return 0;
    }

    本文引用地址:http://www.czjhyjcfj.com/article/149395.htm
    上一頁 1 2 下一頁

    評論


    相關推薦

    技術專區

    關閉
    主站蜘蛛池模板: 延川县| 涟源市| 广东省| 肇东市| 铜山县| 内黄县| 金溪县| 东乡县| 兰州市| 雷州市| 福贡县| 镇远县| 余江县| 吉安县| 富顺县| 泰宁县| 赤壁市| 名山县| 奇台县| 报价| 石门县| 卓资县| 分宜县| 全椒县| 边坝县| 亳州市| 宁晋县| 溆浦县| 贵德县| 万宁市| 山西省| 金寨县| 舟山市| 西华县| 灵璧县| 全南县| 溧水县| 松潘县| 莒南县| 巨鹿县| 太仓市|