AnsweredAssumed Answered

Unable to connect FMCOMMS1 in gnuradio OOT module

Question asked by daxez12 on May 2, 2017
Latest reply on May 3, 2017 by daxez12

I've created a OOT in gnuradio to make a simple remote transmission from the FMCOMMS1. First I tried to use it without linking libiio from the cmake files so the result was this error:

 

Traceback (most recent call last):
  File "/gr-fmcomms1/top_block.py", line 164, in <module>
    main()
  File "/gr-fmcomms1/top_block.py", line 152, in main
    tb = top_block_cls(uri=options.uri)
  File "/gr-fmcomms1/top_block.py", line 92, in __init__
    self.fmcomms1_fmcomms1_source_1 = fmcomms1.fmcomms1_source('10.1.135.139')
AttributeError: 'module' object has no attribute 'fmcomms1_source'

 

Researching I've discovered that it is a problem related to libiio, which is not being found and gnuradio can't create the module so I found that I needed to create a cmake file to search for libiio and link it to the OOT module.

Following those instructions and based on gr-iio module cmake files I finished with a cmake file like this:

INCLUDE(FindPkgConfig) 
PKG_CHECK_MODULES(PC_IIO QUIET gnuradio-core) 
FIND_PATH(ITPP_INCLUDE_DIRS    
   NAMES iio/api.h
   HINTS $ENV{IIO_DIR}/include        
      ${PC_IIO_INCLUDE_DIR}    
   PATHS ${CMAKE_INSTALL_PREFIX}/include          
         /usr/local/include
         /usr/include

FIND_LIBRARY(
   IIO_LIBRARIES
   NAMES gnuradio-iio    
   HINTS $ENV{ITPP_DIR}/lib        
      ${PC_IIO_LIBDIR}    
   PATHS ${CMAKE_INSTALL_PREFIX}/lib
         /usr/local/lib
         /usr/lib
         /usr/
lib64
)


FIND_PACKAGE_HANDLE_STANDARD_ARGS(IIO DEFAULT_MSG IIO_LIBRARIES IIO_INCLUDE_DIRS)
MARK_AS_ADVANCED(IIO_LIBRARIES IIO_INCLUDE_DIRS)



And in CMakeLists.txt in the root directory of the OOT Module:

 

Line 104:

########################################################################

# Find gnuradio build dependencies

########################################################################

find_package(CppUnit)

find_package(Doxygen)

 

# Search for GNU Radio and its components and versions. Add any

# components required to the list of GR_REQUIRED_COMPONENTS (in all

# caps such as FILTER or FFT) and change the version to the minimum

# API compatible version required.

set(GR_REQUIRED_COMPONENTS RUNTIME)

find_package(Gnuradio "3.7.2" REQUIRED)

find_library(IIO_LIBRARIES iio)

find_path(IIO_INCLUDE_DIRS iio.h)

 

if(NOT CPPUNIT_FOUND)

   message(FATAL_ERROR "CppUnit required to compile fmcomms1")

endif()

 

if(NOT IIO_FOUND)

   message(FATAL_ERROR "IIO required to compile fmcomms1")

endif()

...

 

Line 132:

########################################################################

# Setup the include and linker paths

########################################################################

if(NOT IIO_FOUND)

   message(FATAL_ERROR "IIO required to compile fmcomms1")

endif()

include_directories(

   ${CMAKE_SOURCE_DIR}/lib

   ${CMAKE_SOURCE_DIR}/include

   ${CMAKE_BINARY_DIR}/lib

   ${CMAKE_BINARY_DIR}/include

   ${Boost_INCLUDE_DIRS}

   ${CPPUNIT_INCLUDE_DIRS}

   ${IIO_INCLUDE_DIRS}

   ${GNURADIO_ALL_INCLUDE_DIRS}

)

link_directories(

   ${Boost_LIBRARY_DIRS}

   ${CPPUNIT_LIBRARY_DIRS}

   ${IIO_LIBRARY_DIRS}

   ${GNURADIO_RUNTIME_LIBRARY_DIRS}

)

 

...

 

And then I tried to make the cmake command from the build directory and the result was:

 

It's worth to say that when I run the locate command for iio/api.h the result is:

 

And locate for gnuradio-iio is:

 

Honestly I think it's fine, but I'm new to the cmake files and linking with gnuradio. So maybe there's something I did it wrong, thanks.

Outcomes