1. 開發環境:
(1). CPU: Andes RISC CPU core_N12.
(2). 平台: ADP-XC5FF676 V1.1.
(3). Windows OS: MS-Windows XP.
(4). Toolchains: AndeSight v1.4 for MS-Windows XP.
2. 實驗目的:
(1). 使用ESL模擬平台環境下軟體中斷(IRQ)控制.
(2). 此實驗目的主要是讓使用了解Andes Core中斷向量表與中斷相關暫存器的設置與使用,中斷處理程式的編寫,最終藉由程式碼觸發軟體中斷,軟體中斷處理程式中透過UART傳送文字字串至終端機上顯示.
(3). 使用STD C Project增加新的project.
(4). 增加.VEP內SID元件.
3. 實驗步驟:
(1). 建立新的STD C Project,使用滑鼠選擇〝
File〞->〝
New〞->〝
STD C Project〞.

程式下載:
http://cid-b01cb9ac20175eaa.office.live.com/self.aspx/5%5E_AndeSight%5E_VEP%5E_ESL%5E_SWI%5E5IRQ%5E6/5%5E_AndeSight%5E_VEP%5E_ESL%5E_SWI%5E5IRQ%5E6.zip
(2). 在〝
Project name:〞欄位輸入計畫名稱,這裡輸入〝
IRQ〞,之後按下〝
Next>〞至下個一歨驟.

(3). 不需做任何設定,按〝
Finish〞結束選擇.

(4). 接下來要加入已撰寫好的程式,先使用〝
滑鼠左鍵〞點選Project,再點選〝
滑鼠右鍵〞,之後選擇〝
Import〞.

(5). 使用滑鼠點選〝
File System〞後,按〝
Next>〞至下一個走驟.

(6). 在〝
From directory:〞欄位輸入遇加入程式的路徑,這裡按〝
Browse〞來選擇.

(7). 選擇程式路徑,這裡選擇〝
IRQ〞後按〝
確定〞.

(8). 勾選遇加入的程式檔案,選擇完畢按〝
Finish〞.
注意: 增加檔案時,如有〝
.cdtbuild〞,〝
.cdtproject〞,〝
.project〞的Project參數設定檔案請勿加入,以免覆蓋掉目前產生的Project參數.

(9). 最後編譯程式,先使用〝
滑鼠左鍵〞點選Project,再點選〝
滑鼠右鍵〞,之後選擇〝
Build Project〞.

(10). 接下來修改〝
.VEP〞,使用滑鼠點選〝
swi.vep〞,編輯視窗顯示目前的模擬架構.

(11). 將滑鼠游標移動至〝
Palette〞,這時會跳出所有模組的元件.

(12). 使用滑鼠用拖拉的方式加入〝
APB〞,〝
Uart〞元件,之後再用〝
Connect〞將元件依照下圖所示連結起來.

(13). 設定Uart參數前,需開啟相關視窗,使用滑鼠選擇〝
Window〞->〝
Other〞.

(14). 使用〝
Ctrl+
滑鼠左鍵〞再選擇〝
Clock Setting〞與〝
Memory Map〞,選擇好後按〝
OK〞.

(15). 之後選擇〝
Clock Setting〞視窗,〝
Clock Setting〞欄位為下拉式選單,依照下圖所示選擇〝
APB〞參數.

(16). 之後選擇〝
Memory Map〞視窗,在APB下Uart的〝
Base〞欄位輸入〝
0x99600000〞, 〝
Size(Byte)〞欄位輸入〝
0x00000020〞,其他參數會自動加入.

(17). 之後按〝
Save〞圖示ICOM存檔.

(18). 接下來要啟動之前設定好的ESL〝
.VEP〞設定檔,使用滑鼠擇〝
Target〞->〝
Fork VEP Target〞.

(19). 按〝
Browse...〞選擇project下已修改好的.VEP檔後按 〝
Finish〞.

(20). 最後可以看到模擬平台的VEP產生.

(21). 接下來要執行程式,先使用〝
滑鼠左鍵〞點選Project,再點選〝
滑鼠右鍵〞,之後選擇〝
Run As〞->〝
Run〞.

(22). 使用〝
滑鼠左鍵〞點兩下〝
Cross Platform Application〞.

(23). 之後如下圖所示.

(24). 之後再選擇〝
Debugger〞,在〝
GDB debugger:〞欄位選擇〝
nds32le-elf-gdb.exe〞的路徑,按〝
Browse〞選擇,設定完畢後按〝
Run〞.
注意: 〝
nds32le-elf-gdb.exe〞的選擇要與這個STD C Project下makefile所設定的編譯器〝
nds32le-elf-gcc〞路徑參數相同.

(25). 最後會在Console(Uart)模擬視窗顯示結果.

(26). 終止程式需按下〝
Terminate〞.

(27). 最後當程式執行完畢,需要修改程式之前,先至跳至〝
Debug〞視窗,請按〝
Remove All Terminated Launches〞圖示ICOM,將此次的程式設定清除.
沒有留言:
張貼留言