To content | To menu | To search

antonblanchard/microwatt をもう一度動かす

前のは間違いもあったので、今度は備忘録も兼ねてもう少し細かく。

2021年7月の話。

元の github はここ https://github.com/antonblanchard/microwatt

OS は Ubuntu (Xubuntu) 20.04 を使用。

micropython を動かすのに、クロスコンパイラが必要。

https://toolchains.bootlin.com/ ここで Select arch で powerpc64le-power8 、Select libc はとりあえずデフォルトの glibc を選んで、Download stable 。 今回ダウンロードしたものは powerpc64le-power8glibcstable-2020.08-1 だった。

とりあえずパスを通しておく。

$ export PATH="$PATH:/home/user/powerpc64le-power8--glibc--stable-2020.08-1/bin"

プレフィクスも設定しておく。

$ export CROSS_COMPILE="powerpc64le-linux-"

で、手順通り

$ git clone https://github.com/micropython/micropython.git
$ cd micropython
$ cd ports/powerpc
$ make -j$(nproc)
$ cd ../../../

ghdl は自力でビルドする必要があり、そのために前は gcc もビルドしていた。

ghdl のページはここ https://github.com/ghdl/ghdl 。ビルドの仕方はここ https://ghdl.github.io/ghdl/development/building/index.html 。

--とりあえず関連しそうなライブラリをインストール

$ sudo apt install libgmp-dev libmpfr-dev libmpc-dev libisl-dev
///--

前に一度やったことのある GCC でのビルド。手順はここ https://ghdl.github.io/ghdl/development/building/GCC.html

ミラーサイト https://gcc.gnu.org/mirrors.html から GCC のソースを取得。今日の時点では「4.9.x, 5.x, 6.x, 7.x, 8.x, 9.x or 10.x」と書かれていたので、その中で今日の時点で releases の中で最新の 10.3.0 を取得。

展開して Hint の内容を実行。

$ tar zvxf Downloads/gcc-10.3.0.tar.gz $ cd gcc-10.3.0 $ ./contrib/download_prerequisites


で、GHDL の手順を進める。

$ cd ~/ghdl $ mkdir build $ cd build $ ../configure with-gcc=/home/user/gcc-10.3.0 prefix=/usr/local $ make copy-sources $ mkdir gcc-objs; cd gcc-objs $ /home/user/gcc-10.3.0/configure prefix=/usr/local enable-languages=c,vhdl disable-bootstrap disable-lto disable-multilib disable-libssp disable-libgomp disable-libquadmath $ make -j2 $ sudo make install $ cd /home/user/ghdl/build $ make ghdllib $ sudo make install


これでインストールされているはず

$ cd ~ $ ghdl -v GHDL 2.0.0-dev (1.0.0.r538.g51d8774f) Dunoon edition

Compiled with GNAT Version: 9.3.0
GCC back-end code generator

Written by Tristan Gingold.

Copyright (C) 2003 - 2021 Tristan Gingold. GHDL is free software, covered by the GNU General Public License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


$ git clone https://github.com/antonblanchard/microwatt $ cd microwatt $ make


$ ln -s ../micropython/ports/powerpc/build/firmware.bin main_ram.bin $ ./core_tb > /dev/null


これで github のページの最初のアニメーション gif のように、1+2 を入力すると、しばらくすると 3 を返してくれるはずが、今回は返してくれなかった。原因は不明なものの、シミュレーションなのでひとまずスキップする。

Xilinx の Vivado のインストール先が違っていた。

$ source /tools/Xilinx/Vivado/2019.1/settings64.sh


pip3 が入ってなかった。fusesoc 入れた後パスが通ってないからねというコメントがでてたので設定。そして init 。ディレクトリ設定はよくわからないのでそのまま Enter 。

