pothosware / gnuradio Goto Github PK
View Code? Open in Web Editor NEWThis project forked from gnuradio/gnuradio
GNU Radio
Home Page: gnuradio.org
License: GNU General Public License v3.0
This project forked from gnuradio/gnuradio
GNU Radio
Home Page: gnuradio.org
License: GNU General Public License v3.0
The current set_taps() method takes the new taps and references to various other filter related objects. Its currently used by the constructor with those filter objects passed in from private members. I don't see how this call could be used to change the taps, or how it works in GRC as a callback/setter. I think pfb_clock_sync needs a new set_taps() function that takes only the taps, and reloads all filter settings just as the constructor does.
Use the __GR_ALIGNED() cross platform macro provided in attributes.h. Note that the __GR_ALIGNED() is a prefix macro and works before the declaration. MSVC is the picky compiler, clang and gcc support both suffix and prefix position.
Patch 1
Similar to #9, however, this is for the case of building volk stand-alone. We should probably track this on the volk project, but starting here so we don't loose track of it.
Patch 2
Added config.h idiom support to qa_utils.cc which needed it for the M_PI definition.
The shlex.split(run_command.format(python=sys.executable, ...
removes the backslashes entirely from the string and the subsequent subprocess popen fails. For reference: http://bugs.python.org/issue1724822 The fix was to simply replace the backslashes, .replace("\\","/")
because forward slashes in paths work just fine.
In addition, quotes have been added to the python executable and generated flowgraph path to support the possibility of spaces in the path. '"%s"'%(self.get_file_path()
Under some conditions the error can cause the buffer indexes to go out of bounds. I was able to duplicate this with simulation data using the AGC3 block. While the AGC2 block had a stable envelope, the AGC3 seemed to jump around causing this issue.
During a jump, d_error becomes large
gr_complex diff = d_diff_filters[d_filtnum]->filter(&in[count]);
error_r = out[i].real() * diff.real();
error_i = out[i].imag() * diff.imag();
d_error = (error_i + error_r) / 2.0; // average error from I&Q channel
Then d_k becomes large
for(int s = 0; s < d_sps; s++) {
d_rate_f = d_rate_f + d_beta*d_error;
d_k = d_k + d_rate_f + d_alpha*d_error;
}
It looks like there is an attempt to keep things in bounds, but for d_rate_f, not d_k
d_rate_f = gr::branchless_clip(d_rate_f, d_max_dev);
When the loop begins again, d_filtnum becomes large:
d_filtnum = (int)floor(d_k);
The loops to keep d_filtnum in bounds now cause the count to go out of range
while(d_filtnum >= d_nfilters) {
d_k -= d_nfilters;
d_filtnum -= d_nfilters;
count += 1;
}
while(d_filtnum < 0) {
d_k += d_nfilters;
d_filtnum += d_nfilters;
count -= 1;
}
Since count is used as a buffer index, things may now segfault.
Just like for the cpuid_x86() definition, we created a cpuidex_x86() macro that wraps both the GCC macro and the MSVC intrinsic. This was needed to compile volk master at the time of the patch.
I believe from reading the docs that these are equivalent calls for AVX* detection
The changes for __cpuid_count match the style of the existing __get_cpuid usage.
The boost::asio::socket_base::linger option fails under windows. This is probably an issue with boost since there is a similar windows supported dont-linger option. In any case, this patch adds a simple try/catch and logs the warning so the block can be used regardless. Patch below:
diff --git a/gr-blocks/lib/udp_source_impl.cc b/gr-blocks/lib/udp_source_impl.cc
index b1977a8..6d3bd7c 100644
--- a/gr-blocks/lib/udp_source_impl.cc
+++ b/gr-blocks/lib/udp_source_impl.cc
@@ -94,7 +94,14 @@ namespace gr {
d_socket->open(d_endpoint.protocol());
boost::asio::socket_base::linger loption(true, 0);
- d_socket->set_option(loption);
+ try
+ {
+ d_socket->set_option(loption);
+ }
+ catch (const std::exception &ex)
+ {
+ GR_LOG_WARN(d_logger, "Failed to set boost::asio::socket_base::linger " + std::string(ex.what()));
+ }
boost::asio::socket_base::reuse_address roption(true);
d_socket->set_option(roption);
We would like to be able to build against the gr-vocoder C++ header files. Currently the public header codec2.h includes a private header that is not installed. This patch removes the include for the private header and adds the missing relevant definitions.
The gnuradio config.h is included by volk. Since we build for MSVC2012, which does not provide log2, this patch adds a simple log2 definition which is needed to compile volk (volk_32f_log2_32f.h)
Patch 1
Patch 2
And a related patch, use the config.h idiom in ldpc_decoder.cc, which provides round() when otherwise missing under vc11:
The (unsigned long) casts caused pointer truncation and crashes, since long is 32-bits and not the size of a pointer on LLP64 systems. This fix replaces the (unsigned long) casts with (size_t) since size_t is guaranteed to be the size of a pointer.
Looks like a copy-pasta error in the keys from the framesize enum.
Here is the patch:
diff --git a/gr-dtv/grc/dtv_dvb_bbheader_bb.xml b/gr-dtv/grc/dtv_dvb_bbheader_bb.xml
index 49b8595..6ae7134 100644
--- a/gr-dtv/grc/dtv_dvb_bbheader_bb.xml
+++ b/gr-dtv/grc/dtv_dvb_bbheader_bb.xml
@@ -453,12 +453,12 @@ $rolloff.val, $mode.val, $inband.val, $fecblocks, $tsrate)</make>
<hide>$standard.hide_dvbt2</hide>
<option>
<name>Normal</name>
- <key>FECFRAME_NORMAL</key>
+ <key>INPUTMODE_NORMAL</key>
<opt>val:dtv.INPUTMODE_NORMAL</opt>
</option>
<option>
<name>High Efficiency</name>
- <key>FECFRAME_SHORT</key>
+ <key>INPUTMODE_HIEFF</key>
<opt>val:dtv.INPUTMODE_HIEFF</opt>
</option>
</param>
Linking CXX shared library libgnuradio-runtime-3.7.7.1.so
CMakeFiles/gnuradio-runtime.dir/thread/thread.cc.o: In function `gr::thread::thread_bind_to_processor(unsigned long, std::vector<int, std::allocator<int> > const&)':
thread.cc:(.text+0xa0): undefined reference to `pthread_setaffinity_np'
CMakeFiles/gnuradio-runtime.dir/thread/thread.cc.o: In function `gr::thread::thread_unbind(unsigned long)':
thread.cc:(.text+0x4ce): undefined reference to `pthread_setaffinity_np'
CMakeFiles/gnuradio-runtime.dir/thread/thread_body_wrapper.cc.o: In function `gr::thread::mask_signals()':
thread_body_wrapper.cc:(.text+0x101): undefined reference to `pthread_sigmask'
collect2: error: ld returned 1 exit status
gnuradio-runtime/lib/CMakeFiles/gnuradio-runtime.dir/build.make:1776: recipe for target 'gnuradio-runtime/lib/libgnuradio-runtime-3.7.7.1.so.0.0.0' failed
make[2]: *** [gnuradio-runtime/lib/libgnuradio-runtime-3.7.7.1.so.0.0.0] Error 1
CMakeFiles/Makefile2:682: recipe for target 'gnuradio-runtime/lib/CMakeFiles/gnuradio-runtime.dir/all' failed
make[1]: *** [gnuradio-runtime/lib/CMakeFiles/gnuradio-runtime.dir/all] Error 2
Makefile:146: recipe for target 'all' failed
make: *** [all] Error 2
Stock libgnuradio v3.7.7.1 does not have this issue for me.
The check on the taps size is only for empty taps, but taps of size one causes a segfault. Not that a length one array of taps is useful, but a helpful error message would be preferable. And in general for filters, a user may choose to pass in dummy taps (which might be size 1) with the intent of changing them later with a function call.
Currently, we have the PMT helper to bridge the gap beween native STL types in a Pothos::Object container and the PMT interface: https://github.com/pothosware/gnuradio/blob/pothos_support/gnuradio-runtime/lib/pmt_helper.cc
Reimplement PMT as a container holding plain STL
To drastically simplify this we can simply typedef pmt_t as container type like boost::any or Pothos::Object and reimplement the pmt_* family of functions to use plain STL data types held in the container. This implementation could be offered as an upstream substitution for PMT which would allow users to deal with native STL types withouth any API or structual changes.
Its impotant to note that a lot of the more obscure lispier pmt_* calls rely on the implementation overloads for specific PMT types -- something we would loose or have a more difficult time re-implementing. Fortunately, all of GNU Radio only uses a subset of the PMT API. One that would be easy to implement on top of STL.
Interned strings consideration
For a creation time vs comparison time tradeoff, GNU Radio heavily relies on using interned strings in a pmt container. The container pointer is unique per string value and used everywhere from std::map keys to tag key equality checks: https://en.wikipedia.org/wiki/String_interning
This just means that functions like string_to_symbol will continue to interact with a hash table of object containers, one entry per unique string. And that users dealing with the native std::string type will need to call into some sort of interning API call in the cases that a downstream consumer will be expecting to use a container with a "interned" string as a key or comparison.
This should work fine for Pothos::Object, but for a boost::any implementation, we will need to confirm that boost::any has a reference counted container that can be compared via an accessable address. If not, then creating a special InternedString class could be an acceptable alternative.
The packet type consideration
The pmt_helper API cannot be completely removed because we still have need of converting between PDU (pair of std::map<pmt, pmt>, std::vector) and Pothos::Packet (a structured type). Although, I should note that the conversion will be simpler. The rest of the types would require zero effort (no checks nor conversions). Therefore, the pmt_helper implementation wil become considerably smaller.
MSVC versions 2013 and newer provide a definition for round. This commit changes the ifdef to check the MSVC version so that the system-provided round can be used when available.
MSVC2013 and up provides many standard C99 calls and headers. To cleanup warnings and to avoid including a directory with duplicate headers, and to favour including system headers in their place; I created a separate msvc2013 compatibility directory containing a config.h and other missing headers.
This patch effectively ifdefs out the volk executable apps on msvc 2012 because they don't compile. The bug is that one of the C structs claims to not have an assignment operator operator= for the deque structure. This is not an issue on msvc 2013, and probably related to STL. I think its probably properly fixable with a little creativity. Its not a fix, but being able to compile and use volk is still a big benefit.
This patch is backwards compatible and includes io.h conditionally to provide the write() function.
+#ifdef _MSC_VER
+#include <io.h>
+#endif
Move the declaration of D_LLR_FACTOR to the c++ file. static const class members are not supported except for integral types:
Paths in constants.cc.in are escaped for windows initially, and then constants.cc.in is overwritten a second time in the top level CMakeLists.txt and the paths are not escaped. This leads to very broken behaviour for the gnuradio prefs API. If the prefs API cant find a working directory, it also excludes the user's appdata/home directory as well.
The paths are hard-coded into the constants.cc.in. This is bad for installers that may install the bundle into an arbitrary location (that differs from the build location). And certainly this is not isolated to windows.
We have modified the constants.cc.in in the gr-runtime project (https://github.com/pothosware/gr-runtime) to use an environment variable to determine the install root (which defaults to compiled in prefix when not specified). And the sysconfdir and prefsdir both use this configurable prefix, which mimics the logic in CMakeLists, but at runtime instead.
The following snippet is from the gr-runtime project and uses the pothos root path API call. A proper upstream fix would look like this, but use getenv for a GNURADIO_ROOT environment variable. This fix is easiest for us because we already have a modified gnuradio runtime and a convenient way to get a prefix path thats already supported by the installer.
const std::string
prefix()
{
return Pothos::System::getRootPath();
}
const std::string
sysconfdir()
{
if (prefix() == "/usr") return "/@GR_CONF_DIR@";
Poco::Path sysConfPath(prefix());
sysConfPath.append("@GR_CONF_DIR@");
return sysConfPath.toString();
}
const std::string
prefsdir()
{
Poco::Path sysPrefsPath(sysconfdir());
sysPrefsPath.append("gnuradio");
sysPrefsPath.append("conf.d");
return sysPrefsPath.toString();
}
Simply copypasta typo. Here is the commit with fix: eed4937
We are going to replay the pothos support on top of the latest gnuradio maint branch. We will be building this branch for the Pothos SDR windows installer and we should have some patches to upstream.
We have registered conversions for several type-to-pmt calls in this commit: ceab657
This enables arbitrary types to be entered as a parameter when the input type of the call is pmt. Pothos figures out how to convert the object to pmt using the available registered conversions. Complete this work by handling remaining to-pmt conversions for container types. And provide the reverse from-pmt conversions in case those become useful later.
Provide a log2() function that is conditional on the version of visual studio. Newer versions have log2 in the cmath header.
+#if defined(_MSC_VER) && (_MSC_VER < 1800)
+static inline double log2(double n) {return log(n) / log(2.0);}
+#endif
The dynamic array feature is not supported under the MSVC compiler. This patch is backwards compatible and uses conditional ifdefs to allocate the arrays on the stack using alloca().
After downloading the latest Pothos-bundle for x64 (I'm on Win-10), I get the below failure when launching gnuradio-companion.exe
. Seems it is ass-u-me'd Python should be installed from a .MSI file. The first time I've seen a program looking into the Registry to check for Python. My Python 2.7 just works as-is on most cases.
Furthermore, after downloading the Pothos sources from GitHub, I failed to find any .cpp
or .py
file with the above error-message. What gives?
Maybe I can add this Registry key manually? (I don't dare to reinstall Python 2.7).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.