Editing OutOfTreeModules

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 9: Line 9:
 
An out-of-tree module is a GNU Radio component that does not live within the GNU Radio source tree. Typically, if you want to extend GNU Radio with your own functions and blocks, such a module is what you create (i.e. you wouldn't usually add stuff to the actual GNU Radio source tree unless you're planning to submit it to the devs for upstream integration). This allows you to maintain the code yourself and have additional functionality alongside the main code.
 
An out-of-tree module is a GNU Radio component that does not live within the GNU Radio source tree. Typically, if you want to extend GNU Radio with your own functions and blocks, such a module is what you create (i.e. you wouldn't usually add stuff to the actual GNU Radio source tree unless you're planning to submit it to the devs for upstream integration). This allows you to maintain the code yourself and have additional functionality alongside the main code.
  
A lot of OOT projects are hosted at [http://cgran.org CGRAN] -- the Comprehensive GNU Radio Archive Network. CGRAN projects are all available through our tool [https://www.gnuradio.org/blog/2016-06-19-pybombs-the-what-the-how-and-the-why/ PyBOMBS]. In fact, when you add your project to the [https://github.com/gnuradio/gr-etcetera PyBOMBS recipe repo], it will automatically update the CGRAN website.
+
A lot of OOT projects are hosted at [http://cgran.org CGRAN] -- the Comprehensive GNU Radio Archive Network. CGRAN projects are all available through our tool [http://gnuradio.org/pybombs PyBOMBS]. In fact, when you add your project to the [https://github.com/gnuradio/gr-etcetera PyBOMBS recipe repo], it will automatically update the CGRAN website.
  
 
For example of such a module is the [https://www.cgran.org/14680/ GNU Radio Digital Audio Broadcasting module], which extends GNU Radio with everything needed to get audio from DAB and DAB+. When installed, you have more blocks available (e.g. in the [[GNURadioCompanion|GNU Radio companion]]) which behave just like the rest of GNU Radio; however, the developers are different people.
 
For example of such a module is the [https://www.cgran.org/14680/ GNU Radio Digital Audio Broadcasting module], which extends GNU Radio with everything needed to get audio from DAB and DAB+. When installed, you have more blocks available (e.g. in the [[GNURadioCompanion|GNU Radio companion]]) which behave just like the rest of GNU Radio; however, the developers are different people.
Line 264: Line 264:
 
$ cmake ../      # Tell CMake that all its config files are one dir up
 
$ cmake ../      # Tell CMake that all its config files are one dir up
 
$ make          # And start building (should work after the previous section)</pre>
 
$ make          # And start building (should work after the previous section)</pre>
 
If using GR v3.9 you will need to run:
 
<pre>$ sudo make install </pre>
 
 
 
===== Build Tree vs. Install Tree =====
 
===== Build Tree vs. Install Tree =====
  
Line 518: Line 514:
 
Note that <code>gr_modtool add</code> creates an invalid GRC file, so we can overwrite that.
 
Note that <code>gr_modtool add</code> creates an invalid GRC file, so we can overwrite that.
  
In most cases, <code>gr_modtool</code> can't figure out all the parameters by itself and you will have to edit the appropriate XML or YML file by hand. See [[XML_GRC|Writing the XML file for a block (for 3.7)]] or [[YAML_GRC|Writing the YAML file for a block (for 3.8+)]] for details.
+
In most cases, <code>gr_modtool</code> can't figure out all the parameters by itself and you will have to edit the appropriate XML file by hand. The [[GNURadioCompanion|GRC]] wiki site has a description available.
  
 
In this case, because the block is so simple, the XML is actually valid. Have a look at <code>grc/howto_square2_ff.xml</code>:
 
In this case, because the block is so simple, the XML is actually valid. Have a look at <code>grc/howto_square2_ff.xml</code>:
Line 627: Line 623:
 
Here's a quick list for all the steps necessary to build blocks and out-of-tree modules:
 
Here's a quick list for all the steps necessary to build blocks and out-of-tree modules:
  
# Create (do this once per module): <code>gr_modtool newmod MODULENAME</code>
+
# Create (do this once per module): <code>gr_modtool create MODULENAME</code>
 
# Add a block to the module: <code>gr_modtool add BLOCKNAME</code>
 
# Add a block to the module: <code>gr_modtool add BLOCKNAME</code>
 
# Create a build directory: <code>mkdir build/</code>
 
# Create a build directory: <code>mkdir build/</code>
 
# Invoke the make process: <code>cd build &amp;&amp; cmake &lt;OPTIONS&gt; ../ &amp;&amp; make</code> (Note that you only have to call cmake if you've changed the CMake files)
 
# Invoke the make process: <code>cd build &amp;&amp; cmake &lt;OPTIONS&gt; ../ &amp;&amp; make</code> (Note that you only have to call cmake if you've changed the CMake files)
 
# Invoke the testing: <code>make test</code> or <code>ctest</code> or <code>ctest -V</code> for more verbosity
 
# Invoke the testing: <code>make test</code> or <code>ctest</code> or <code>ctest -V</code> for more verbosity
# Call <code>gr_modtool makexml BLOCKNAME</code> or <code>gr_modtool makeyaml BLOCKNAME</code> to generate the xml or yaml file for your blocks. Correct manually if needed.
+
# Install (only when everything works and no tests fail): <code>sudo make install</code>. Remember to call <code>gr_modtool makexml BLOCKNAME</code> or <code>gr_modtool makeyaml BLOCKNAME</code>, to generate and if needed modify yaml file for your blocks before installing the module.
# Install (only when everything works and no tests fail): <code>sudo make install</code>
 
 
# Ubuntu users: reload the libs: <code>sudo ldconfig</code>
 
# Ubuntu users: reload the libs: <code>sudo ldconfig</code>
 
# Delete blocks from the source tree: <code>gr_modtool rm REGEX</code>
 
# Delete blocks from the source tree: <code>gr_modtool rm REGEX</code>
Line 722: Line 717:
 
* <code>input_items</code> and <code>output_items</code> are numpy arrays, which is why we can do the very simple element-wise multiplication the way it's done here (instead of a list comprehension)
 
* <code>input_items</code> and <code>output_items</code> are numpy arrays, which is why we can do the very simple element-wise multiplication the way it's done here (instead of a list comprehension)
 
* No recompiling is necessary for the <code>make test</code> (faster development cycles, yay!)
 
* No recompiling is necessary for the <code>make test</code> (faster development cycles, yay!)
* For Python code, you must modify the XML or YAML file yourself. See [[XML_GRC|Writing the XML file for a block (for 3.7)]] or [[YAML_GRC|Writing the YAML file for a block (for 3.8+)]] for details.
 
  
 
=== Other types of Python blocks ===
 
=== Other types of Python blocks ===
Line 751: Line 745:
  
 
<code>ValueError: invalid literal for int() with base 10: '...'</code> This occurs in GRC when attempting to drag a block into a flowgraph. It usually means the <code>.yml</code> file cooresponding to the block located in the <code>grc/</code> folder is not filled out. ("..." is a placeholder).
 
<code>ValueError: invalid literal for int() with base 10: '...'</code> This occurs in GRC when attempting to drag a block into a flowgraph. It usually means the <code>.yml</code> file cooresponding to the block located in the <code>grc/</code> folder is not filled out. ("..." is a placeholder).
 
<code>Error: invalid literal for int() with base 10: '1 /* max inputs */'</code> This occurs in GRC when attempting to drag a block into the flowgraph. This is caused by <code>multiplicity: 1 /* max inputs */</code> in your <code>.yml</code> file. Removing <code>/* max inputs */</code> will fix the error.
 

Please note that all contributions to GNU Radio are considered to be released under the Creative Commons Attribution-ShareAlike (see GNU Radio:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)