$ sudo apt install python3-pip $ pip3 install --user -U fusesoc $ export PATH="$PATH:/home/user/.local/bin" $ fusesoc init WARNING: The 'init' subcommand is deprecated and will be removed in the next release. It was intended to fetch the FuseSoC standard library. This can be done with 'fusesoc library add fusesoc_cores https://github.com/fusesoc/fusesoc-cores' instead. INFO: Writing configuration file to '/home/user/.config/fusesoc/fusesoc.conf' Directory to use for orpsoc-cores (old base library) /home/user/.local/share/fusesoc/orp... : INFO: Initializing orpsoc-cores INFO: Cloning library into /home/user/.local/share/fusesoc/orpsoc-cores Cloning into '/home/user/.local/share/fusesoc/orpsoc-cores'... remote: Enumerating objects: 2941, done. remote: Counting objects: 100% (10/10), done. remote: Compressing objects: 100% (10/10), done. remote: Total 2941 (delta 4), reused 0 (delta 0), pack-reused 2931 Receiving objects: 100% (2941/2941), 3.05 MiB | 3.28 MiB/s, done. Resolving deltas: 100% (1369/1369), done. Directory to use for fusesoc-cores (new base library) /home/user/.local/share/fusesoc/fus... : INFO: Initializing fusesoc-cores INFO: Cloning library into /home/user/.local/share/fusesoc/fusesoc-cores Cloning into '/home/user/.local/share/fusesoc/fusesoc-cores'... remote: Enumerating objects: 662, done. remote: Counting objects: 100% (213/213), done. remote: Compressing objects: 100% (148/148), done. remote: Total 662 (delta 92), reused 170 (delta 53), pack-reused 449 Receiving objects: 100% (662/662), 139.57 KiB | 4.10 MiB/s, done. Resolving deltas: 100% (236/236), done. INFO: FuseSoC is ready to use!


$ mkdir microwatt-fusesoc $ cd microwatt-fusesoc $ fusesoc library add microwatt /home/user/microwatt/ WARNING: The CAPI1 core file description format is deprecated and will be removed in the next major version of FuseSoC. Please port your core files to the CAPI2 format. INFO: Interpreting sync-uri '/home/user/microwatt/' as location for local provider. $ fusesoc run target=nexys_video microwatt memory_size=16384 --ram_init_file=/home/user/microwatt/fpga/hello_world.hex WARNING: The CAPI1 core file description format is deprecated and will be removed in the next major version of FuseSoC. Please port your core files to the CAPI2 format. INFO: Preparing :microwatt:litedram:0 INFO: Preparing ::uart16550:1.5.5-r1 INFO: Downloading olofk/uart16550 from github INFO: Preparing ::microwatt:0 INFO: Generating ::microwatt-litedram_nexys_video:0 Adding LiteDRAM for board... nexys-video INFO: Setting up project

INFO: Building vivado -notrace -mode batch -source microwatt_0.tcl application-specific initialization failed: couldn't load file "librdi_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory vivado -notrace -mode batch -source microwatt_0_run.tcl microwatt_0.xpr application-specific initialization failed: couldn't load file "librdi_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory INFO: Running vivado -notrace -mode batch -source microwatt_0.tcl application-specific initialization failed: couldn't load file "librdi_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory vivado -notrace -mode batch -source microwatt_0_run.tcl microwatt_0.xpr application-specific initialization failed: couldn't load file "librdi_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory export HW_TARGET=; \ export JTAG_FREQ=; \

vivado -quiet -nolog -notrace -mode batch -source microwatt_0_pgm.tcl -tclargs xc7a200tsbg484-1 microwatt_0.bit

application-specific initialization failed: couldn't load file "librdi_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory


エラーになったので足りないと思われるものを入れる

$ sudo apt install libtinfo5


FPGA ボードが接続されて電源が入っていないとエラーになるらしい。Vivado のケーブルドライバもインストールして実行し直したら

INFO: SUCCESS! FPGA xc7a200tsbg484-1 successfully programmed with bitstream microwatt_0.bit.


で書き込みまで完了した。

COM ポートを 115.2k で開いたら、「p」がひたすら出力され続けたり、0xc1 がひたすら出力され続けたりした。

ボード上の CPU_RESET ボタンを押したら一応起動メッセージはでたものの、その後はひたすら何か1文字繰り返し出力。

