FPGA開発日記

カテゴリ別記事インデックス https://msyksphinz.github.io/github_pages , English Version https://fpgadevdiary.hatenadiary.com/

Rocket-Chip を ZedBoardにインプリしてLinuxを動作させる (Cygwinでやったら失敗した編)

RISC-Vの実装として、Rocket-Chipがある。

ucb-bar/rocket · GitHub

そして、このRocketはZynqプラットフォームで動作するように設計されている (そのためのラッパーがある)。

ucb-bar/fpga-zynq · GitHub

これを使って、ZedBoardにRISC-Vを実装してLinuxを動作させよう! まずはこれを参照した。

http://riscv.org/download.html#tab_zynqfpga

まずはQuick Instructionをやってみることにした。 以下の2つのリポジトリをクローンする。

git clone https://github.com/ucb-bar/rocket-chip.git
cd rocket-chip
git@github.com:ucb-bar/fpga-zynq.git

階層構造は上記の構造が良いようだ。 次に、zedboard上で動作するプラットフォームが作りたいので、

cd fpga-zynq/zedboard
make project
make bitstream

これで、Zynqで動作するビットストリームが完成する。

これを元に、FSBLを作っておこう。

Vivadoを使ってビットストリームを含むプロジェクトをオープンする。

f:id:msyksphinz:20150222162441j:plain

いつものように、Export HWをしてから、Launch SDKSDKを立ち上げた。

  • [File]-->[Export]-->[Export HW]
  • [File]-->[Launch SDK]

SDKが立ち上がる。

f:id:msyksphinz:20150222162552j:plain

新しいプロジェクトを作って、FSBLを作成しよう。

  • [File]-->[Project]-->[New Application Project]

f:id:msyksphinz:20150222162707j:plain

Nextを押して、[Available Template]で[Zynq FSBL]を選択して [Finish]を選択する。

f:id:msyksphinz:20150222162811j:plain

ここで詰まった。エラー発生。

f:id:msyksphinz:20150222162830j:plain

訳が分からないので、SDKのログを見てみた。

15:35:13 INFO  : Processing command line option -hwspec C:/usr/risc-v/rocket-chip/fpga-zynq/zedboard/zedboard_rocketchip/zedboard_rocketchip.sdk/rocketchip_wrapper.hdf.
15:35:13 INFO  : Checking for hwspec changes in the project rocketchip_wrapper_hw_platform_0.
15:35:13 INFO  : SDK has detected change in the last modified timestamps for source hardware specification file Source:1424586899494,  Project:1424585997779
15:35:13 INFO  : The hardware specification for project 'rocketchip_wrapper_hw_platform_0' is different from C:/usr/risc-v/rocket-chip/fpga-zynq/zedboard/zedboard_rocketchip/zedboard_rocketchip.sdk/rocketchip_wrapper.hdf.
15:35:13 INFO  : Copied contents of C:/usr/risc-v/rocket-chip/fpga-zynq/zedboard/zedboard_rocketchip/zedboard_rocketchip.sdk/rocketchip_wrapper.hdf into \rocketchip_wrapper_hw_platform_0\system.hdf.
15:35:14 INFO  : Launching XSDB server: xsdb.bat -s C:/Xilinx/SDK/2014.4/scripts/xsdb/xsdb/xsdb-server.tcl 2450
15:35:14 INFO  : Synchronizing projects in the workspace with the hardware platform specification changes.
15:35:14 INFO  : Clearing existing target manager status.
15:35:17 INFO  : Workspace synchronized with the new hardware specification file. Cleaning dependent projects...
15:35:21 ERROR :  [Hsi 55-1464] Hardware instance __EMPTY__ not found in the design
 [Hsi 55-1464] Hardware instance __EMPTY__ not found in the design
 [Common 17-55] 'get_property' expects at least one object.
Resolution: If [get_<value>] was used to populate the object, check to make sure this comm     and returns at least one valid object.
15:35:21 ERROR :  [Hsi 55-1464] Hardware instance __EMPTY__ not found in the design
 [Hsi 55-1464] Hardware instance __EMPTY__ not found in the design
 [Common 17-55] 'get_property' expects at least one object.
Resolution: If [get_<value>] was used to populate the object, check to make sure this comm     and returns at least one valid object.
15:35:42 ERROR :  [Hsi 55-1464] Hardware instance __EMPTY__ not found in the design
 [Hsi 55-1464] Hardware instance __EMPTY__ not found in the design
15:35:43 ERROR :  [Hsi 55-1464] Hardware instance __EMPTY__ not found in the design
 [Hsi 55-1464] Hardware instance __EMPTY__ not found in the design
15:35:44 ERROR :  [Common 17-55] 'get_property' expects at least one object.
Resolution: If [get_<value>] was used to populate the object, check to make sure this comm     and returns at least one valid object.
 [Hsi 55-1545] Problem running tcl command ::sw_generic_v2_0::generate : ERROR: [Common 17-55] 'get_property' expects at least one object.
Resolution: If [get_<value>] was used to populate the object, check to make sure this comm     and returns at least one valid object.
    while executing
"get_property NAME $periph"
    ("foreach" body line 3)
    invoked from within
"foreach periph $periphs {
   puts $file_handle ""
   puts $file_handle "/* Definitions for peripheral [string toupper [get_property NAME $periph]] */"..."
    (procedure "::hsm::utils::define_addr_params" line 12)
    invoked from within
"::hsm::utils::define_addr_params $drv_handle "xparameters.h" "
    (procedure "::sw_generic_v2_0::generate" line 3)
    invoked from within
"::sw_generic_v2_0::generate __EMPTY__"
 [Hsi 55-1442] Error(s) while running TCL procedure generate()
15:35:44 ERROR : Error generating bsp sources: Failed to generate BSP.

こりゃなんだ?

15:35:21 ERROR :  [Hsi 55-1464] Hardware instance __EMPTY__ not found in the design

ググってみると、うーん、

http://forums.xilinx.com/t5/Embedded-Linux/Problem-with-devicetree-generation/td-p/556758

Programmers of Xilinx can't deal with backslashes in TCL, lol.

TCLの中のバックスラッシュ?上記のURLは別のプロジェクトのようなので、パッチは参考にならなさそう(やってみたがダメだった)。

これを解決するためには、もしかしてLinux上でやらないとダメなのかなあ、、、あんまり変なところで詰まりたくないので、Linux上にVivadoをインストールしてやってみるか。。。(ふりだしに戻る)