0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

openFPGAloaderを使ってMacからFPGAへデザインを書き込む

Last updated at Posted at 2024-01-24

Macを使っていて困るのはFPGAの開発が非常に面倒なことです。これは主要なFPGAベンダーが一向にOSXをサポートしないことが原因ですが、ひとまず、FPGAのBuildはCloudなどの別環境で行うとして、生成されたBitファイルを手元のFPGAへ書き込みむことができれば、手元にLinuxPCなどを用意しなくてもFPGAの動作確認ができます。openFPGAloaderはこうした用途に使える便利なToolです。

インストール

Brewでサクッといけます。

brew install openfpgaloader

FPGAボードやJTAGアダプターの認識

FPGAボード(この例はDigilentのArty)をUSBで接続して

% openfpgaloader --detect
No cable or board specified: using direct ft2232 interface
Jtag frequency : requested 6.00MHz   -> real 6.00MHz

として認識できています。認識されない場合は

% openfpgaloader --scan-usb
found 23 USB device
Bus device vid:pid       probe type      manufacturer serial               product
008 023    0x0403:0x6014 ft232H          Digilent     210249AEBAE4         Digilent USB Device

結果からft232のJTAGケーブルということがわかるので、ケーブルを指定すれば認識されます。

openfpgaloader --detect --cable ft232
Jtag frequency : requested 6.00MHz   -> real 6.00MHz

サポートされているケーブルの一覧はこちらです。FTDI系はほぼ網羅されています。
https://trabucayre.github.io/openFPGALoader/compatibility/cable.html

サポートされているボードの一覧はこちらです。
https://trabucayre.github.io/openFPGALoader/compatibility/board.html

FPGAへの書き込み

例としてDigikentのArtyを使います。FPGAへの書き込みですが、SRAMの場合は

% openfpgaloader -b arty <YOUR_BITFILE>
Jtag frequency : requested 10.00MHz  -> real 10.00MHz
Open file DONE
Parse file DONE
load program
Flash SRAM: [==================================================] 100.00%
Done

デザインが完成して、Flashに焼く場合は

% openfpgaloader -f -b arty <YOUR_MCSFILE>
write to flash
Jtag frequency : requested 10.00MHz  -> real 10.00MHz
Open file DONE
Parse file DONE
use: /opt/homebrew/Cellar/openfpgaloader/0.11.0/share/openFPGALoader/spiOverJtag_xc7a35tcsg324.bit.gz
load program
Flash SRAM: [==================================================] 100.00%
Done
Detected: micron N25Q128 256 sectors size: 128Mb
00000000 00000000 00000000 00
Erasing: [==================================================] 100.00%
Done
Writing: [==================================================] 100.00%
Done

と、Bitファイルさえどこかで作成すれば、手元のMacでFPGAの動作検証ができます。Macでここまでちゃんと動くとは思ってなかったです。xc3sprogより断然使いやすいですね。

参照

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?