Development

= Contributing to GNU Radio -- FAQ =

GNU Radio is an Open Source project, and as such contributions from the community are welcome. If you have some code or other things such as documentation you would like to share with the rest, please have a look at this FAQ before submitting.

Cheat Sheet
See the information throughout this page for details about these steps. But when making looking to contribute, we encourage you to either make a new Issue in the Issue Tracker or identify a current Issue already up and waiting for attention. We also assume you have a public Github repo you can use for the pull requests and that you have cloned the GNU Radio git repo.


 * Identify which branch of the GNU Radio base code to work from.
 * Create a new branch from here to work from.
 * Work on the bug fix or feature under the new branch.
 * Determine the QA code necessary to test and check the fix or feature.
 * Provide an appropriate Git commit with log messages.
 * Push the branch to a public repo on Github.
 * Issue a pull request against the starting branch (i.e., maint or master).
 * Update the Issue on \url{gnuradio.org} with information about the fix, including a link to the pull request on Github.
 * Wait for the pull request to be merged -- often after some back and forth and testing by other parties.
 * Mark the Issue resolved and note the commit where it was resolved.

The GNU Radio project maintainers will mark issues as Closed at the appropriate time.

How can I help?
The easiest way to help is to simply use GNU Radio. The more you use it, the more likely you will perhaps find a bug, or miss a particular feature. Tell us about it on the mailing list, or, even better, fix it yourself and submit the code. The most rewarding way to go is probably to actually write a radio system, e.g. a receiver for a digital standard.

If you want to get involved in the development process, here's some suggestions where to start:

 Documentation

 Missing test cases

 Bug fixes

 GUIs

The main place to look is the issue tracker. Also, look at the results posted by our Jenkins continuous integration service: http://jenkins.gnuradio.org/jenkins/job/GNURadio-master. It tracks warnings, TODO's, FIXME's, and unit tests. Any warnings or FIXME fixes are useful as well as any more unit tests to exercise the validity of the signal processing or runtime code.

We also use Coverity for static code analysis. You can find our project at https://scan.coverity.com/projects. Here, you can find small things to change and fix (a lot of these are so small you don't even need an FSF copyright assignment).

There's also the possibility to donate to our project. The Free Software Foundation provides the infrastructure to do so, and can provide a receipt for US tax payers, who can deduct a donation.

Development Style
When writing new code, we have a few general rules for where and how things go in. We follow that standard Git workflows concept in our Git branch structure. We have two main branches used in development, the 'master' and the 'next.' Here are a few rules to go by when working on new code or fixing old code in GNU Radio.


 * Make sure any changes in 'master' do not break the API (even if there is an error)
 * Additions to the API are fine
 * Deprecating code by outputting a message is done here
 * Removing code or changing API names or calling conventions MUST be done in 'next'
 * Work in 'master' for as much as possible unless you are going to change the API

Following these simple rules will help get your code merged in faster and with less hassle.

When working in code, there may be additions or things you might not know how to do just yet. It is appropriate in these instances to make a comment about it. The convention for this is to use the following keywords to indicate where you have left something for later:


 * Use TODO comments for low-priority fixes
 * Use FIXME comments for high-priority fixes

For all kinds of modifications and changes, try and make sure the following points are observed:


 * For patches, the diff contains the minimal but related incremental changes, for all the files needing modification to implement the change. In other words, the diff should take a working GNU Radio source tree and modify it to become a working GNU Radio source tree with the feature implemented.
 * Diffs are made from the GNU Radio tree root, and are based on an recent master branch.
 * use git format-patch to create your patches.
 * Minor bug fixes should be applied to the maint branch
 * Addon's and features should be applied to the master branch
 * Changes to the structure, API, or other surgery to the code should be applied to the next branch
 * After applying your changes or building your branch, the command 'make test' must pass.
 * There should be no additional compiler warnings to what already occurs.
 * No gratuitous whitespace changes.

Quality Assurance (QA) Code
Every block should have a QA file to test the validity of the code. Most current blocks have QA code that tests that the code runs and produces repeatable, testable results on all platforms. If this code fails, it is an indication of a problem, error, or unexpected change in the code. It is an easy way to verify the validity of the code. This can be a difficult concept in some signal processing codes (such as a phase lock loop that has to settle), but the current QA tests that are there can offer guidance and hints as to how to test a new block.

Any block that is currently without a QA testing program should be fixed to have one.

I've found a bug, but I don't have the skill/time/whatever to fix it... now what?
No problem. If it's really an unfixed bug, you're perhaps the first to stumble upon it. Write an email to the discuss-gnuradio@gnu.org mailing list explaining what's wrong and, ideally, providing a test case so the developers can reproduce the error.

If it's a confirmed bug, you should add a ticket to the bug tracker (http://gnuradio.org/redmine/projects/gnuradio/issues) by following these steps:

1. You'll need to login to the website, first, and then click New Issue.

2. Set if this Issue is a bug or perhaps a new feature.

3. Provide an appropriate subject to explain the Issue.

4. Provide a comprehensive description of the Issue. Provide links, code, and any examples here. It's much easier for us to understand a bug if we have a simple test case that demonstrates the issue such as a GRC file or Python program. Feel free to upload attachments using the Files button.

5. The rest of the attributes of the Issue should be left alone. The GNU Radio development team will handle assignment of the bug and any other relevant attributes.

I've fixed and Issue! What do I do now?
That's fantastic! Thanks! To help us provide a consistent experience resolving and fixing issues, please follow these steps.

1. Create a patch. See the next set of instructions on &quot;How do I submit patches?&quot;. If you have a patch file, you can attach it to the Issue directly or use a pull request through github.com.

2. Update the Issue that you're addressing by setting the Issue status to Feedback and a description of the update, such as the github branch or pull request number.

3. Set the Resolution field to Fixed.

The GNU Radio development team will take the issue from here. We will handle applying or merging the fix and updating the issue from there. We will set the Status to Resolved and set the target version it belongs to. After a week or so without incident, we will close the Issue.

See the next section for how to work with our Issue Tracker.

Dealing with the GNU Radio Issue Tracker
If you are filing a new bug or feature request, here's what you need to know. First, you'll need an account on gnuradio.org. Sign up for that and make sure you can log in; if you have trouble logging in, contact Tom Rondeau for help with your account.

Once logged in, you will see the New Issue option right next to Issues. Clicking that will take you to the page to enter the issue you wish to file. First select if this is a bug or a feature and provide a subject line describing it. Fill out the description as clearly as possible to describe the bug or feature. If it's a bug, it is most helpful to us if you would also attached an example application that exercises the bug so that we can easily test it. Add a file by looking below to the Files item and select the button &quot;Choose Files&quot;.

The rest of the fields are mostly left alone by the initial filer. The GNU Radio team will take a look at the issue and fill in the appropriate fields from there. If the Category of the bug is obvious, please fill that in as appropriate.

You may select a priority, though we ask you to be reasonable in your assessment of the priority with respect to the project and not your personal requirements. If this is a feature that you are willing to work on or a bug that you feel you can handle yourself, you may also assign yourself to the task. We, of course, will then expect you to actually complete any issues assigned to you in that case.

What do the different Status levels mean?

 * New: the default assignment when an issue is added and nothing has been done.
 * Feedback: the bug is unclear, we don't know what to do, or it needs more discussion.
 * Assigned: we know what to do and have given it to some someone to do it.
 * Resolved: patch submitted and merged into maint/master/next. We then wait a few weeks to see if it causes any problems or any other feedback.
 * Closed: after a few weeks of either positive or no farther issue with the resolution, we officially close it.

It is the task of the developer assigned to a task to update the issue for ever level except closed. The GNU Radio management team will decide when to officially close an issue.

Assignment
Assignment to an Issue means that an individual has taken on the task of handling that particular issue of either fixing a bug or adding a feature. When assigned, that issue is claimed by the assignee, and so we expect that person to handle the task. Assigned issues that are not kept up on will be either removed or the assignee will be taken off. Removing the issue will generally occur with a feature request where that feature is not being managed properly. If it is a bug, inaction on it means that others may be discouraged from working on this because it is already assigned.

There are a few categories that have default assignments to someone on the GNU Radio development team. The default assignment should be looked at as a triage operation. When assigned, the default assignee should look at the issue and decide how to handle it. It might be that someone else should be assigned to that task, or if it falls outside of the abilities, availability of time, or other such reasons, the default assignee can remove themselves from the issue thus freeing it up for others to take.

Target Version
Please leave the Target Version field blank until the issue is resolved. We handle this differently in our project than most as we do not build up a list of issues to tackle on a per-release basis.

How do I submit patches?
This depends on the size of the patch. If it is a small patch, e.g. a bug fix which only consists of a few lines, you can just create a diff and attach that to the entry to the issue tracker. Please include a description of the bug and how your patch fixes this bug (see above on obtaining permissions to create bug tracker entries.)

Another easy, very useful (for both you and us) way is to go through github and send us a pull request (See: How can I use github? below).

In most cases, these are the commands you will enter:

$ git add FILE1 FILE2... # Put all the patch-relevant files here $ git commit -m 'filter: re-snazzled the frombobulator (was zingamawonking)' $ git format-patch HEAD~ # This will turn the latest commit into a patch file Note that the commit message should be prefixed with the component you changed (core, filter, audio, ...). Read the previous commit logs for examples (you can get them with 'git log').
 * 1) You've just finished editing the patch

The last command creates a file, usually starting with '0001', which contains the patch. Simply upload this to the issue tracker.

For larger patches (e.g. several commits), it is probably better to upload a modified version of the git repository, e.g. to github (see below).

If you want to extend GNU Radio and add new features, please read 'How can I add new features to GNU Radio?'.

For bug fixes, the least friction is caused if you branch of the 'maint' branch. Anything that goes into 'maint' is automatically rolled up-stream into 'master' and 'next'.

How can I add new features to GNU Radio?
First of all, you should ask yourself if your code really belongs into the GNU Radio core. If you are developing a GNU Radio module which can exist completely separate of the GNU Radio code, it might be worth uploading it to CGRAN, where you can maintain the code yourself and don't have to go through the process of re-submitting patches.

Of course some features (say, new modulators or filters) belong into the core GNU Radio repository. In this case, sending a patch to the mailing list is a bit too bulky. Instead, upload your code to a world-readable git repository, and then post a 'Feature' on our issue tracker. This is explained greater detail here.

Before submitting, go through the following check list:

 Does the code include documentation? GNU Radio uses Doxygen for automatic doc generation, so be aware of this when documenting classes.

 Are there unit tests? Are they sensible unit tests, i.e. do they cover the most common errors?

 Does the patch maintain compatibility with the existing code base?

 Does the code follow the GNU Radio coding conventions?

 Is the code based on the latest GNU Radio revision?

 Is the code nicely portable?

 Do you have a copyright assignment on file with the FSF?

If you're having any trouble with this, don't hesitate to ask on the mailing list.

How can I use github to submit patches/features/changes?
Note: This is the recommended way to provide changes to the GNU Radio code.

Here's the easiest way:


 * Fork a repository from https://github.com/gnuradio/gnuradio
 * Clone your repository or add it as a remote to a previously cloned gnuradio repo:
 * $ git remote add 
 * $ git remote update
 * Make a new feature branch -- please make this distinct from maint/master/next
 * $ git branch
 * $ git checkout
 * Commit your changes on your new branch
 * $ git commit 
 * Make sure it compiles, works, and passes QA
 * $ make
 * $ make test (or ctest)
 * Submit a Pull Request to merge your branch back into the gnuradio/gnuradio repository
 * Wait for us to process that

You need to figure out what the base branch is for you to work off of. Most likely, this will be either maint or master, but it could be next:


 * maint: our bug patch branch; this will become a bug release against the current version. These are for bugs only; no new features. Any patches made to this branch will also be applied to the master and next branch. This branch becomes the patch version of a release, the p of an X.Y.Z.p (omitted if p=0).
 * master: this will become our next minor version release, the Z of an X.Y.Z version. This is where new code codes that’s more than just a bug patch.
 * next: in the X.Y.Z model, this is the staging area for the Y version increments, also called the API version. All code within a release version has the same compatible API. If you use code in the X.Y API release starting with minor release Z0, then all releases after Z0 in that API version are guaranteed to have the same backwards-compatible API. We put stuff on the next branch when we have to break the API. We try to avoid this whenever possible since API releases are rare and so any code submitted here will not be released for a while.

Keep in mind that a pull request is not a guaranteed merge on our part. We will vet the code for both correctness, usefulness, and style, and we might push back requesting some changes. There will likely be a bit of back and forth on this, so don't be discouraged; we're just trying to make sure that the code always gets better.

Which kind of patches are accepted into GNU Radio?
There is no definitive answer to this. Bug fixes and missing QA codes are of course always welcome.

Ultimately, the decision lies with the maintainers. If in doubt, consult the mailing list.

How long does it take for my patch to become part of GNU Radio?
Again, there is no definitive answer to this. It depends on many things: the complexity and size of the patch, the current situation of development and the relevance of the patch.

However, the following things are guaranteed to delay acceptance:

 Lack of documentation and/or test cases

 Not complying with the coding conventions

 Non-portable code

 QA failures

 Breaking of next (if it was in master)

 Lack of copyright assignment

What if my patch works for master, but not for next?
Ideally, you do this:


 * 1) Create a branch off master, say foo-master
 * 2) Implement feature or fix on foo-master
 * 3) Create a branch off next called foo-next
 * 4) Merge foo-master into foo-next, fix up breakage
 * 5) Implement feature or fix on foo-next (this might have been done or partially done as a result of getting through #4)
 * 6) Tell us about foo-master and foo-next

