1. 程式人生 > >使用Nios II 10.0sp1 Command Shell [gcc3]合併sof和elf檔案——除錯記錄

使用Nios II 10.0sp1 Command Shell [gcc3]合併sof和elf檔案——除錯記錄

開發環境:

電腦win7_64;Quartus II 10.0;Nios II 10.0;FPGA:EP4CE10。

1.Nios軟體存在的bug及解決思路:

Nios II Flash Programmer 下載後無法從EPCS自舉,具體現象如下:

Using cable "USB-Blaster [USB-0]", device 1, instance 0x00

Pausing target processor: not responding.

Resetting and trying again: FAILED

Leaving target processor paused

2.解決思路:

使用Nios II 10.0sp1 Command Shell [gcc3]軟體,將sof和elf檔案合併後轉換為jic檔案,需要用到的指令碼程式碼如下,程式碼可以直接複製到空記事本中,檔案另存為yj.sh。

sof="EP4.sof"
elf="YJ_NiosTest.elf"
echo "sof>flash ..."; sof2flash --epcs --input=$sof --output=sof.flash --quiet
echo "elf>flash ..."; elf2flash --epcs --after=sof.flash --input=$elf --output=elf.flash
echo "cat flash ..."; cp sof.flash sof_elf.flash; cat elf.flash >> sof_elf.flash
echo "flash>hex ..."; nios2-elf-objcopy --input-target srec --output-target ihex sof_elf.flash sof_elf.hex
echo "del flash ..."; rm -f *.flash

3.遇到的問題

提示部分程式無許可權,具體現象如下:

網上常見的解決方法:

解決辦法:因為在win7下的許可權問題.具體解決方法參考下面的方法: Under your Quartus II folder, go to bin->cygwin->bin folder, select the following files in the list below and then right-click and choose Properties. Under the Compatibility tab, check “Run this program in compatibility mode for:” and choose “Windows XP (Service Pack 2)”. Check “Run this program as an administrator”, as well. Here is the list of files that you can select to change their compatibility mode under the Quartus II->bin->cygwin->bin folder: 1. Make.exe 2. Sh.exe 3. Echo.exe 4. Cygstart.exe 5. MakeInfo.exe 6. Perl.exe 7.Collect2.exe(undernios2edsbinnios2-gnutoolsH-i686-pc-cygwinlibexecgccnios2-elf3.4.6) 8. Nios2-elf-g++.exe (under nios2edsbinnios2-gnutools H-i686-pc-cygwinbin) 在英文網上查到的,這幾個不同的exe檔案在不同的bin資料夾之間,依次右擊改掉屬性,把允許管理員使用許可權前面打上勾即可.

上面的解決方法基本是無效的,怎麼修改程式的許可權也沒具體交代!

4. 解決辦法

將當前使用者切換至管理員Administrator,在該使用者模式下使用Nios II 10.0sp1 Command Shell [gcc3]軟體,指令碼執行效果如下

sof_elf.hex檔案已成功生成,現在只需要使用Quartus II軟體將其轉換成jic檔案即可!