Andes Workshop

It is currently Fri Mar 29, 2024 12:16 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: IntelJ3的程式說明(AICE讀寫API)
PostPosted: Fri Apr 20, 2012 7:11 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
為了讓您更清楚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:
p1.gif
p1.gif [ 24.09 KiB | Viewed 12477 times ]

Attachment:
src-IntelJ3.7z [622.31 KiB]
Downloaded 1009 times


Last edited by cindy on Mon Jun 04, 2012 4:52 pm, edited 2 times in total.

Top
 Profile Send private message E-mail  
 
 Post subject: Re: IntelJ3的程式說明(AICE讀寫API)
PostPosted: Fri May 25, 2012 3:09 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
我改寫一版,在N9上測試。
差別在於其中有一行
RESET_HOLD我mark掉了。
讓板子跑完boot code,我才找的到DRAM的位置。
//send_cmd(RESET_HOLD);
//Cindy
Attachment:
N9-intelj3.gif
N9-intelj3.gif [ 18.93 KiB | Viewed 12386 times ]


下面是我簡化後的程式碼
Attachment:
src-IntelJ3.7z [622.05 KiB]
Downloaded 1013 times


Top
 Profile Send private message E-mail  
 
 Post subject: Re: IntelJ3的程式說明(AICE讀寫API)
PostPosted: Wed Jan 30, 2013 10:28 am 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
我把上面的code,去掉不必要的build參數。
這裡用最簡單的方法build。

步驟:
先開cygwin視窗,然後切到放code的地方。
build的command為
Code:
g++ IntelJ3.cpp util.cpp

得到的執行檔為a.exe
執行後可以寫入memory。
Attachment:
use.png
use.png [ 370.67 KiB | Viewed 11724 times ]


整理後的code在這裡
Attachment:
example.zip [494.72 KiB]
Downloaded 995 times

這和上一篇的code完全相同,我只是整理一下如何build code。


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group