LO位相同期機能を備えたGRC用独自ブロックのビルド方法(USRP X300用)

2022/05/19 2:03 PM

USRP X300シリーズ用のLO位相同期機能を備えたGRC(GNU Radio Companion)用独自ブロックをビルドして,GRC上で利用可能とする手順を以下に示す.独自ブロックの名称は,下記である.

  1. USRP_UTC_Sink
  2. USRP_UTC_Source

上記の独自ブロックのソースコードは,gr-USRP_UTC_SYNC.zipとして,こちらのリンク先で公開している.まず,ビルドの準備を行う.

$ mkdir foo
$ cp gr-USRP_UTC_SYNC.zip foo
$ cd foo
$ unzip gr-USRP_UTC_SYNC.zip
$ cd ..

$ gr_modtool newmod USRP_UTC_SYNC
$ cd gr-USRP_UTC_SYNC

次に,以下のように入力して,独自ブロックUSRP_UTC_Sinkをビルドするための指定を行う.

$ gr_modtool add -t hier -l python

下記の朱書きのように入力する.

GNU Radio module name identified: USRP_UTC_SYNC
Language: Python
Enter name of block/code (without module name prefix): USRP_UTC_Sink
Block/code identifier: USRP_UTC_Sink
Please specify the copyright holder: T.Nakahama
Enter valid argument list, including default arguments:

Enter valid argument list, including default arguments: と聞いてくるので,以下の引数を入力する.正しく指定する必要があるので,下記の内容をコピー&ペーストすることをお薦めする.

■USRP_UTC_Sink.py のスケルトンファイル生成時に指定する引数
device_address, device_arguments, subdev_spec,num_channels, samp_rate,lo_mode,rf_freq,dsp_freq,antenna0,antenna1,gain_value0,gain_value1,start_time

引き続き,独自ブロックUSRP_UTC_Sourceをビルドするための指定を行う.

$ gr_modtool add -t hier -l python

先ほどと同様に,下記の朱書きの部分を入力する.

GNU Radio module name identified: USRP_UTC_SYNC
Language: Python
Enter name of block/code (without module name prefix): USRP_UTC_Source
Block/code identifier: USRP_UTC_Source
Please specify the copyright holder: T.Nakahama
Enter valid argument list, including default arguments:

先ほどと同様に,Enter valid argument list, including default arguments: と引数の入力を促される.下記の内容をコピー&ペーストして指定する.

■USRP_UTC_Source.py のスケルトンファイル生成時に指定する引数
device_address, device_arguments, subdev_spec, num_channels, samp_rate, lo_mode, rf_freq, dsp_freq, antenna0, antenna1, gain_value0, gain_value1, start_time,fractional_time

バックアップの意味で下記のようにファイルをコピーして,さらに配布パッケージ内の.pyファイルを所定の位置にコピーする.

$ cd python
$ cp USRP_UTC_Sink.py USRP_UTC_Sink.py.org
$ cp ~/foo/gr-USRP_UTC_SYNC/python/USRP_UTC_Sink.py ./
$ cp USRP_UTC_Source.py USRP_UTC_Source.py.org
$ cp ~/foo/gr-USRP_UTC_SYNC/python/USRP_UTC_Source.py ./
$ cd ..

同様に,.ymlファイルをバックアップの意味でコピーしておき,配布パッケージ内の.ymlファイルを所定の位置にコピーする.

$ cd grc
$ cp USRP_UTC_SYNC_USRP_UTC_Sink.block.yml USRP_UTC_SYNC_USRP_UTC_Sink.block.yml.org
$ cp ~/foo/gr-USRP_UTC_SYNC/grc/USRP_UTC_SYNC_USRP_UTC_Sink.block.yml ./
$ cp USRP_UTC_SYNC_USRP_UTC_Source.block.yml USRP_UTC_SYNC_USRP_UTC_Source.block.yml.org
$ cp ~/foo/gr-USRP_UTC_SYNC/grc/USRP_UTC_SYNC_USRP_UTC_Source.block.yml ./
$ cd ..

以上でビルドの準備が整ったので,以下の手順によりビルド作業を進めて行く.

$ mkdir build
$ cd build
$ cmake ../
— PyBOMBS installed GNU Radio. Setting CMAKE_INSTALL_PREFIX to /home/yyama/gr38
— Build type not specified: defaulting to release.
— Using GMP.
— User set python executable /usr/bin/python3
— No C++ sources… skipping lib/
— No C++ sources… skipping swig/
— Configuring done
— Generating done
— Build files have been written to: /home/yyama/gr-USRP_UTC_SYNC/build

