Thursday, September 12, 2024

Documenting GNURadio Flowgraphs

Documentation is important in communicating to others any design intent, fortunately GNURadio Companion provides several features that make the task easier.

 

Block Comments & Notes

All GNURadio Blocks have a ‘Comments’ field. These comments show up under the blocks on the Flowgraph as shown in figure 1. Comments are very useful in documenting things such as filter parameters or other items of note, especially what variables are controlling. Comments are also useful in describing QT GUI Blocks and their functions or constraints. In general, Block Comments document what might otherwise be unclear from the Flowgraph itself.

There is also a generalized “Note” block that can be used independently of any other block to add documentation as and where it is needed.

 

Figure 1 - On the 'Advanced Tab' of each block is a 'Comment' field. Text that is written in the Comment will be displayed under the block. This is useful in capturing design and operation intent.

 

PDF Output

Screen grabs of anything but the smallest of Flowgraphs will be unsuitable for sharing because of the resolution loss. Fortunately GNURadio Companion has a very high resolution PDF Output. This output will make a PDF copy of your Flowgraph that can be zoomed in and out at will with any PDF reader and even on the Web and GitHub.

You can make a PDF of your Flowgraph via the main menu. Select: File -> Screen Capture and a file dialog will pop up asking where you want to save the generated PDF file.

 

GNURadio Flowgraph Itself

Unfortunately, the nature of the Blocks themselves makes some details hard to figure out unless the user has access to the actual Flowgraph file itself and can inspect every detail in GNURadio Companion. A Flowgraphs .grc file can be attached, emailed and uploaded to file servers like GitHub. The actual Flowgraph GRC file is in plain text.

 

Flowgraph Security

I am sure that there are ways to embed malicious Python code in a Flowgraph, but since the user base is so low, these are unlikely to be exploited. However, it is something to keep in mind and we should ensure that every Flowgraph is supplied with some sort of security hash for safety’s sake.

To help this, I have created a very simple SHA-256 hash generator in Python. It is freely available on GitHub [1].

To use the program PyHasher, simply run the Python 3 code. It will ask for a file to generate the hash from and then return with the SHA-256 has code that it generated.

This is useful both for sharing your Flowgraphs and for verifying any downloaded Flowgraph, as long as the author has supplied a suitable SHA-256 hash.

The second thing we should avoid is running GNURadio Companion with "Administrator Privileges", especially when running Windows. I have never had to do this with Radioconda [2], but I do have other design tools that require this to get around file access issues. Just don't do it here when you might get malicious Python code from some Flowgraph downloaded from the internet.

The third thing we should do is to inspect any Python Modules or Embedded Blocks to look for any code that does not have to do with GNURadio functions. Do this BEFORE running any downloaded Flowgraph, especially ones downloaded from random websites, and / or Google Drives or Dropbox's.

As they always say on the shop floor: "Safety First".

 

References

[1] Simple to use Hash Code Calculator in Python - https://github.com/Hagtronics/PyHasher

[2] Radioconda (recommend installer for Windows) -  https://github.com/ryanvolz/radioconda

No comments:

Post a Comment