Andes Workshop http://forum.andestech.com/ |
|
IntelJ3的程式說明(AICE讀寫API) http://forum.andestech.com/viewtopic.php?f=16&t=571 |
Page 1 of 1 |
Author: | cindy [ Fri Apr 20, 2012 7:11 pm ] |
Post subject: | IntelJ3的程式說明(AICE讀寫API) |
為了讓您更清楚intelj3 flash的架構,我寫了小程式來說明。 Intelj3裡只有5個function可以用,以及4個command。 5個function outw, inw, fastin, fastout, multiout 簡單的說..只有寫1個word,讀1個word, 及寫1片地址,讀1片地址。 最後一個是合併多個地址 資料。 4個command #define RESET_TARGET (0x3a) -->將板子reset #define RESET_HOLD (0x3b) -->將cpu reset之後停住,尚未執行boot code #define RESET_AICE (0x3c) -->reset AICE #define HOLD_CORE (0x1d) -->將cpu不執行指令 測試程式如附件,p1.gif是我的執行結果。(我是用SN801的板子測的) 上面說的5個function,是由AICE寫資料進去, 燒flash時,寫的是flash controller的寄存器。 但是其實寫memory也是同樣可以的。 所以我這裡是寫memory做為示範。 printf("--------------write an address---------------------\n"); outw(0x800000,0x12345678); -->寫 0x12345678到SRAM 0x800000裡面。 outw(0x900000,0x12345678); outw(0xA00000,0x12345678); //fastout(0x0, 4, buff1); value=inw(0x800000); printf("0x800000=%xu\n",value); value=inw(0x900000); printf("0x900000=%xu\n",value); fastout(0x800004, 8, buff1); -->寫0x41414141 0x41414141 value=inw(0x800004); printf("0x800004=%xu\n",value); value=inw(0x800008); printf("0x800008=%xu\n",value); 程式的執行流程 (1) 連接AICE (2) HOLD code或是RESET_HOLD (3) 燒code (4) 執行完成,RESET target。 總之...當您寫您的flash program時, 並不需要參考IntelJ3的spec。 您只要熟悉您的flash spec即可。照它的spec去寫寄存器。 Attachment: Attachment:
|
Author: | cindy [ Fri May 25, 2012 3:09 pm ] |
Post subject: | Re: IntelJ3的程式說明(AICE讀寫API) |
我改寫一版,在N9上測試。 差別在於其中有一行 RESET_HOLD我mark掉了。 讓板子跑完boot code,我才找的到DRAM的位置。 //send_cmd(RESET_HOLD); //Cindy Attachment: N9-intelj3.gif [ 18.93 KiB | Viewed 12494 times ] 下面是我簡化後的程式碼 Attachment:
|
Author: | cindy [ Wed Jan 30, 2013 10:28 am ] |
Post subject: | Re: IntelJ3的程式說明(AICE讀寫API) |
我把上面的code,去掉不必要的build參數。 這裡用最簡單的方法build。 步驟: 先開cygwin視窗,然後切到放code的地方。 build的command為 Code: g++ IntelJ3.cpp util.cpp 得到的執行檔為a.exe 執行後可以寫入memory。 Attachment: 整理後的code在這裡 Attachment: 這和上一篇的code完全相同,我只是整理一下如何build code。 |
Page 1 of 1 | All times are UTC + 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |