Abstract
有網友發現DE2_Nios_Lite 1.0在μC/OS-II無法執行,1.1版修正對μC/OS-II的支援。
Introduction
使用環境:Quartus II 7.2 SP3 + Nios II EDS 7.2 SP3 + DE2(Cyclone II EP2C35F627C6)
在(原創) DE2_NIOS_Lite 1.0 (SOC) (Nios II) (SOPC Builder) (DE2)中,網友kdjwangz8發現在μC/OS-II會出現以下錯誤訊息:
make -s all includes
Creating generated_app.mk
Creating system.h
2008 / 8 / 22 下午 11 : 33 : 49 - (嚴重的) generate: java.lang.IllegalStateException: java.lang.IllegalStateException: java.lang.NumberFormatException: empty String
make [ 1 ] : *** [ system_description/../obj/system.h-t ] Error 1
make: *** [ system_project ] Error 2
Build completed in 12.157 seconds
原因在於DE2_Nios_Lite 1.0中,我在SOPC Builder沒有加上timer ip,若沒上OS,沒有timer也無仿,但若上了OS,則一定要加上timer才行。DE2_NIOS_Lite 1.1加上了timer ip。
Remark
要能成功上μC/OS-II,還有幾個地方必須注意:
Step 1:
設定System clock timer
Step 2:
在SDRAM執行
預設會跑在onchip memory,由於onchip memory太小,μC/OS-II執行一定失敗,所以改跑在SDRAM上。
Step 3:
μC/OS-II Tutorial project template執行結果
nios2-terminal: " USB-Blaster [USB-0] " , device 1 , instance 0
nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate)
Hello from task1
****************************************************************
Hello From MicroC/OS-II Running on NIOS II. Here is the status:
The number of messages sent by the send_task: 39
The number of messages received by the receive_task1: 10
The number of messages received by the receive_task2: 3
The shared resource is owned by: getsem_task2
The Number of times getsem_task1 acquired the semaphore 30
The Number of times getsem_task2 acquired the semaphore 24
****************************************************************
****************************************************************
Hello From MicroC/OS-II Running on NIOS II. Here is the status:
The number of messages sent by the send_task: 51
The number of messages received by the receive_task1: 19
The number of messages received by the receive_task2: 6
The shared resource is owned by: getsem_task2
The Number of times getsem_task1 acquired the semaphore 60
The Number of times getsem_task2 acquired the semaphore 47
****************************************************************
完整程式碼下載
DE2_NIOS_Lite_11.7z
Conclusion
常常聽到初學者在問這個Java錯誤訊息,因為我沒有遇過,所以想幫也無能為力,經由這次的經驗,我發現這個錯誤主要是在產生system.h時發生,system.h簡單的說就是SOPC Builder的register map,這樣Nios II的C才能透過system.h所定義的macro去存取SOPC Builder內的各ip。這次的錯誤,是由於μC/OS-II一定要timer ip,但卻找不到SOPC Builder的timer ip來產生system.h而導致錯誤。因此下次遇到這個錯誤訊息,可以朝SOPC Builder所缺少的ip下手,若初學者對於手動在SOPC Builder加入ip有困難,DE2 CD的Nios II reference design是很好的範例,他已經將所有DE2的周邊都加上了,或者參考(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC Builder) (μC/OS-II)與(原創) DE2_NIOS_Lite 1.0 (SOC) (Nios II) (SOPC Builder) (DE2)。
See Also
(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC Builder) (μC/OS-II)
(原創) DE2_NIOS_Lite 1.0 (SOC) (Nios II) (SOPC Builder) (DE2)
(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統 (SRAM精簡版)? (SOC) (Quartus II) (Nios II) (SOPC Builder) (μC/OS-II) (DE2)
(原創) DE2_NIOS_Lite 1.2 (SOC) (Nios II) (SOPC Builder) (DE2)