07:32:05:279 Welcome to Microwatt ! 07:32:05:279 07:32:05:279 Soc signature: f00daa5500010001 07:32:05:279 Soc features: UART DRAM BRAM SPIFLASH 07:32:05:279 BRAM: 16 KB 07:32:05:279 DRAM: 512 MB 07:32:05:279 DRAM INIT: 0 KB 07:32:05:279 CLK: 100 MHz 07:32:05:279 SPI FLASH ID: 010219 Cypress/Spansion (CF1=02) quad IO mode 07:32:05:279 SPI FLASH OFF: 0xa00000 bytes 07:32:05:279 07:32:05:279 LiteDRAM built from Migen 4fea1bd and LiteX 83d24d08 07:32:05:279 Initializing DRAM @0x40000000... 07:32:05:279 SDRAM now under software control 07:32:05:279 SDRAM now under software control 07:32:05:279 Read leveling: 07:32:05:279 m0, b00: |00000000000000000000000000000000| delays: - 07:32:05:322 m0, b01: |00000000000000000000000000000000| delays: - 07:32:05:322 m0, b02: |00000000000000000000000000000000| delays: - 07:32:05:322 m0, b03: |00000000000000000000000000000000| delays: - 07:32:05:322 m0, b04: |00000000000000000000000000000000| delays: - 07:32:05:322 m0, b05: |00000000000000000000000000000000| delays: - 07:32:05:322 m0, b06: |00000000000000000000000000000000| delays: - 07:32:05:322 m0, b07: |00000000000000000000000000000000| delays: - 07:32:05:322 m0, b08: |11111111111111100000000000000000| delays: 08+-08 07:32:05:322 m0, b09: |00000000000000000111111111111111| delays: 24+-07 07:32:05:373 m0, b10: |00000000000000000000000000000000| delays: - 07:32:05:373 m0, b11: |00000000000000000000000000000000| delays: - 07:32:05:373 m0, b12: |00000000000000000000000000000000| delays: - 07:32:05:373 m0, b13: |00000000000000000000000000000000| delays: - 07:32:05:373 m0, b14: |00000000000000000000000000000000| delays: - 07:32:05:373 m0, b15: |00000000000000000000000000000000| delays: - 07:32:05:373 best: m0, b08 delays: 07+-07 07:32:05:373 m1, b00: |00000000000000000000000000000000| delays: - 07:32:05:373 m1, b01: |00000000000000000000000000000000| delays: - 07:32:05:410 m1, b02: |00000000000000000000000000000000| delays: - 07:32:05:410 m1, b03: |00000000000000000000000000000000| delays: - 07:32:05:410 m1, b04: |00000000000000000000000000000000| delays: - 07:32:05:410 m1, b05: |00000000000000000000000000000000| delays: - 07:32:05:410 m1, b06: |00000000000000000000000000000000| delays: - 07:32:05:410 m1, b07: |00000000000000000000000000000000| delays: - 07:32:05:410 m1, b08: |11111111111111110000000000000000| delays: 08+-08 07:32:05:410 m1, b09: |00000000000000000111111111111111| delays: 24+-07 07:32:05:410 m1, b10: |00000000000000000000000000000000| delays: - 07:32:05:455 m1, b11: |00000000000000000000000000000000| delays: - 07:32:05:455 m1, b12: |00000000000000000000000000000000| delays: - 07:32:05:455 m1, b13: |00000000000000000000000000000000| delays: - 07:32:05:455 m1, b14: |00000000000000000000000000000000| delays: - 07:32:05:455 m1, b15: |00000000000000000000000000000000| delays: - 07:32:05:455 best: m1, b08 delays: 08+-08 07:32:05:455 SDRAM now under hardware control 07:32:05:455 Memtest at 0x0x40000000... 07:32:05:535 07:32:05:649 07:32:05:649 Memtest OK 07:32:05:649 Memspeed at 0x0x40000000... 07:32:05:679 Writes: 639 Mbps 07:32:05:711 Reads: 523 Mbps 07:32:05:711 Booting from BRAM...


次のコマンドを実行したら、変な文字列は流れなくなったものの、ブートメッセージ以降反応も無い

$ fusesoc run --target=nexys_video microwatt ///

Add a comment

HTML code is displayed as text and web addresses are automatically converted.

They posted on the same topic

Trackback URL : https://www.pseudomoon.jp/dotclear/index.php?trackback/136

This post's comments feed