From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Gwenhael Goavec-Merou <gwenj@trabucayre.com>
Cc: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>,
buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/uhd: fix usrp2 build
Date: Sun, 3 Oct 2021 09:15:55 +0200 [thread overview]
Message-ID: <20211003071555.GA1504958@scaer> (raw)
In-Reply-To: <1632995715-74056-1-git-send-email-gwenj@trabucayre.com>
Gwenael, All,
On 2021-09-30 11:55 +0200, Gwenhael Goavec-Merou spake thusly:
> From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
>
> 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
Please backport the two commits in separate patches: do not coalesce
them in a single patch.
Also, each backported commit should also carry your SoB and a terse info
that is is a backport, see below...
> Fixes:
> - http://autobuild.buildroot.net/results/aa2bd1fbe1b4880aa8de389238380a3d35f80b53/
>
> Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
> ---
> ...ost-math-iround-math-sign-with-std-l.patch | 56 +++++++++++++++++++
> 1 file changed, 56 insertions(+)
> create mode 100644 package/uhd/0006-usrp2-Replace-boost-math-iround-math-sign-with-std-l.patch
>
> diff --git a/package/uhd/0006-usrp2-Replace-boost-math-iround-math-sign-with-std-l.patch b/package/uhd/0006-usrp2-Replace-boost-math-iround-math-sign-with-std-l.patch
> new file mode 100644
> index 0000000000..d2460dfd35
> --- /dev/null
> +++ b/package/uhd/0006-usrp2-Replace-boost-math-iround-math-sign-with-std-l.patch
> @@ -0,0 +1,56 @@
> +From 025e8a9e9334ea1111003e3b42c75fcb3036c639 Mon Sep 17 00:00:00 2001
> +From: StefanBruens <stefan.bruens@rwth-aachen.de>
> +Date: Wed, 5 May 2021 18:24:58 +0200
> +Subject: [PATCH] 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 <aaron.rossetto@ni.com>
Here, belowe the SoB by Aaron, you'd add something like:
[gwenj@trabucayre.com: backport from upstream]
Signed-off-by: Gwenhael Goavec-Merou <gwenj@trabucayre.com>
Note: no need to repeat the upstream commit hash here: it is already
visible in the patch headers. But of course, the one you have here does
not exist in the upstream tree.
Regards,
Yann E. MORIN.
> +---
> + 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 1be4c7339..41bd0fa89 100644
> +--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
> ++++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
> +@@ -22,6 +22,7 @@
> + #include <boost/asio/ip/address_v4.hpp>
> + #include <boost/asio.hpp> //used for htonl and ntohl
> + #include <boost/thread.hpp>
> ++#include <cmath>
> +
> + using namespace uhd;
> + using namespace uhd::usrp;
> +@@ -844,20 +845,19 @@ double usrp2_impl::set_tx_dsp_freq(
> + _tree->access<double>("/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<int>(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) + ", leftover DSP tuning: "
> ++ "Nyquist 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
> +
> --
> 2.30.2
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2021-10-03 7:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 9:55 [Buildroot] [PATCH] package/uhd: fix usrp2 build Gwenhael Goavec-Merou
2021-10-03 7:15 ` Yann E. MORIN [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211003071555.GA1504958@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@buildroot.org \
--cc=gwenhael.goavec-merou@trabucayre.com \
--cc=gwenj@trabucayre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox