From patchwork Mon Oct 11 08:43:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwenhael Goavec-Merou X-Patchwork-Id: 1539189 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HSY5S3M0xz9s1l for ; Mon, 11 Oct 2021 20:14:18 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B191960723; Mon, 11 Oct 2021 09:14:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lnWHXrLRrwG4; Mon, 11 Oct 2021 09:14:15 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 078D1605BF; Mon, 11 Oct 2021 09:14:15 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 23F761BF3F3 for ; Mon, 11 Oct 2021 09:14:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 20478402BC for ; Mon, 11 Oct 2021 09:14:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LqTM69XAgLGK for ; Mon, 11 Oct 2021 09:14:12 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from mail (kmf.trabucayre.com [91.121.117.161]) by smtp4.osuosl.org (Postfix) with ESMTP id C1720402AF for ; Mon, 11 Oct 2021 09:14:11 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by mail (Postfix) with ESMTP id 30ABE39856; Mon, 11 Oct 2021 10:43:54 +0200 (CEST) From: Gwenhael Goavec-Merou To: buildroot@buildroot.org Date: Mon, 11 Oct 2021 10:43:52 +0200 Message-Id: <1633941832-35691-1-git-send-email-gwenj@trabucayre.com> X-Mailer: git-send-email 1.6.4.2 Subject: [Buildroot] [PATCH v2] package/uhd: fix usrp2 build X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gwenhael Goavec-Merou MIME-Version: 1.0 Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" From: Gwenhael Goavec-Merou Fix build failure: uhd-3.15.0.0/host/lib/usrp/usrp2/usrp2_impl.cpp:847:29: error: 'boost::math' has not been declared for boost::math::sign and boost::math::iround Backport and adapt commits: - 3796175f32f0cc24c16809d8175d423bc7053de9 - d1c6290fe9c8b01068abfca6f272e2a1e031b9de Fixes: - http://autobuild.buildroot.net/results/aa2bd1fbe1b4880aa8de389238380a3d35f80b53/ Signed-off-by: Gwenhael Goavec-Merou --- Changes v1 -> v2: - backport the two commits in separate patches (Yann) - add SoB and backport info (Yann) --- ...ost-math-iround-math-sign-with-std-l.patch | 60 +++++++++++++++++++ ...explicit-template-type-for-std-min-T.patch | 28 +++++++++ 2 files changed, 88 insertions(+) create mode 100644 package/gnuradio/0006-usrp2-Replace-boost-math-iround-math-sign-with-std-l.patch create mode 100644 package/gnuradio/0007-usrp2-Use-explicit-template-type-for-std-min-T.patch diff --git a/package/gnuradio/0006-usrp2-Replace-boost-math-iround-math-sign-with-std-l.patch b/package/gnuradio/0006-usrp2-Replace-boost-math-iround-math-sign-with-std-l.patch new file mode 100644 index 0000000000..27e54a3515 --- /dev/null +++ b/package/gnuradio/0006-usrp2-Replace-boost-math-iround-math-sign-with-std-l.patch @@ -0,0 +1,60 @@ +From 3796175f32f0cc24c16809d8175d423bc7053de9 Mon Sep 17 00:00:00 2001 +From: StefanBruens +Date: Wed, 5 May 2021 18:24:58 +0200 +Subject: [PATCH 003/121] usrp2: Replace boost::math::iround/math::sign with + std::lround + +Instead of multiplying zone with the sign repeatedly just make +the zone a signed value. + +See #437, #438 + +Signed-off-by: Aaron Rossetto +[gwenhael.goavec-merou@trabucayre.com: backport from upstream] +Signed-off-by: Gwenhael Goavec-Merou +--- + host/lib/usrp/usrp2/usrp2_impl.cpp | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp +index d780a6c6b..59fd9849c 100644 +--- a/host/lib/usrp/usrp2/usrp2_impl.cpp ++++ b/host/lib/usrp/usrp2/usrp2_impl.cpp +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + using namespace uhd; + using namespace uhd::usrp; +@@ -916,22 +917,21 @@ double usrp2_impl::set_tx_dsp_freq(const std::string& mb, const double freq_) + const double tick_rate = _tree->access("/mboards/" + mb + "/tick_rate").get(); + + // calculate the DAC shift (multiples of rate) +- const int sign = boost::math::sign(new_freq); +- const int zone = std::min(boost::math::iround(new_freq / tick_rate), 2); +- const double dac_shift = sign * zone * tick_rate; ++ const int zone = std::max(std::min(std::lround(new_freq / tick_rate), 2), -2); ++ const double dac_shift = zone * tick_rate; + new_freq -= dac_shift; // update FPGA DSP target freq + UHD_LOG_TRACE("USRP2", + "DSP Tuning: Requested " + std::to_string(freq_ / 1e6) + + " MHz, Using " + "Nyquist zone " +- + std::to_string(sign * zone) ++ + std::to_string(zone) + + ", leftover DSP tuning: " + std::to_string(new_freq / 1e6) + " MHz."); + + // set the DAC shift (modulation mode) + if (zone == 0) { + _mbc[mb].codec->set_tx_mod_mode(0); // no shift + } else { +- _mbc[mb].codec->set_tx_mod_mode(sign * 4 / zone); // DAC interp = 4 ++ _mbc[mb].codec->set_tx_mod_mode(4 / zone); // DAC interp = 4 + } + + return _mbc[mb].tx_dsp->set_freq(new_freq) + dac_shift; // actual freq +-- +2.32.0 + diff --git a/package/gnuradio/0007-usrp2-Use-explicit-template-type-for-std-min-T.patch b/package/gnuradio/0007-usrp2-Use-explicit-template-type-for-std-min-T.patch new file mode 100644 index 0000000000..e5f4dd2d25 --- /dev/null +++ b/package/gnuradio/0007-usrp2-Use-explicit-template-type-for-std-min-T.patch @@ -0,0 +1,28 @@ +From d1c6290fe9c8b01068abfca6f272e2a1e031b9de Mon Sep 17 00:00:00 2001 +From: StefanBruens +Date: Wed, 5 May 2021 18:49:40 +0200 +Subject: [PATCH 004/121] usrp2: Use explicit template type for std::min + +Signed-off-by: Aaron Rossetto +[gwenhael.goavec-merou@trabucayre.com: backport from upstream] +Signed-off-by: Gwenhael Goavec-Merou +--- + host/lib/usrp/usrp2/usrp2_impl.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp +index 59fd9849c..e82a9fa71 100644 +--- a/host/lib/usrp/usrp2/usrp2_impl.cpp ++++ b/host/lib/usrp/usrp2/usrp2_impl.cpp +@@ -917,7 +917,7 @@ double usrp2_impl::set_tx_dsp_freq(const std::string& mb, const double freq_) + const double tick_rate = _tree->access("/mboards/" + mb + "/tick_rate").get(); + + // calculate the DAC shift (multiples of rate) +- const int zone = std::max(std::min(std::lround(new_freq / tick_rate), 2), -2); ++ const int zone = std::max(std::min(std::lround(new_freq / tick_rate), 2), -2); + const double dac_shift = zone * tick_rate; + new_freq -= dac_shift; // update FPGA DSP target freq + UHD_LOG_TRACE("USRP2", +-- +2.32.0 +