Then we:


 * 1) Merge foo-master into master. No problems since foo-master is branched from master.
 * 2) Merge foo-next into next. No problems since #4 above already dealt with merge breakage
 * 3) Merge master into next. This should end up being a null merge, but it maintains the master-&gt;next linkage

What's this CGRAN?
The Comprehensive GNU Radio Archive Network (CGRAN is a free open source repository for 3rd party GNU Radio applications that are not officially supported by the GNU Radio project''. In other words, it is a place for anybody to upload and publish extensions and modifications of and for GNU Radio.

If you are developing a GNU Radio project which works separately from the GNU Radio core, you might want to submit it to CGRAN rather than to the GNU Radio core. This way, you keep the write access to your published code and can maintain it independently from the core.

Which coding conventions apply?
All contributions should conform to the GNU Coding Standards as modified for C++ in README.hacking

Also, you should check out The GNU Radio Coding Style Guide.

How is the code documented?
GNU Radio uses Doxygen to document the source code. Any new block should use Doxygen markup structure to add to the Doxygen manual. Also, we use a list of groups to categorize all of the blocks, so when a new block is created, add this block to one or more of the available groups, a list of which can be found in. Below is an example of a marked-up header file.

/*! * \brief A new block that does something. * \ingroup some_group * \ingroup another_group * * Detailed description of what this block does. * Quoting papers or textbooks is a good idea, too. */ class MODNAME_API new_block : public gr::block { private: new_block(int param1, double param2);

public: typedef boost::shared_ptr sptr;

/*!  * \brief Description of public_function * \param foo Describe foo * \param bar Describe bar */ virtual int public_function(int foo, float bar) = 0;

/*!  * \param param1 Describe param1 * \param param2 Describe param2 */ static sptr make(int param1, double param2);

}; Starting in GNU Radio 3.5, we have been moving to new top level blocks, like gr-vocoder, gr-audio, gr-digital, etc. Each of these is getting its own group along with any specific group the block should be included in. These groups each have their own page to describe the group as a main description of the blocks and how to use the package. These pages are all linked from the Doxygen manual's front page, which is found in.

The top level blocks are all described inside that blocks  directory in a   files named or the component. For example, in the component, the manual page describing this component is in. This page should provide any detail that can help users add and use these packages and their blocks. As these components are developed, used, and added to, any more details that can go into this Doxygen page should be added for the benefit of anyone else.

The component's  directory will also contain a   that gives a brief description of the package. This file should contain the most basic necessary information and point to the Doxygen files for more detail.

Doxygen Markup for Formulas
When inserting formulas into the header to be part of the documentation, we want to have the best representation possible, which means making Latex style formulas. This is done in Doxygen using the &quot;\f{&quot; to begin and &quot;\f}&quot; to end the formula section. However, these do not properly show up in the XML documents used in the Python help files. So we have to make the formula twice, once formatted for the HTML manual and another for the XML. It will look like this:

This is some text in the header... \f{html}{ enter Latex formula here -&gt; will only show up in the HTML document. }

\xmlonly Same Latex formula, but this will not be processed; will only be the raw Latex formula. \endxmlonly

And here's some following text to the formulas. Note that the spacing between sections is important to get the best output format. Furthermore, there are certain Doxygen markups that will cause a problem in the XML representation, like use the of \frac in Latex to create a fraction will not parse properly. There is likely a better way to handle this (PLEASE UPDATE IF YOU KNOW IT), but for now, we just add a space between them as &quot;\ f&quot;.

What's this Copyright Assignment?
Before we can accept non-trivial code contributions from you, we need a copyright assignment on file with the FSF. A description of the process is available here. Basically, this guarantees the FSF (who is copyright holder of GNU Radio) does not run into any legal trouble somewhere down the road.

This boils down to the following instructions:

 If you've developed some addition or patch to GNU Radio that you would like to contribute, you should send an email to the mailing list, or to one of the GNU Radio maintainers asking for an appropriate form. We might ask you for some more information at this point.

 You will be sent a short form by email which you should fill in and email back to the FSF.

 Once the FSF have received this email, they will send you a paper copy of the full copyright assignment papers for you to sign and post back to them.

 As soon as the signed paperwork is filed at the FSF we can accept your changes into the source tree.

 Individual small changes (fewer than 10 lines of code) can, however, be accepted without a copyright assignment form on file.

In order to get the process rolling, please email &quot;tom AT trondeau&quot; for a form to start the copyright process.

Who maintains GNU Radio?
GNU Radio is currently maintained by:


 * Ben Hilburn (Project Lead) and
 * Johnathan Corgan (Chief Architect) and
 * Nathan West (Release Manager) and
 * Martin Braun (Community Manager)

See also the full list of GNU Radio staff.

GNU Radio was founded and initially maintained by:


 * Eric Blossom