$ make
[ 0%] Built target pygen_apps_9a6dd
[ 33%] Generating documentation with doxygen
warning: Tag 'PERL_PATH’ at line 1686 of file '/home/yyama/gr-USRP_UTC_SYNC/build/docs/doxygen/Doxyfile’ has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using “doxygen -u"
warning: Tag 'MSCGEN_PATH’ at line 1707 of file '/home/yyama/gr-USRP_UTC_SYNC/build/docs/doxygen/Doxyfile’ has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using “doxygen -u"
[ 33%] Built target doxygen_target
Scanning dependencies of target pygen_python_ba8c8
[ 66%] Generating init.pyc, USRP_UTC_Sink.pyc, USRP_UTC_Source.pyc
[100%] Generating init.pyo, USRP_UTC_Sink.pyo, USRP_UTC_Source.pyo
[100%] Built target pygen_python_ba8c8

$ make install
[ 0%] Built target pygen_apps_9a6dd
[ 33%] Built target doxygen_target
[100%] Built target pygen_python_ba8c8
Install the project…
— Install configuration: “Release"
— Up-to-date: /home/yyama/gr38/lib/cmake/USRP_UTC_SYNC/USRP_UTC_SYNCConfig.cmake
— Up-to-date: /home/yyama/gr38/include/USRP_UTC_SYNC/api.h
— Up-to-date: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/main__page_8dox.xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/dir_0fee939d68a87f22bb24cf3be2edbf60.xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/index.xsd
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/dir_49e56c817e5e54854c35e136979f97ca.xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/compound.xsd
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/group__block.xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/indexpage.xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/group__defs_8dox.xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/combine.xslt
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/index.xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/dir_359d2bec989c9a8deeeb9aee335c1c76.xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/dir_f2cd86917185299abf5a1f0679072f3c.xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/namespacestd.xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/api_8h.xml
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/xml/dir_d44c64559bbebec7f509842c48db8b23.xml
— Up-to-date: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/tabs.css
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/folderclosed.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/navtree.js
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/main__page_8dox.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/tab_s.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/tab_h.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/tab_b.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/folderopen.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/api_8h.js
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/navtreeindex0.js
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/tab_a.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/api_8h.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/bdwn.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/globals.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/nav_h.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/navtreedata.js
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/resize.js
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/modules.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/doxygen.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/globals_defs.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/doxygen.css
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/modules.js
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/navtree.css
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/jquery.js
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/dynsections.js
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/dir_359d2bec989c9a8deeeb9aee335c1c76.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/files.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/nav_f.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/sync_off.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/index.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/api_8h_source.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/sync_on.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/open.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/group__defs_8dox.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/closed.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/dir_49e56c817e5e54854c35e136979f97ca.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/group__block.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/files_dup.js
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/bc_s.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/dir_d44c64559bbebec7f509842c48db8b23.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/nav_g.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/dir_f2cd86917185299abf5a1f0679072f3c.html
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/splitbar.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/doc.png
— Installing: /home/yyama/gr38/share/doc/gr-USRP_UTC_SYNC/html/dir_0fee939d68a87f22bb24cf3be2edbf60.html
— Installing: /home/yyama/gr38/lib/python3/dist-packages/USRP_UTC_SYNC/init.py
— Up-to-date: /home/yyama/gr38/lib/python3/dist-packages/USRP_UTC_SYNC/USRP_UTC_Sink.py
— Installing: /home/yyama/gr38/lib/python3/dist-packages/USRP_UTC_SYNC/USRP_UTC_Source.py
— Installing: /home/yyama/gr38/lib/python3/dist-packages/USRP_UTC_SYNC/init.pyc
— Installing: /home/yyama/gr38/lib/python3/dist-packages/USRP_UTC_SYNC/USRP_UTC_Sink.pyc
— Installing: /home/yyama/gr38/lib/python3/dist-packages/USRP_UTC_SYNC/USRP_UTC_Source.pyc
— Installing: /home/yyama/gr38/lib/python3/dist-packages/USRP_UTC_SYNC/init.pyo
— Installing: /home/yyama/gr38/lib/python3/dist-packages/USRP_UTC_SYNC/USRP_UTC_Sink.pyo
— Installing: /home/yyama/gr38/lib/python3/dist-packages/USRP_UTC_SYNC/USRP_UTC_Source.pyo
— Up-to-date: /home/yyama/gr38/share/gnuradio/grc/blocks/USRP_UTC_SYNC_USRP_UTC_Sink.block.yml
— Installing: /home/yyama/gr38/share/gnuradio/grc/blocks/USRP_UTC_SYNC_USRP_UTC_Source.block.yml

$ sudo ldconfig

以上で独自ブロックのビルドが完了した.