USRP系列连载文章,系笔者毕业设计课题,《通用软件无线电平台USRP_N210主板工作方式研究》。旨在学习前辈经验,并对USRP的使用以及源码进行部分分析,特别是FPGA源码分析。文中可能会出现一些错误或者不当之处,也请各位多多指出,共同学习。
本文章由hitter翻译整理,借鉴多方成果,再次对各个前辈的工作表示感谢!
本文中使用的UHD及GNURadio源码,Python脚本以及系统日志,笔者将上传到CSDN(见文章最后方),供各位方便下载。
该安装方式为Ettus官方网站提供的安装方式,相对来说安装过程较为复杂,但很详细、全面,适合各位在安装过程中遇到某些错误参考解决方式。参考网址:http://files.ettus.com/manual/page_install.html
(想要快速的安装好UHD+GNURadio,请直接跳转的安装方式二)
系统版本ubuntu12.04 32位操作系统
UHD的安装:
UHD位USRP的硬件环境支持,在GNUradio3.3版本之后,GNUradio将不再继续集成USRP的硬件支持,所以需要单独安装UHD。其安装步骤如下:
一.二进制安装
复制以下命令到终端,安装UHD软件
sudoadd-apt-repository ppa:ettusresearch/uhd
sudoapt-get update
sudo apt-get install libuhd-dev libuhd003uhd-host
二.检查环境构建
使用apt-get安装环境,在终端中输入:
sudo apt-get install libboost-all-devlibusb-1.0-0-dev python-mako doxygen python-docutils cmake build-essential
环境要求如下:
GCC >= 4.8
安装使用命令:sudoapt-get install gcc
• Purpose: generates project build files
• Minimum Version: 2.8
• Usage: build time (required)
• Download URL: http://www.cmake.org/cmake/resources/software.html
安装使用命令:sudoapt-get install cmake
• Purpose: C++ library
• Minimum Version: 1.53
• Usage: build time + runtime (required)
• Download URL: http://www.boost.org/users/download/
• Download URL (Windowsinstaller): http://sourceforge.net/projects/boost/files/boost-binaries/
安装BOOST:
• 安装参考网址www.cnblogs.com/loadofleaf/p/5
• tar xf boost_1_58_0.tar.gz
cd boost_1_58_0/
./bootstrap.sh
./b2 -a-sHAVE_ICU=1 # theparameter means that it support icu or unicode
sudo ./b2install
• Purpose: USB-based hardware support
• Minimum Version: 1.0
• Usage: build time + runtime (optional)
• Download URL: http://sourceforge.net/projects/libusb/files/libusb-1.0/
• Download URL (Windows): https://github.com/libusb/libusb
可以直接从商店中获得软件,在终端中输入命令
sudo apt-get install libusb-1.0-0-dev
• Purpose: used by mako and utility scripts
• Minimum Version: 2.7
• Usage: build time + runtime utility scripts (required)
• Download URL: http://www.python.org/download/
可以直接从商店中获得软件,在终端中输入命令
sudo apt-get install python
• Purpose: source code generation
• Minimum Version: 0.5.0
• Usage: build time (required)
• Download URL: http://www.makotemplates.org/download.html
• Alternative method: You can use pip or easy_install to install Mako from PyPi.
可以使用pip,快速的安装mako,首先需要安装pip,在终端中输入
sudo apt-get install python-pip
安装完毕后输入来完成安装
sudopip install mako
• Purpose: generates HTML API documentation
• Minimum RecommendedVersion: 1.8
• Usage: build time (optional)
• Download URL: http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc
• Alternate method: Install setuptools, anduse the easy_install command toinstall Docutils.http://pypi.python.org/pypi/setuptools
使用setuptool进行安装,首先下载安装setuptools
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-12.0.3.tar.gz#md5=f07e4b0f4c1c9368fcd980d888b29a65
安装:
tar-zxvf setuptools-12.0.3.tar.gz
cd setuptools=12.0.3 #进入文件夹
sudo python setup.py install
安装完成后使用命令
sudoeasy_install docutils
至此我们所需要的环境则全部安装完毕!
三.下载安装UHD
(一)获得UHD源码
需要联网的环境之后在终端中输入(不包含FPGA源码):
git clonegit://github.com/EttusResearch/uhd.git
如果FPGA部分源码也需要,在终端中输入:
git clone --recursivegit://github.com/EttusResearch/uhd.git
(二)编译安装源码
1.创建makefile
cd
mkdir build
cd build
cmake ../
注: uhd-repo-path为UHD的目录,例如本机目录为/desktop/uhd
2.编译和安装UHD
在执行编译之前,我们需要同步一下系统时间,防止编译出错。可以使用电脑系统设置中同步网络时间,或者执行以下步骤:
(1).安装ntpadate工具
sudo apt-get install ntpdate
(2).设置系统时间与网络时间同步
sudo ntpdate cn.pool.ntp.org
(3)将系统时间写入硬盘时间
sudohwclock –systohc
此时可以在终端输入date命令查看系统时间是否同步。
进行编译安装操作:
make
maketest
sudo make install
3.设置库路径
(1)拷贝文件到LD_LIBRARY_PATH
cd
sudo cp -r libuhd.so /etc/ld.so.conf.d
(2)进入 LD_LIBRARY_PATH并确认路径
cd/etc/ld.so.conf.d
sudo ldconfig
笔者的安装系统环境为ubuntu12.04 32位操作系统
使用Python脚本(build-gnuradio)进行UHD和GNURadio的安装,步骤:
1.系统版本:Ubuntu 12.04
2.终端输入:
$sudo apt-get update #更新apt库
3.解压缩源文件GNURADIO.zip到主目录下
4.更改build-gnuradio脚本权限,在终端中输入:
$cd GNURADIO #进入解压文件夹
$sudo chmod a+x build-gnuradio #更改build-gnuradio权限
5. 输入‘ls’查看build-gnuradio 文件是否变成绿色(即权限是否改变)
6.终端中输入:
./build-gnuradio #运行文件
7.输入两次‘yes’到终端中开始安装
8.等待安装完成,具体过程请查看安装系统日志(install_log)
UHD及GNURadio源码,以及安装脚本:http://download.csdn.net/detail/cracked_hitter/9720706
UHD中FPGA源码下载:http://download.csdn.net/detail/cracked_hitter/9720561
install_log:http://download.csdn.net/detail/cracked_hitter/9720563