MinGWw64andMSYS2

From GNU Radio
Revision as of 17:04, 28 November 2024 by Chrisgorman (talk | contribs) (Initial Import of MinGWw64andMSYS2 describing how to install drivers and build OOT modules)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Using GNU Radio with MinGW-w64 and MSYS2

Installing Windows drivers

RTL-SDR

For the RTL-SDR ,install the WinUSB driver for a USB device using zadig(https://zadig.akeo.ie/) and select the device that is called "Bulk-In, Interface (Interface 0)"

To install the WinUSB driver for a USB device using Zadig, follow these steps:

  1. Get the Zadig tool and open it on your computer.
  2. Choose the device from the list. If it’s missing a driver, it may auto-select, but you can verify it by checking the USB ID.
  3. Ensure that the driver in the middle of the interface is set to "WinUSB."
  4. Click on "Install Driver" or "Replace Driver" to complete the installation.

Pluto-SDR

To install the Pluto-SDR IIO USB drivers, follow these steps:

  1. Obtain the IIO USB driver(https://github.com/analogdevicesinc/plutosdr-m2k-drivers-win/releases/latest/download/PlutoSDR-M2k-USB-Drivers.exe) from github.
  2. Run the downloaded file and follow the on-screen instructions to complete the installation.

UHD (Ettus USRP)

For the UHD (Ettus USRP) drivers, first open a shell launcher for the subsystem (mingw64 or ucrt64) which has gnuradio installed. Then the Ettus research USRP drivers can be downloaded by running:

uhd_images_downloader

The UHD images will not download to the default /usr/share/uhd/images, but in either the /mingw64/share/uhd/images or the /ucrt64/share/uhd/images directory, dependent on which subsystem gnuradio is installed under. Since the install directory is not the default directory, it is recommended to edit your .bashrc and add either:

export UHD_IMAGES_DIR=/mingw64/share/uhd/images

or:

export UHD_IMAGES_DIR=/ucrt64/share/uhd/images

to the .bashrc. Then exit and restart your mintty.

The running of uhd_images_downloader will install all the firmware files for the USRPs that ettus creates. If you have a B-Series, you will probably have to install a USB driver for your device. The uhd_images_downloader will have downloaded the USB device drivers for windows. They can be found in $UHD_IMAGES_DIR/winusb_driver. To install the drivers, follow the instructions on the B-Series USB devices on the web at (https://files.ettus.com/manual/page_transport.html#transport_usb_installwin)

Building OOT modules

Open a shell launcher for the subsystem, either mingw64 or ucrt64, which has gnuradio installed. Then create an OOT module. Alternatively, one could download someone else's OOT module, here we create our own OOT module:

gr_modtool newmod customModule

Then change directory into the newly created module directory:

cd gr-customModule

And create a build directory within gr-customModule to hold the build files:

mkdir build

One now would create an OOT block, via gr_modtool add, and edit generated files, then change directory into the build directory. If you want to do this step, have a look at either of the Creating Python OOT with gr-modtool or Creating C++ OOT with gr-modtool pages. Our next step is:

cd build

Now the process changes a little bit. To build an OOT module with GNU Radio built on MinGW-w64 with MSYS2, two arguments must be passed to cmake. Instead of just running cmake .., we need to pass -DPYTHON_EXECUTABLE="${MINGW_PREFIX}"/bin/python as well as -DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}", so the command becomes:

cmake -DPYTHON_EXECUTABLE="${MINGW_PREFIX}"/bin/python -DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" ..

Once cmake has executed and the terminal is ready for input again, we normally run make, however under MinGW-w64 / MSYS2, the default build tool is different than under Linux. The cmake command will generate a build.ninja file meant for use with ninja rather than make. So to build the OOT module run:

ninja

And to install the package:

ninja install

Finally if you want to uninstall your package, from the build directory, run:

ninja uninstall