Merge branch 'next' of github.com:gnss-sdr/gnss-sdr into pps_lime

This commit is contained in:
Javier Arribas 2023-04-11 09:35:33 +02:00
commit 9e3cfd4997
66 changed files with 1634 additions and 571 deletions

View File

@ -29,15 +29,15 @@ jobs:
- arch: armv7
distro: ubuntu22.04
compiler: { name: g++-12, cc: gcc-12, cxx: g++-12 }
- arch: ppc64le
distro: ubuntu22.04
compiler: { name: g++-12, cc: gcc-12, cxx: g++-12 }
- arch: s390x
distro: ubuntu22.04
compiler: { name: g++-12, cc: gcc-12, cxx: g++-12 }
- arch: riscv64
distro: ubuntu22.04
compiler: { name: g++-12, cc: gcc-12, cxx: g++-12 }
# - arch: ppc64le
# distro: ubuntu22.04
# compiler: { name: g++-12, cc: gcc-12, cxx: g++-12 }
# - arch: s390x
# distro: ubuntu22.04
# compiler: { name: g++-12, cc: gcc-12, cxx: g++-12 }
steps:
- uses: actions/checkout@v3.1.0

View File

@ -85,19 +85,15 @@ jobs:
../install/position_test
clang-format:
runs-on: macos-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install dependencies
run: brew install clang-format
- name: run clang-format
run: find . -iname \*.h -o -iname \*.c -o -iname \*.cc | xargs clang-format -style=file -i
- name: check
run: |
git diff > clang_format.patch
echo -e "if \n [ -s clang_format.patch ] \nthen \n echo "clang-format not applied:"; echo ""; more clang_format.patch; exit 1 \nfi \n" > detect
chmod +x ./detect
./detect
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: "15"
check-path: "src"
exclude-regex: '(libs\/gsl\/)|^.*\.(cu|proto)$'
clang-tidy:
runs-on: macos-latest

View File

@ -51,6 +51,7 @@ David Pubill david.pubill@cttc.cat Contributor
Fran Fabra fabra@ice.csic.es Contributor
Gabriel Araujo gabriel.araujo.5000@gmail.com Contributor
Gerald LaMountain gerald@gece.neu.edu Contributor
Into Pääkkönen into.paakkonen@aalto.fi Contributor
Jim Melton jim.melton@sncorp.com Contributor
Josh Schindehette jschindehette@geontech.com Contributor
Leonardo Tonetto tonetto.dev@gmail.com Contributor

View File

@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2022 C. Fernandez-Prades carles.fernandez(at)cttc.es
# SPDX-FileCopyrightText: 2023 C. Fernandez-Prades carles.fernandez(at)cttc.es
---
authors:
- affiliation: "Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)"
@ -110,7 +110,7 @@ authors:
family-names: "van der Linden"
given-names: Stefan
cff-version: "1.2.0"
date-released: "2022-04-20"
date-released: "2023-04-06"
identifiers:
- description: "The concept DOI of the work. This is a DOI always pointing to the latest stable release."
type: doi
@ -318,4 +318,4 @@ repository-code: "https://github.com/gnss-sdr/gnss-sdr"
title: GNSS-SDR
type: software
url: "https://gnss-sdr.org"
version: "0.0.17"
version: "0.0.18"

View File

@ -1,7 +1,7 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2010-2022 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-FileCopyrightText: 2010-2023 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
################################################################################
@ -16,7 +16,7 @@ endif()
# Build type can still be overridden by setting -DCMAKE_BUILD_TYPE=
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
cmake_minimum_required(VERSION 2.8.12...3.25)
cmake_minimum_required(VERSION 2.8.12...3.26)
project(gnss-sdr CXX C)
set(GNSSSDR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # Allows to be a sub-project
@ -178,9 +178,9 @@ endif()
set(VERSION_INFO_MAJOR_VERSION 0)
set(VERSION_INFO_API_COMPAT 0)
if(${THIS_IS_A_RELEASE})
set(VERSION_INFO_MINOR_VERSION 17)
set(VERSION_INFO_MINOR_VERSION 18)
else()
set(VERSION_INFO_MINOR_VERSION 17.git-${GIT_BRANCH}-${GIT_COMMIT_HASH})
set(VERSION_INFO_MINOR_VERSION 18.git-${GIT_BRANCH}-${GIT_COMMIT_HASH})
endif()
set(VERSION ${VERSION_INFO_MAJOR_VERSION}.${VERSION_INFO_API_COMPAT}.${VERSION_INFO_MINOR_VERSION})
@ -317,52 +317,43 @@ endif()
################################################################################
# Minimum required versions
################################################################################
set(GNSSSDR_GCC_MIN_VERSION "4.7.2")
set(GNSSSDR_CLANG_MIN_VERSION "3.4.0")
set(GNSSSDR_APPLECLANG_MIN_VERSION "500")
set(GNSSSDR_GNURADIO_MIN_VERSION "3.7.3")
set(GNSSSDR_BOOST_MIN_VERSION "1.53")
set(GNSSSDR_PYTHON_MIN_VERSION "2.7")
set(GNSSSDR_PYTHON3_MIN_VERSION "3.4")
set(GNSSSDR_MAKO_MIN_VERSION "0.4.2")
set(GNSSSDR_ARMADILLO_MIN_VERSION "5.300.0")
set(GNSSSDR_BOOST_MIN_VERSION "1.53")
set(GNSSSDR_CLANG_MIN_VERSION "3.4.0")
set(GNSSSDR_GCC_MIN_VERSION "4.7.2")
set(GNSSSDR_GFLAGS_MIN_VERSION "2.1.2")
set(GNSSSDR_GNURADIO_MIN_VERSION "3.7.3")
set(GNSSSDR_MAKO_MIN_VERSION "0.4.2")
set(GNSSSDR_MATIO_MIN_VERSION "1.5.3")
set(GNSSSDR_PROTOBUF_MIN_VERSION "3.0.0")
set(GNSSSDR_PYTHON_MIN_VERSION "2.7")
set(GNSSSDR_PYTHON3_MIN_VERSION "3.4")
################################################################################
# Versions to download and build (but not installed) if not found
# Versions to download and build (but not to install system-wide) if not found
################################################################################
set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.2.x")
set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2")
set(GNSSSDR_GLOG_LOCAL_VERSION "0.6.0")
set(GNSSSDR_ARMADILLO_LOCAL_VERSION "11.2.x")
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR
CMAKE_VERSION VERSION_LESS 3.5)
set(GNSSSDR_GTEST_LOCAL_VERSION "1.10.x")
else()
set(GNSSSDR_GTEST_LOCAL_VERSION "1.13.0")
endif()
set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master")
if(CMAKE_VERSION VERSION_GREATER 3.17.0)
set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.0.0")
else()
set(GNSSSDR_GNSSTK_LOCAL_VERSION "13.7.0")
endif()
set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.23")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "22.2")
set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.13")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.9")
set(GNSSSDR_GTEST_LOCAL_VERSION "1.13.0")
set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master")
set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.0.0")
set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.7.1")
set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7")
# Downgrade versions if requirements are not met
if(CMAKE_VERSION VERSION_LESS "3.16")
set(GNSSSDR_GLOG_LOCAL_VERSION "0.5.0")
endif()
if(CMAKE_VERSION VERSION_LESS "3.3")
set(GNSSSDR_GLOG_LOCAL_VERSION "0.4.0") # Fix for Debian 8
set(GNSSSDR_GLOG_LOCAL_VERSION "0.4.0")
endif()
if(CMAKE_VERSION VERSION_LESS "3.0.2")
@ -370,6 +361,20 @@ if(CMAKE_VERSION VERSION_LESS "3.0.2")
set(GNSSSDR_GLOG_LOCAL_VERSION "0.3.4") # Fix for Ubuntu 14.04
endif()
if(CMAKE_CROSSCOMPILING OR CMAKE_VERSION VERSION_LESS "3.13")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.12")
endif()
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR
CMAKE_VERSION VERSION_LESS 3.5)
set(GNSSSDR_GTEST_LOCAL_VERSION "1.10.x")
endif()
if(CMAKE_VERSION VERSION_LESS "3.17")
set(GNSSSDR_GNSSTK_LOCAL_VERSION "13.7.0")
endif()
################################################################################
@ -1959,17 +1964,13 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
set(ARMADILLO_BUILD_COMMAND ${CMAKE_COMMAND}
"--build" "${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE}"
"--config" $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
"--target" install
)
if(CMAKE_TOOLCHAIN_FILE)
set(ARMADILLO_TOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
else()
set(ARMADILLO_TOOLCHAIN_FILE "")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND ENABLE_OWN_ARMADILLO)
set(DARWIN_DISABLE_HDF5 -DDETECT_HDF5=false)
else()
set(DARWIN_DISABLE_HDF5 "")
endif()
set(ARMADILLO_CXX_VERSION "")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.8.3)
set(ARMADILLO_CXX_VERSION -DCMAKE_CXX_FLAGS=-std=c++11)
@ -1979,41 +1980,38 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
PREFIX ${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE}
GIT_REPOSITORY https://gitlab.com/conradsnicta/armadillo-code.git
GIT_TAG ${armadillo_BRANCH}
UPDATE_COMMAND ""
SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE}
BINARY_DIR ${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE}
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
-DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE}
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SMOKE_TEST=OFF
-DALLOW_BLAS_LAPACK_MACOS=ON
${ARMADILLO_CXX_VERSION}
${DARWIN_DISABLE_HDF5}
${ARMADILLO_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
BUILD_COMMAND ${ARMADILLO_BUILD_COMMAND}
UPDATE_COMMAND ""
INSTALL_COMMAND ""
)
else()
if(CMAKE_VERSION VERSION_GREATER 3.12.0)
set(PARALLEL_BUILD "--parallel 2")
endif()
ExternalProject_Add(armadillo-${armadillo_RELEASE}
PREFIX ${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE}
GIT_REPOSITORY https://gitlab.com/conradsnicta/armadillo-code.git
GIT_TAG ${armadillo_BRANCH}
UPDATE_COMMAND ""
SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE}
BINARY_DIR ${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE}
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
-DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE}
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SMOKE_TEST=OFF
-DALLOW_BLAS_LAPACK_MACOS=ON
${ARMADILLO_CXX_VERSION}
${DARWIN_DISABLE_HDF5}
${ARMADILLO_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
BUILD_COMMAND "${ARMADILLO_BUILD_COMMAND} ${PARALLEL_BUILD}"
BUILD_COMMAND ${ARMADILLO_BUILD_COMMAND}
BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE}/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX}
UPDATE_COMMAND ""
INSTALL_COMMAND ""
)
endif()
@ -2066,6 +2064,20 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
if(ARPACK_LIBRARY)
target_link_libraries(Armadillo::armadillo INTERFACE ${ARPACK_LIBRARY})
endif()
find_library(FLEXIBLAS_LIBRARY
NAMES flexiblas
PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} /opt/local/lib /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/local/lib64
)
if(FLEXIBLAS_LIBRARY)
target_link_libraries(Armadillo::armadillo INTERFACE ${FLEXIBLAS_LIBRARY})
endif()
find_library(SUPERLU_LIBRARY
NAMES superlu
PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} /opt/local/lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/local/lib64
)
if(SUPERLU_LIBRARY)
target_link_libraries(Armadillo::armadillo INTERFACE ${SUPERLU_LIBRARY})
endif()
endif()
@ -2343,6 +2355,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
PREFIX ${GNSSSDR_BINARY_DIR}/matio
GIT_REPOSITORY https://github.com/tbeu/matio
GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION}
UPDATE_COMMAND ""
SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}
BINARY_DIR ${GNSSSDR_BINARY_DIR}/matio
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
@ -2590,136 +2603,177 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI
set(PROTOBUF_PROTOC_EXECUTABLE "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc")
endif()
else()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
if(NOT EXISTS "/usr/bin/libtoolize")
message(" libtool has not been found.")
message(" You can try to install it by typing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo yum groupinstall 'Development Tools'")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(" sudo zypper install libtoool")
if(CMAKE_VERSION VERSION_GREATER "3.13")
find_package(absl)
set_package_properties(absl PROPERTIES
URL "https://github.com/abseil/abseil-cpp"
PURPOSE "Abseil-cpp >= 20230117 required to be installed before building Protocol Buffers >22.x on the fly."
TYPE OPTIONAL
)
if(absl_FOUND)
if(absl_VERSION)
if(${absl_VERSION} VERSION_LESS "20230117")
unset(absl_FOUND CACHE)
set(absl_FOUND OFF)
endif()
else()
message(" sudo apt-get install libtool")
unset(absl_FOUND CACHE)
set(absl_FOUND OFF)
endif()
message(FATAL_ERROR "libtool is required to build Protocol Buffers from source")
endif()
if(EXISTS "/usr/bin/aclocal" OR
EXISTS "/usr/bin/aclocal-1.16" OR
EXISTS "/usr/bin/aclocal-1.15" OR
EXISTS "/usr/bin/aclocal-1.14" OR
EXISTS "/usr/bin/aclocal-1.13" OR
EXISTS "/usr/bin/aclocal-1.11" OR
EXISTS "/usr/bin/aclocal-1.10")
message(STATUS "Automake found.")
if(absl_FOUND)
set_package_properties(absl PROPERTIES
DESCRIPTION "An open-source collection of C++ code designed to augment the C++ standard library (found: v${absl_VERSION})"
)
else()
message(" aclocal has not been found.")
message(" You can try to install it by typing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo yum groupinstall 'Development Tools'")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(" sudo zypper install automake")
if(absl_VERSION)
set_package_properties(absl PROPERTIES
DESCRIPTION "An open-source collection of C++ code designed to augment the C++ standard library (found: v${absl_VERSION})"
)
else()
message(" sudo apt-get install automake")
set_package_properties(absl PROPERTIES
DESCRIPTION "An open-source collection of C++ code designed to augment the C++ standard library"
)
endif()
message(FATAL_ERROR "aclocal is required to build Protocol Buffers from source")
message(STATUS "The Abseil library (https://github.com/abseil/abseil-cpp) >= v20230117 is required to be installed before building Protocol Buffers >22.x on the fly.")
message(STATUS " Instead, Protocol Buffers v21.12 will be built, which does not require Abseil.")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.12")
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((NOT EXISTS /usr/local/bin/glibtoolize AND NOT EXISTS /opt/local/bin/glibtoolize) OR
(NOT EXISTS /usr/local/bin/aclocal AND NOT EXISTS /opt/local/bin/aclocal))
message(" libtool/automake tools have not been found.")
message(" You can try to install them by typing:")
message(" 'sudo port install libtool automake', if you use Macports, or 'brew install libtool automake', if you use Homebrew")
message(FATAL_ERROR "libtool/automake tools are required to build Protocol Buffers from source")
if(CMAKE_VERSION VERSION_LESS "3.13" OR NOT absl_FOUND)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
if(NOT EXISTS "/usr/bin/libtoolize")
message(" libtool has not been found.")
message(" You can try to install it by typing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo yum groupinstall 'Development Tools'")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(" sudo zypper install libtoool")
else()
message(" sudo apt-get install libtool")
endif()
message(FATAL_ERROR "libtool is required to build Protocol Buffers from source")
endif()
if(EXISTS "/usr/bin/aclocal" OR
EXISTS "/usr/bin/aclocal-1.16" OR
EXISTS "/usr/bin/aclocal-1.15" OR
EXISTS "/usr/bin/aclocal-1.14" OR
EXISTS "/usr/bin/aclocal-1.13" OR
EXISTS "/usr/bin/aclocal-1.11" OR
EXISTS "/usr/bin/aclocal-1.10")
message(STATUS "Automake found.")
else()
message(" aclocal has not been found.")
message(" You can try to install it by typing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo yum groupinstall 'Development Tools'")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(" sudo zypper install automake")
else()
message(" sudo apt-get install automake")
endif()
message(FATAL_ERROR "aclocal is required to build Protocol Buffers from source")
endif()
endif()
if(CMAKE_GENERATOR STREQUAL Xcode)
if(EXISTS /opt/local/bin/glibtoolize OR EXISTS /opt/local/bin/aclocal)
if(NOT EXISTS /usr/local/bin/glibtoolize OR NOT EXISTS /usr/local/bin/aclocal)
message(" WARNING: libtool/automake binaries cannot be found by Xcode. Please do:")
message("sudo ln -s /opt/local/bin/glibtoolize /usr/local/bin/")
message("sudo ln -s /opt/local/bin/aclocal /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autom4te /usr/local/bin/")
message("sudo ln -s /opt/local/bin/automake /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autoconf /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autoreconf /usr/local/bin/")
message(FATAL_ERROR "libtool/automake tools cannot be found by Xcode")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((NOT EXISTS /usr/local/bin/glibtoolize AND NOT EXISTS /opt/local/bin/glibtoolize) OR
(NOT EXISTS /usr/local/bin/aclocal AND NOT EXISTS /opt/local/bin/aclocal))
message(" libtool/automake tools have not been found.")
message(" You can try to install them by typing:")
message(" 'sudo port install libtool automake', if you use Macports, or 'brew install libtool automake', if you use Homebrew")
message(FATAL_ERROR "libtool/automake tools are required to build Protocol Buffers from source")
endif()
if(CMAKE_GENERATOR STREQUAL Xcode)
if(EXISTS /opt/local/bin/glibtoolize OR EXISTS /opt/local/bin/aclocal)
if(NOT EXISTS /usr/local/bin/glibtoolize OR NOT EXISTS /usr/local/bin/aclocal)
message(" WARNING: libtool/automake binaries cannot be found by Xcode. Please do:")
message("sudo ln -s /opt/local/bin/glibtoolize /usr/local/bin/")
message("sudo ln -s /opt/local/bin/aclocal /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autom4te /usr/local/bin/")
message("sudo ln -s /opt/local/bin/automake /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autoconf /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autoreconf /usr/local/bin/")
message(FATAL_ERROR "libtool/automake tools cannot be found by Xcode")
endif()
endif()
endif()
endif()
endif()
set(PROTOBUF_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM})
if(PROTOBUF_MAKE_PROGRAM MATCHES "ninja" OR CMAKE_GENERATOR STREQUAL Xcode)
find_program(MAKE_EXECUTABLE make
PATHS
/usr/bin
/usr/local/bin
)
if(NOT MAKE_EXECUTABLE)
message(FATAL_ERROR "make is required to build Protocol Buffers from source.")
endif()
set(PROTOBUF_MAKE_PROGRAM ${MAKE_EXECUTABLE})
endif()
if(CMAKE_VERSION VERSION_LESS 3.2)
ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
PREFIX ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
BINARY_DIR ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
UPDATE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh
CONFIGURE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
BUILD_COMMAND ${PROTOBUF_MAKE_PROGRAM}
INSTALL_COMMAND ${PROTOBUF_MAKE_PROGRAM} DESTDIR= install
)
else()
if(CMAKE_MAKE_PROGRAM MATCHES "make")
include(ProcessorCount)
ProcessorCount(NUMBER_OF_PROCESSORS)
if(NUMBER_OF_PROCESSORS GREATER 1)
set(PROTOBUF_PARALLEL_BUILD "-j${NUMBER_OF_PROCESSORS}")
set(PROTOBUF_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM})
if(PROTOBUF_MAKE_PROGRAM MATCHES "ninja" OR CMAKE_GENERATOR STREQUAL Xcode)
find_program(MAKE_EXECUTABLE make
PATHS
/usr/bin
/usr/local/bin
)
if(NOT MAKE_EXECUTABLE)
message(FATAL_ERROR "make is required to build Protocol Buffers from source.")
endif()
set(PROTOBUF_MAKE_PROGRAM ${MAKE_EXECUTABLE})
endif()
if(CMAKE_VERSION VERSION_LESS 3.2)
ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
PREFIX ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
BINARY_DIR ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
UPDATE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh
CONFIGURE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
BUILD_COMMAND ${PROTOBUF_MAKE_PROGRAM}
INSTALL_COMMAND ${PROTOBUF_MAKE_PROGRAM} DESTDIR= install
)
else()
if(CMAKE_MAKE_PROGRAM MATCHES "make")
include(ProcessorCount)
ProcessorCount(NUMBER_OF_PROCESSORS)
if(NUMBER_OF_PROCESSORS GREATER 1)
set(PROTOBUF_PARALLEL_BUILD "-j${NUMBER_OF_PROCESSORS}")
endif()
endif()
ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
PREFIX ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
BINARY_DIR ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
UPDATE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh
CONFIGURE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
BUILD_COMMAND ${PROTOBUF_MAKE_PROGRAM} ${PROTOBUF_PARALLEL_BUILD}
INSTALL_COMMAND ${PROTOBUF_MAKE_PROGRAM} DESTDIR= install
BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}
${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc
)
endif()
ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
PREFIX ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
BINARY_DIR ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
UPDATE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh
CONFIGURE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
BUILD_COMMAND ${PROTOBUF_MAKE_PROGRAM} ${PROTOBUF_PARALLEL_BUILD}
INSTALL_COMMAND ${PROTOBUF_MAKE_PROGRAM} DESTDIR= install
BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}
${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc
)
endif()
if(NOT TARGET protobuf::protoc)
add_executable(protobuf::protoc IMPORTED)
add_dependencies(protobuf::protoc protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
if(NOT TARGET protobuf::protoc)
add_executable(protobuf::protoc IMPORTED)
add_dependencies(protobuf::protoc protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
endif()
unset(Protobuf_PROTOC_EXECUTABLE)
set(PROTOBUF_PROTOC_EXECUTABLE "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc")
set_target_properties(protobuf::protoc PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc"
INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protoc${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include)
if(NOT TARGET protobuf::libprotobuf)
add_library(protobuf::libprotobuf STATIC IMPORTED)
add_dependencies(protobuf::libprotobuf protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
endif()
set_target_properties(protobuf::libprotobuf PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}"
INTERFACE_INCLUDE_DIRECTORIES "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include"
INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
if(CMAKE_VERSION VERSION_LESS "3.10")
set(Protobuf_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE})
endif()
else() # CMake >= 3.13 and Abseil found
include(BuildProtobuf)
endif()
unset(Protobuf_PROTOC_EXECUTABLE)
set(PROTOBUF_PROTOC_EXECUTABLE "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc")
set_target_properties(protobuf::protoc PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc"
INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protoc${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
endif()
file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include)
if(NOT TARGET protobuf::libprotobuf)
add_library(protobuf::libprotobuf STATIC IMPORTED)
add_dependencies(protobuf::libprotobuf protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
endif()
set_target_properties(protobuf::libprotobuf PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}"
INTERFACE_INCLUDE_DIRECTORIES "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include"
INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
if(CMAKE_VERSION VERSION_LESS 3.10)
set(Protobuf_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE})
endif()
if(${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION})
if(NOT (${Protobuf_VERSION} EQUAL "0.0.0"))

View File

@ -125,7 +125,7 @@ This section describes how to set up the compilation environment in GNU/Linux or
## GNU/Linux
- Tested distributions: Ubuntu 14.04 LTS and above; Debian 8.0 "jessie" and
- Tested distributions: Ubuntu 14.04 LTS and above; Debian 9.0 "stretch" and
above; Arch Linux; CentOS 7; Fedora 26 and above; OpenSUSE 42.3 and above.
- Supported microprocessor architectures:
- i386: Intel x86 instruction set (32-bit microprocessors).
@ -160,7 +160,7 @@ packages.
#### Debian / Ubuntu
If you are using Debian 8, Ubuntu 14.10 or above, this can be done by copying
If you are using Debian 9, Ubuntu 14.10 or above, this can be done by copying
and pasting the following line in a terminal:
```
@ -172,10 +172,9 @@ $ sudo apt-get install build-essential cmake git pkg-config libboost-dev libboos
libprotobuf-dev protobuf-compiler python3-mako
```
Please note that the required files from `libgtest-dev` were moved to
`googletest` in Debian 9 "stretch" and Ubuntu 18.04 "bionic", and moved back
again to `libgtest-dev` in Debian 10 "buster" and Ubuntu 18.10 "cosmic" (and
above).
Please note that the required files from `libgtest-dev` were named `googletest`
in Debian 9 "stretch" and Ubuntu 18.04 "bionic", and renamed to `libgtest-dev`
in Debian 10 "buster" and above.
Since Ubuntu 21.04 Hirsute / Debian 11, the package `libcpu-features-dev` is
also required.
@ -195,10 +194,6 @@ In distributions older than Ubuntu 16.04 or Debian 9, `python3-mako` must be
replaced by `python-mako`. For Ubuntu 14.04, you will need to add the package
`python-six` to the list of dependencies.
**Note for Debian 8 "jessie" users:** please see the note about `libmatio-dev`
above. Install `libtool`, `automake` and `libhdf5-dev` instead. You will also
need `python-six`.
Once you have installed these packages, you can jump directly to
[download the source code and build GNSS-SDR](#clone-gnss-sdrs-git-repository).
@ -408,9 +403,9 @@ $ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/Linux
$ sudo yum install lapack-devel blas-devel # For Fedora/CentOS/RHEL
$ sudo zypper install lapack-devel blas-devel # For OpenSUSE
$ sudo pacman -S blas lapack # For Arch Linux
$ wget https://sourceforge.net/projects/arma/files/armadillo-11.2.1.tar.xz
$ tar xvfz armadillo-11.2.1.tar.xz
$ cd armadillo-11.2.1
$ wget https://sourceforge.net/projects/arma/files/armadillo-12.0.1.tar.xz
$ tar xvfz armadillo-12.0.1.tar.xz
$ cd armadillo-12.0.1
$ cmake .
$ make
$ sudo make install
@ -477,24 +472,14 @@ $ sudo ldconfig
#### Install [Protocol Buffers](https://developers.google.com/protocol-buffers/ "Protocol Buffers' Homepage"), a portable mechanism for serialization of structured data
GNSS-SDR requires Protocol Buffers v3.0.0 or later. If the packages that come
with your distribution are older than that (_e.g._, Ubuntu 16.04 Xenial and
Debian 8 Jessie came with older versions), then you will need to install it
manually. First, install the dependencies:
with your distribution are older than that (_e.g._, Ubuntu 16.04 Xenial came
with an older versions), then you will need to install it manually:
```
$ sudo apt-get install autoconf automake libtool curl make g++ unzip
```
and then:
```
$ git clone https://github.com/protocolbuffers/protobuf.git
$ git clone --recursive https://github.com/protocolbuffers/protobuf.git
$ cd protobuf
$ git submodule update --init --recursive
$ ./autogen.sh
$ /configure
$ make -j$(nproc)
$ sudo make install
$ cmake -DABSL_PROPAGATE_CXX_STD=ON -Dprotobuf_BUILD_TESTS=OFF .
$ cmake --build --config Release --target install .
$ sudo ldconfig
```

View File

@ -0,0 +1,187 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2023 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
# Downloads and builds the protoc compiler and static libraries of Protocol
# Buffers >= v22.0 (see https://protobuf.dev/) It requires CMake >= 3.10 and the
# abseil-cpp >= 20230117 libraries (see https://github.com/abseil/abseil-cpp)
# already installed. Zlib is used if found.
#
# Note: requires the patch command if using GCC >= 13 or Clang >= 16
#
# Creates protobuf::libprotobuf and protobuf::protoc imported targets.
if(NOT GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION)
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "22.2")
endif()
if(NOT GNSSSDR_BINARY_DIR)
set(GNSSSDR_BINARY_DIR "${PROJECT_BINARY_DIR}")
endif()
if(NOT ZLIB_FOUND)
find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES
URL "https://www.zlib.net/"
PURPOSE "Required to build Protocol Buffers."
TYPE REQUIRED
)
if(ZLIB_FOUND AND ZLIB_VERSION_STRING)
set_package_properties(ZLIB PROPERTIES
DESCRIPTION "A Massively Spiffy Yet Delicately Unobtrusive Compression Library (found: v${ZLIB_VERSION_STRING})"
)
else()
set_package_properties(ZLIB PROPERTIES
DESCRIPTION "A Massively Spiffy Yet Delicately Unobtrusive Compression Library"
)
endif()
if(ZLIB_FOUND)
set(ZLIB_LIBRARIES_ ${ZLIB_LIBRARIES})
set(USE_ZLIB -Dprotobuf_WITH_ZLIB=ON)
else()
set(ZLIB_LIBRARIES_ "")
set(USE_ZLIB -Dprotobuf_WITH_ZLIB=OFF)
endif()
else()
set(ZLIB_LIBRARIES_ ${ZLIB_LIBRARIES})
set(USE_ZLIB -Dprotobuf_WITH_ZLIB=ON)
endif()
include(GNUInstallDirs)
list(APPEND UTF8_LIBRARIES
${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}utf8_validity${CMAKE_STATIC_LIBRARY_SUFFIX}
${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}utf8_range${CMAKE_STATIC_LIBRARY_SUFFIX}
)
# Fix for GCC 13 and Clang 16
if(((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "13")) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "16")))
find_program(Patch_EXECUTABLE NAME patch PATHS ENV PATH)
if(NOT Patch_EXECUTABLE)
message(FATAL_ERROR "The patch command is not found. It is required to build Protocol Buffers. Please check your OS documentation and install the patch command.")
endif()
set(PROTOBUF_PATCH_COMMAND
cd ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/src/google/protobuf/ &&
${Patch_EXECUTABLE} ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/src/google/protobuf/port.h < ${GNSSSDR_SOURCE_DIR}/src/tests/data/protobuf22.patch
)
# Patch only once
if(EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/src/google/protobuf/port.h)
set(PROTOBUF_PATCH_COMMAND "")
endif()
else()
set(PROTOBUF_PATCH_COMMAND "")
endif()
ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
PREFIX ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
GIT_PROGRESS ON
UPDATE_COMMAND ""
PATCH_COMMAND ${PROTOBUF_PATCH_COMMAND}
SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
BINARY_DIR ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
CMAKE_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
-DCMAKE_CXX_VISIBILITY_PRESET=hidden
-DCMAKE_VISIBILITY_INLINES_HIDDEN=1
-DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
-Dprotobuf_BUILD_TESTS=OFF
-Dprotobuf_ABSL_PROVIDER=package
${USE_ZLIB}
BUILD_COMMAND ${CMAKE_COMMAND}
"--build" "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}"
"--config" $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
"--target" install
BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf$<$<CONFIG:Debug>:d>${CMAKE_STATIC_LIBRARY_SUFFIX}
${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc
${ABSL_LIBRARIES}
${UTF8_LIBRARIES}
INSTALL_COMMAND ""
)
file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include)
file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library(CoreFoundation CoreFoundation)
else()
set(CoreFoundation "")
endif()
set(PROTOBUF_ABSL_USED_TARGETS
absl::absl_check
absl::absl_log
absl::algorithm
absl::base
absl::bind_front
absl::bits
absl::btree
absl::cleanup
absl::cord
absl::core_headers
absl::debugging
absl::die_if_null
absl::dynamic_annotations
absl::flags
absl::flat_hash_map
absl::flat_hash_set
absl::function_ref
absl::hash
absl::layout
absl::log_initialize
absl::log_severity
absl::memory
absl::node_hash_map
absl::node_hash_set
absl::optional
absl::span
absl::status
absl::statusor
absl::strings
absl::synchronization
absl::time
absl::type_traits
absl::utility
absl::variant
)
if(NOT TARGET protobuf::libprotobuf)
add_library(protobuf::libprotobuf STATIC IMPORTED)
add_dependencies(protobuf::libprotobuf protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
set_target_properties(protobuf::libprotobuf PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_CONFIGURATIONS "None;Debug;Release;RelWithDebInfo;MinSizeRel"
MAP_IMPORTED_CONFIG_NOOPTWITHASM Debug
MAP_IMPORTED_CONFIG_COVERAGE Debug
MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo
MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo
MAP_IMPORTED_CONFIG_ASAN Debug
IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}
IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protobufd${CMAKE_STATIC_LIBRARY_SUFFIX}
IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}
IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}
IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}
INTERFACE_INCLUDE_DIRECTORIES ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include
INTERFACE_LINK_LIBRARIES "${ZLIB_LIBRARIES_};${CoreFoundation};${UTF8_LIBRARIES};${PROTOBUF_ABSL_USED_TARGETS};${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf$<$<CONFIG:Debug>:d>${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
endif()
if(NOT TARGET protobuf::protoc)
add_executable(protobuf::protoc IMPORTED)
add_dependencies(protobuf::protoc protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
unset(Protobuf_PROTOC_EXECUTABLE)
set(PROTOBUF_PROTOC_EXECUTABLE "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc")
set_target_properties(protobuf::protoc PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc
INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protoc$<$<CONFIG:Debug>:d>${CMAKE_STATIC_LIBRARY_SUFFIX}
)
endif()

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
)
[comment]: # (
SPDX-FileCopyrightText: 2011-2022 Carles Fernandez-Prades <carles.fernandez@cttc.es>
SPDX-FileCopyrightText: 2011-2023 Carles Fernandez-Prades <carles.fernandez@cttc.es>
)
<!-- prettier-ignore-end -->
@ -12,7 +12,9 @@ SPDX-FileCopyrightText: 2011-2022 Carles Fernandez-Prades <carles.fernandez@cttc
All notable changes to GNSS-SDR will be documented in this file.
## [Unreleased](https://github.com/gnss-sdr/gnss-sdr/tree/next)
## [GNSS-SDR v0.0.18](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.18) - 2023-04-06
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7805514.svg)](https://doi.org/10.5281/zenodo.7805514)
### Improvements in Accuracy:
@ -30,6 +32,11 @@ All notable changes to GNSS-SDR will be documented in this file.
- Improved non-coherent acquisition when `Acquisition_XX.blocking=false`.
- Implemented processing of BeiDou PRN 34 up to PRN 63 signals.
- Implemented Hamming code correction for Glonass navigation message.
- Now the first iteration of the PVT computation is initialized by the Bancroft
method. This allows to get PVT fixes in some unusual geometries (_e.g._,
GNSS-like signals transmitted by LEO satellites). This initialization is
performed by default. You can opt-out by setting `PVT.bancroft_init=false` in
your configuration file.
### Improvements in Interoperability:
@ -43,9 +50,7 @@ All notable changes to GNSS-SDR will be documented in this file.
[IGS State Space Representation (SSR) Format](https://files.igs.org/pub/data/format/igs_ssr_v1.pdf).
Specifically, it generates messages of type IGM01 (SSR Orbit Correction),
IGM02 (SSR Clock Correction), IGM03 (SSR Combined Orbit and Clock Correction),
and IGM05 (SSR Code Bias). Please note that the content of the HAS messages is
**not** applied to the computed PVT solution. In the Galileo E6B-only
receiver, HAS messages are decoded and reported.
and IGM05 (SSR Code Bias).
- Added a `ZMQ_Signal_Source` for working with streams of samples published via
[ZeroMQ](https://zeromq.org/).
- Fixed register unpacking for Labsat3W files in `Labsat_Signal_Source`. This
@ -87,6 +92,15 @@ All notable changes to GNSS-SDR will be documented in this file.
to CMake deactivates file downloading.
- The `ENABLE_GENERIC_ARCH` building option was removed, simplifying the process
of buiding the software in non-x86 processor architectures.
- If the Protocol Buffers dependency is not found, it is downloaded, built and
statically linked at buiding time. If CMake >= 3.13 and the
[Abseil C++ libraries](https://github.com/abseil/abseil-cpp) >= 20230117 are
installed on your system, Protocol Buffers v22.2 will be used. If those
requirements are not met, Protocol Buffers v21.4 will be used instead
(requires autotools).
- Since Debian 8 "Jessie", which enjoyed Long Term Support until the end of June
2020, is not anymore in the Debian official repositories, we drop its support.
- Fixes for GCC 13 and Clang 16.
### Improvements in Usability:
@ -111,6 +125,8 @@ All notable changes to GNSS-SDR will be documented in this file.
- New configuration parameter `PVT.use_unhealthy_sats`, set by default to
`false`, allows processing observables of satellites that report an unhealthy
status in the navigation message if set to `true`.
- Added the [Geohash](https://en.wikipedia.org/wiki/Geohash) of the PVT solution
in the internal logs.
- Allowed the CMake project to be a sub-project.
See the definitions of concepts and metrics at

View File

@ -2,7 +2,7 @@
.\" SPDX-License-Identifier: GPL-3.0-or-later
.\" SPDX-FileCopyrightText: Carles Fernandez-Prades <carles.fernandez(at)cttc.es>
.\" Contact carles.fernandez@cttc.es to correct errors or typos.
.TH gnss\-sdr 1 "20 Apr 2022" "0.0.17" "gnss\-sdr man page"
.TH gnss\-sdr 1 "6 Apr 2023" "0.0.18" "gnss\-sdr man page"
.SH NAME
\fBgnss\-sdr\fR \- GNSS Software Defined Receiver.
.SH SYNOPSIS

View File

@ -764,6 +764,8 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
const double carrier_phase_error_factor_a = configuration->property(role + ".carrier_phase_error_factor_a", 0.003);
const double carrier_phase_error_factor_b = configuration->property(role + ".carrier_phase_error_factor_b", 0.003);
const bool bancroft_init = configuration->property(role + ".bancroft_init", true);
snrmask_t snrmask = {{}, {{}, {}}};
prcopt_t rtklib_configuration_options = {
@ -822,7 +824,8 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
{{}, {}}, /* odisp[2][6*11] ocean tide loading parameters {rov,base} */
{{}, {{}, {}}, {{}, {}}, {}, {}}, /* exterr_t exterr extended receiver error model */
0, /* disable L2-AR */
{} /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */
{}, /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */
bancroft_init /* enable Bancroft initialization for the first iteration of the PVT computation, useful in some geometries */
};
rtkinit(&rtk, &rtklib_configuration_options);

View File

@ -28,6 +28,7 @@
#include "galileo_has_data.h"
#include "galileo_iono.h"
#include "galileo_utc_model.h"
#include "geohash.h"
#include "geojson_printer.h"
#include "glonass_gnav_almanac.h"
#include "glonass_gnav_ephemeris.h"
@ -124,6 +125,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
gr::io_signature::make(0, 0, 0)),
d_dump_filename(conf_.dump_filename),
d_geohash(std::make_unique<Geohash>()),
d_gps_ephemeris_sptr_type_hash_code(typeid(std::shared_ptr<Gps_Ephemeris>).hash_code()),
d_gps_iono_sptr_type_hash_code(typeid(std::shared_ptr<Gps_Iono>).hash_code()),
d_gps_utc_model_sptr_type_hash_code(typeid(std::shared_ptr<Gps_Utc_Model>).hash_code()),
@ -2432,7 +2434,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
LOG(INFO) << "Position at " << boost::posix_time::to_simple_string(d_user_pvt_solver->get_position_UTC_time())
<< " UTC using " << d_user_pvt_solver->get_num_valid_observations() << " observations is Lat = " << d_user_pvt_solver->get_latitude() << " [deg], Long = " << d_user_pvt_solver->get_longitude()
<< " [deg], Height = " << d_user_pvt_solver->get_height() << " [m]";
LOG(INFO) << "geohash=" << d_geohash->encode(d_user_pvt_solver->get_latitude(), d_user_pvt_solver->get_longitude());
/* std::cout << "Dilution of Precision at " << boost::posix_time::to_simple_string(d_user_pvt_solver->get_position_UTC_time())
<< " UTC using "<< d_user_pvt_solver->get_num_valid_observations() <<" observations is HDOP = " << d_user_pvt_solver->get_hdop() << " VDOP = "
<< d_user_pvt_solver->get_vdop()

View File

@ -50,6 +50,7 @@ class Beidou_Dnav_Ephemeris;
class Galileo_Almanac;
class Galileo_Ephemeris;
class Galileo_HAS_data;
class Geohash;
class GeoJSON_Printer;
class Gps_Almanac;
class Gps_Ephemeris;
@ -204,6 +205,7 @@ private:
std::queue<GnssTime> d_TimeChannelTagTimestamps;
boost::posix_time::time_duration d_utc_diff_time;
std::unique_ptr<Geohash> d_geohash;
size_t d_gps_ephemeris_sptr_type_hash_code;
size_t d_gps_iono_sptr_type_hash_code;

View File

@ -22,6 +22,7 @@ set(PVT_LIB_SOURCES
monitor_pvt_udp_sink.cc
monitor_ephemeris_udp_sink.cc
has_simple_printer.cc
geohash.cc
)
set(PVT_LIB_HEADERS
@ -43,6 +44,7 @@ set(PVT_LIB_HEADERS
serdes_gps_eph.h
monitor_ephemeris_udp_sink.h
has_simple_printer.h
geohash.h
)
list(SORT PVT_LIB_HEADERS)

View File

@ -0,0 +1,194 @@
/*!
* \file geohash.cc
* \brief Implementation of a class for geohash encoding / decoding
* \author Carles Fernandez-Prades, 2023. cfernandez(at)cttc.es
*
*
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#include "geohash.h"
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstddef>
#include <limits>
#include <stdexcept>
#include <utility>
std::string Geohash::encode(double lat, double lon, int precision) const
{
// infer precision?
if (precision == -1)
{
// refine geohash until it matches precision of supplied lat/lon
for (int p = 1; p <= 12; ++p)
{
const auto hash = Geohash::encode(lat, lon, p);
const auto posn = Geohash::decode(hash);
if ((std::fabs(posn[0] - lat) < std::numeric_limits<double>::epsilon()) &&
(std::fabs(posn[1] - lon) < std::numeric_limits<double>::epsilon()))
{
return hash;
}
}
precision = 12; // set to maximum
}
if (std::isnan(lat) || std::isnan(lon) || precision < 1)
{
throw std::invalid_argument("Invalid geohash");
}
int idx = 0; // index into base32 map
int bit = 0; // each char holds 5 bits
bool evenBit = true;
std::string geohash = "";
double latMin = -90.0;
double latMax = 90.0;
double lonMin = -180.0;
double lonMax = 180.0;
while (geohash.length() < static_cast<size_t>(precision))
{
if (evenBit)
{
// bisect E-W longitude
const double lonMid = (lonMin + lonMax) / 2.0;
if (lon >= lonMid)
{
idx = idx * 2 + 1;
lonMin = lonMid;
}
else
{
idx = idx * 2;
lonMax = lonMid;
}
}
else
{
// bisect N-S latitude
const double latMid = (latMin + latMax) / 2.0;
if (lat >= latMid)
{
idx = idx * 2 + 1;
latMin = latMid;
}
else
{
idx = idx * 2;
latMax = latMid;
}
}
evenBit = !evenBit;
if (++bit == 5)
{
// 5 bits gives us a character: append it and start over
geohash += base32[idx];
bit = 0;
idx = 0;
}
}
return geohash;
}
std::array<double, 2> Geohash::decode(std::string geohash) const
{
const auto bounds = Geohash::bounds(std::move(geohash));
const double latMin = bounds[0];
const double lonMin = bounds[1];
const double latMax = bounds[2];
const double lonMax = bounds[3];
// cell centre
double lat = (latMin + latMax) / 2.0;
double lon = (lonMin + lonMax) / 2.0;
// round to close to centre without excessive precision: ⌊2-log10(Δ°)⌋ decimal places
std::array<double, 2> latlon{};
int decimalPlaces = std::floor(2.0 - std::log10(latMax - latMin));
double factor = std::pow(10, decimalPlaces);
latlon[0] = std::round(lat * factor) / factor;
int decimalPlaces2 = std::floor(2.0 - std::log10(lonMax - lonMin));
double factor2 = std::pow(10, decimalPlaces2);
latlon[1] = std::round(lon * factor2) / factor2;
return latlon;
}
std::array<double, 4> Geohash::bounds(std::string geohash) const
{
if (geohash.length() == 0)
{
throw std::runtime_error("Invalid geohash");
}
std::transform(geohash.begin(), geohash.end(), geohash.begin(),
[](unsigned char c) { return std::tolower(c); });
bool evenBit = true;
double latMin = -90.0;
double latMax = 90.0;
double lonMin = -180.0;
double lonMax = 180.0;
for (char chr : geohash)
{
int idx = base32.find(chr);
if (idx == -1)
{
throw std::runtime_error("Invalid geohash");
}
for (int n = 4; n >= 0; n--)
{
int bitN = idx >> n & 1;
if (evenBit)
{
// longitude
double lonMid = (lonMin + lonMax) / 2.0;
if (bitN == 1)
{
lonMin = lonMid;
}
else
{
lonMax = lonMid;
}
}
else
{
// latitude
double latMid = (latMin + latMax) / 2.0;
if (bitN == 1)
{
latMin = latMid;
}
else
{
latMax = latMid;
}
}
evenBit = !evenBit;
}
}
return {latMin, lonMin, latMax, lonMax};
}

View File

@ -0,0 +1,74 @@
/*!
* \file geohash.h
* \brief Interface of a class that encodes / decodes geohashes
* \author Carles Fernandez-Prades, 2023. cfernandez(at)cttc.es
*
*
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GEOHASH_H
#define GNSS_SDR_GEOHASH_H
#include <array>
#include <string>
/** \addtogroup PVT
* \{ */
/** \addtogroup PVT_libs
* \{ */
/*!
* \brief Class for geohash encoding / decoding
* See https://en.wikipedia.org/wiki/Geohash
*/
class Geohash
{
public:
Geohash() = default;
/**
* Encodes latitude/longitude to geohash, either to specified precision or
* to automatically evaluated precision.
*
* @param {double} lat - Latitude in degrees.
* @param {double} lon - Longitude in degrees.
* @param {int} [precision] - Number of characters in resulting geohash.
* @returns {string} Geohash of supplied latitude/longitude.
* @throws Invalid geohash.
*
*/
std::string encode(double lat, double lon, int precision = -1) const;
/**
* Decode geohash to latitude/longitude (location is approximate centre of
* geohash cell, to reasonable precision).
*
* @param {string} geohash - Geohash string to be converted to
* latitude/longitude.
* @returns {lat, lon} (Center of) geohashed location.
* @throws Invalid geohash.
*
*/
std::array<double, 2> decode(std::string geohash) const;
private:
/*
* Returns SW/NE latitude/longitude bounds of specified geohash.
*/
std::array<double, 4> bounds(std::string geohash) const;
std::string base32{"0123456789bcdefghjkmnpqrstuvwxyz"};
};
/** \} */
/** \} */
#endif // GNSS_SDR_GEOHASH_H

View File

@ -55,7 +55,8 @@ public:
inline Serdes_Galileo_Eph& operator=(const Serdes_Galileo_Eph& rhs) noexcept //!< Copy assignment operator
{
this->monitor_ = rhs.monitor_;
Serdes_Galileo_Eph temp(rhs);
std::swap(this->monitor_, temp.monitor_);
return *this;
}
@ -65,10 +66,7 @@ public:
inline Serdes_Galileo_Eph& operator=(Serdes_Galileo_Eph&& other) noexcept //!< Move assignment operator
{
if (this != &other)
{
this->monitor_ = std::move(other.monitor_);
}
std::swap(this->monitor_, other.monitor_);
return *this;
}

View File

@ -54,7 +54,8 @@ public:
inline Serdes_Gps_Eph& operator=(const Serdes_Gps_Eph& rhs) noexcept //!< Copy assignment operator
{
this->monitor_ = rhs.monitor_;
Serdes_Gps_Eph temp(rhs);
std::swap(this->monitor_, temp.monitor_);
return *this;
}
@ -64,10 +65,7 @@ public:
inline Serdes_Gps_Eph& operator=(Serdes_Gps_Eph&& other) noexcept //!< Move assignment operator
{
if (this != &other)
{
this->monitor_ = std::move(other.monitor_);
}
std::swap(this->monitor_, other.monitor_);
return *this;
}

View File

@ -55,12 +55,17 @@ public:
inline Serdes_Monitor_Pvt& operator=(const Serdes_Monitor_Pvt& rhs) noexcept //!< Copy assignment operator
{
this->monitor_ = rhs.monitor_;
if (this != &rhs)
{
this->monitor_.CopyFrom(rhs.monitor_);
}
return *this;
}
inline Serdes_Monitor_Pvt(Serdes_Monitor_Pvt&& other) noexcept : monitor_(std::move(other.monitor_)) //!< Move constructor
{
// Set the other object's monitor_ to a default-constructed state
other.monitor_ = gnss_sdr::MonitorPvt{};
}
inline Serdes_Monitor_Pvt& operator=(Serdes_Monitor_Pvt&& other) noexcept //!< Move assignment operator

View File

@ -69,12 +69,19 @@ target_link_libraries(algorithms_libs_rtklib
PRIVATE
core_system_parameters
algorithms_libs
Armadillo::armadillo
Gflags::gflags
Glog::glog
LAPACK::LAPACK
BLAS::BLAS
)
if(ENABLE_ARMA_NO_DEBUG)
target_compile_definitions(algorithms_libs_rtklib
PRIVATE -DARMA_NO_BOUND_CHECKING=1
)
endif()
if(FILESYSTEM_FOUND)
target_compile_definitions(algorithms_libs_rtklib PUBLIC -DHAS_STD_FILESYSTEM=1)
if(find_experimental)

View File

@ -1000,6 +1000,7 @@ typedef struct
exterr_t exterr; /* extended receiver error model */
int freqopt; /* disable L2-AR */
char pppopt[256]; /* ppp option */
bool bancroft_init; /* enable Bancroft initialization for the first iteration of the PVT computation */
} prcopt_t;

View File

@ -165,16 +165,17 @@ void readionexdcb(FILE *fp, double *dcb, double *rms)
if (strstr(label, "PRN / BIAS / RMS") == label)
{
strncpy(id, buff + 3, 3);
id[3] = '\0';
if (!(sat = satid2no(id)))
int ret = std::snprintf(id, 3, "%s", buff + 3); // NOLINT(runtime/printf)
if (ret >= 0 && ret < 3)
{
trace(2, "ionex invalid satellite: %s\n", id);
continue;
if (!(sat = satid2no(id)))
{
trace(2, "ionex invalid satellite: %s\n", id);
continue;
}
dcb[sat - 1] = str2num(buff, 6, 10);
rms[sat - 1] = str2num(buff, 16, 10);
}
dcb[sat - 1] = str2num(buff, 6, 10);
rms[sat - 1] = str2num(buff, 16, 10);
}
else if (strstr(label, "END OF AUX DATA") == label)
{

View File

@ -22,17 +22,23 @@
* -----------------------------------------------------------------------------
* Copyright (C) 2007-2013, T. Takasu
* Copyright (C) 2017, Javier Arribas
* Copyright (C) 2017, Carles Fernandez
* Copyright (C) 2017-2023, Carles Fernandez
* All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause
* -----------------------------------------------------------------------------
*/
#if ARMA_NO_BOUND_CHECKING
#define ARMA_NO_DEBUG 1
#endif
#include "rtklib_pntpos.h"
#include "rtklib_ephemeris.h"
#include "rtklib_ionex.h"
#include "rtklib_sbas.h"
#include <armadillo>
#include <cmath>
#include <cstring>
#include <vector>
@ -599,6 +605,81 @@ int valsol(const double *azel, const int *vsat, int n,
}
// Lorentz inner product
double lorentz(const arma::vec &x, const arma::vec &y)
{
double p = x(0) * y(0) + x(1) * y(1) + x(2) * y(2) - x(3) * y(3);
return p;
}
// Bancroft method (see https://gssc.esa.int/navipedia/index.php/Bancroft_Method)
// without travel time rotation
arma::vec rough_bancroft(const arma::mat &B_pass)
{
const int m = B_pass.n_rows;
arma::vec pos = arma::zeros<arma::vec>(4);
arma::mat BBB;
bool success;
if (m > 4)
{
success = arma::pinv(BBB, B_pass);
}
else
{
success = arma::inv(BBB, B_pass);
}
if (!success)
{
return pos;
}
const arma::vec e = arma::ones<arma::vec>(m);
arma::vec alpha = arma::zeros<arma::vec>(m);
for (int i = 0; i < m; i++)
{
arma::vec Bi = B_pass.row(i).t();
alpha(i) = lorentz(Bi, Bi) / 2.0;
}
const arma::vec BBBe = BBB * e;
const arma::vec BBBalpha = BBB * alpha;
const double a = lorentz(BBBe, BBBe);
const double b = lorentz(BBBe, BBBalpha) - 1.0;
const double c = lorentz(BBBalpha, BBBalpha);
const double root = std::sqrt(b * b - a * c);
arma::vec r(2);
r(0) = (-b - root) / a;
r(1) = (-b + root) / a;
arma::mat possible_pos = arma::zeros<arma::mat>(4, 2);
for (int i = 0; i < 2; i++)
{
possible_pos.col(i) = r(i) * BBBe + BBBalpha;
possible_pos(3, i) = -possible_pos(3, i);
}
arma::vec abs_omc(2);
for (int j = 0; j < m; j++)
{
for (int i = 0; i < 2; i++)
{
const double c_dt = possible_pos(3, i);
const double calc = arma::norm(B_pass.row(j).head(3).t() - possible_pos.head_rows(3).col(i)) + c_dt;
const double omc = B_pass(j, 3) - calc;
abs_omc(i) = std::abs(omc);
}
}
if (abs_omc(0) > abs_omc(1))
{
pos = possible_pos.col(1);
}
else
{
pos = possible_pos.col(0);
}
return pos;
}
/* estimate receiver position ------------------------------------------------*/
int estpos(const obsd_t *obs, int n, const double *rs, const double *dts,
const double *vare, const int *svh, const nav_t *nav,
@ -632,6 +713,34 @@ int estpos(const obsd_t *obs, int n, const double *rs, const double *dts,
x[i] = sol->rr[i];
}
// Rough first estimation to initialize the algorithm
if (opt->bancroft_init && (std::sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]) < 0.1))
{
arma::mat B = arma::mat(n, 4, arma::fill::zeros);
for (i = 0; i < n; i++)
{
B(i, 0) = rs[0 + i * 6];
B(i, 1) = rs[1 + i * 6];
B(i, 2) = rs[2 + i * 6];
if (obs[i].code[0] != CODE_NONE)
{
B(i, 3) = obs[i].P[0];
}
else if (obs[i].code[1] != CODE_NONE)
{
B(i, 3) = obs[i].P[1];
}
else
{
B(i, 3) = obs[i].P[2];
}
}
arma::vec pos = rough_bancroft(B);
x[0] = pos(0);
x[1] = pos(1);
x[2] = pos(2);
}
for (i = 0; i < MAXITR; i++)
{
/* pseudorange residuals */

View File

@ -123,8 +123,11 @@ int readsp3h(FILE *fp, gtime_t *time, char *type, int *sats,
}
else if (i == 12)
{
strncpy(tsys, buff + 9, 3);
tsys[3] = '\0';
int ret = std::snprintf(tsys, 3, "%s", buff + 9); // NOLINT(runtime/printf)
if (ret < 0 || ret > 3)
{
trace(3, "Error reading sp3 header\n");
}
}
else if (i == 14)
{

View File

@ -2847,11 +2847,13 @@ int readantex(const char *file, pcvs_t *pcvs)
{
strncpy(pcv.type, buff, 20); // MAXANT (64)
pcv.type[20] = '\0';
strncpy(pcv.code, buff + 20, 20); // MAXANT (64)
pcv.code[20] = '\0';
if (!strncmp(pcv.code + 3, " ", 8))
int ret = std::snprintf(pcv.code, 20, "%s", buff + 20); // NOLINT(runtime/printf)
if (ret >= 0 && ret < 20)
{
pcv.sat = satid2no(pcv.code);
if (!strncmp(pcv.code + 3, " ", 8))
{
pcv.sat = satid2no(pcv.code);
}
}
}
else if (strstr(buff + 60, "VALID FROM"))

View File

@ -65,7 +65,7 @@ const prcopt_t PRCOPT_DEFAULT = { /* defaults processing options */
{}, {}, {}, /* baseline, ru, rb */
{"", ""}, /* anttype */
{}, {}, {}, /* antdel, pcv, exsats */
0, 0, 0, {"", ""}, {}, 0, {{}, {}}, {{}, {{}, {}}, {{}, {}}, {}, {}}, 0, {}};
0, 0, 0, {"", ""}, {}, 0, {{}, {}}, {{}, {{}, {}}, {{}, {}}, {}, {}}, 0, {}, true};
void writesolhead(stream_t *stream, const solopt_t *solopt);

View File

@ -795,8 +795,11 @@ void decodetcppath(const char *path, char *addr, char *port, char *user,
}
if (addr)
{
std::strncpy(addr, p, 256);
addr[255] = '\0';
int ret = std::snprintf(addr, 256, "%s", p); // NOLINT(runtime/printf)
if (ret < 0 || ret >= 256)
{
tracet(1, "error reading address");
}
}
}
@ -1077,8 +1080,7 @@ void updatetcpsvr(tcpsvr_t *tcpsvr, char *msg)
{
continue;
}
std::strncpy(saddr, tcpsvr->cli[i].saddr, 256);
saddr[255] = '\0';
std::snprintf(saddr, sizeof(saddr), "%s", tcpsvr->cli[i].saddr);
n++;
}
if (n == 0)
@ -1968,8 +1970,7 @@ void *ftpthread(void *arg)
}
if (fs::exists(tmpfile))
{
std::strncpy(ftp->local, tmpfile.c_str(), 1024);
ftp->local[1023] = '\0';
std::snprintf(ftp->local, 1024, "%s", tmpfile.c_str()); // NOLINT(runtime/printf)
tracet(3, "ftpthread: file exists %s\n", ftp->local);
ftp->state = 2;
return nullptr;
@ -2050,8 +2051,11 @@ void *ftpthread(void *arg)
break;
}
}
std::strncpy(ftp->local, local.c_str(), 1024);
ftp->local[1023] = '\0';
int ret2 = std::snprintf(ftp->local, 1024, "%s", local.c_str()); // NOLINT(runtime/printf)
if (ret2 < 0 || ret2 >= 1024)
{
tracet(3, "Error reading ftp local\n");
}
ftp->state = 2; /* ftp completed */
tracet(3, "ftpthread: complete cmd=%s\n", cmd_str.data());

View File

@ -8,7 +8,7 @@
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 2.8.12...3.25)
cmake_minimum_required(VERSION 2.8.12...3.26)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type: None Debug Release RelWithDebInfo MinSizeRel")
project(volk_gnsssdr)
enable_language(CXX)
@ -206,7 +206,7 @@ message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.")
set(VERSION_INFO_MAJOR_VERSION 0)
set(VERSION_INFO_MINOR_VERSION 0)
set(VERSION_INFO_MAINT_VERSION 17.git)
set(VERSION_INFO_MAINT_VERSION 18)
include(VolkGnsssdrVersion) # setup version info

View File

@ -2,7 +2,7 @@
.\" SPDX-License-Identifier: GPL-3.0-or-later
.\" SPDX-FileCopyrightText: Carles Fernandez-Prades <carles.fernandez(at)cttc.es>
.\" Contact carles.fernandez@cttc.es to correct errors or typos.
.TH volk_gnsssdr\-config\-info 1 "20 Apr 2022" "0.0.17" "volk_gnsssdr\-config\-info man page"
.TH volk_gnsssdr\-config\-info 1 "6 Apr 2023" "0.0.18" "volk_gnsssdr\-config\-info man page"
.SH NAME
\fBvolk_gnsssdr\-config\-info\fR \- Prints configuration information of libvolk_gnsssdr functions.
.SH SYNOPSIS

View File

@ -2,7 +2,7 @@
.\" SPDX-License-Identifier: GPL-3.0-or-later
.\" SPDX-FileCopyrightText: Carles Fernandez-Prades <carles.fernandez(at)cttc.es>
.\" Contact carles.fernandez@cttc.es to correct errors or typos.
.TH volk_gnsssdr_profile 1 "20 Apr 2022" "0.0.17" "volk_gnsssdr_profile man page"
.TH volk_gnsssdr_profile 1 "6 Apr 2023" "0.0.18" "volk_gnsssdr_profile man page"
.SH NAME
\fBvolk_gnsssdr_profile\fR \- Profiler application for libvolk_gnsssdr functions.
.SH SYNOPSIS

View File

@ -85,6 +85,7 @@ macro(add_cpu_features_headers_and_sources HDRS_LIST_NAME SRCS_LIST_NAME)
list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_arm.h)
elseif(PROCESSOR_IS_AARCH64)
list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_aarch64.h)
list(APPEND ${SRCS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/internal/windows_utils.h)
elseif(PROCESSOR_IS_X86)
list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_x86.h)
list(APPEND ${SRCS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/internal/cpuid_x86.h)
@ -185,9 +186,9 @@ if(BUILD_TESTING)
# found.
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) # prefer use of -std11 instead of -gnustd11
set(CMAKE_CXX_EXTENSIONS OFF) # prefer use of -std14 instead of -gnustd14
if(NOT TARGET gtest OR NOT TARGET gmock_main)
# Download and unpack googletest at configure time.

View File

@ -28,7 +28,7 @@
#define CPU_FEATURES_ARCH_ARM
#endif
#if defined(__aarch64__)
#if (defined(__aarch64__) || defined(_M_ARM64))
#define CPU_FEATURES_ARCH_AARCH64
#endif

View File

@ -1,6 +1,100 @@
// SPDX-FileCopyrightText: 2017 Google LLC
// SPDX-License-Identifier: Apache-2.0
////////////////////////////////////////////////////////////////////////////////
// A note on Windows AArch64 implementation
////////////////////////////////////////////////////////////////////////////////
// Getting cpu info via EL1 system registers is not possible, so we delegate it
// to the Windows API (i.e., IsProcessorFeaturePresent and GetNativeSystemInfo).
// The `implementer`, `variant` and `part` fields of the `Aarch64Info` struct
// are not used, so they are set to 0. To get `revision` we use
// `wProcessorRevision` from `SYSTEM_INFO`.
//
// Cryptographic Extension:
// -----------------------------------------------------------------------------
// According to documentation Arm Architecture Reference Manual for
// A-profile architecture. A2.3 The Armv8 Cryptographic Extension. The Armv8.0
// Cryptographic Extension provides instructions for the acceleration of
// encryption and decryption, and includes the following features: FEAT_AES,
// FEAT_PMULL, FEAT_SHA1, FEAT_SHA256.
// see: https://developer.arm.com/documentation/ddi0487/latest
//
// We use `PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE` to detect all Armv8.0 crypto
// features. This value reports all features or nothing, so even if you only
// have support FEAT_AES and FEAT_PMULL, it will still return false.
//
// From Armv8.2, an implementation of the Armv8.0 Cryptographic Extension can
// include either or both of:
//
// • The AES functionality, including support for multiplication of 64-bit
// polynomials. The ID_AA64ISAR0_EL1.AES field indicates whether this
// functionality is supported.
// • The SHA1 and SHA2-256 functionality. The ID_AA64ISAR0_EL1.{SHA2, SHA1}
// fields indicate whether this functionality is supported.
//
// ID_AA64ISAR0_EL1.AES, bits [7:4]:
// Indicates support for AES instructions in AArch64 state. Defined values are:
// - 0b0000 No AES instructions implemented.
// - 0b0001 AESE, AESD, AESMC, and AESIMC instructions implemented.
// - 0b0010 As for 0b0001, plus PMULL/PMULL2 instructions operating on 64-bit
// data quantities.
//
// FEAT_AES implements the functionality identified by the value 0b0001.
// FEAT_PMULL implements the functionality identified by the value 0b0010.
// From Armv8, the permitted values are 0b0000 and 0b0010.
//
// ID_AA64ISAR0_EL1.SHA1, bits [11:8]:
// Indicates support for SHA1 instructions in AArch64 state. Defined values are:
// - 0b0000 No SHA1 instructions implemented.
// - 0b0001 SHA1C, SHA1P, SHA1M, SHA1H, SHA1SU0, and SHA1SU1 instructions
// implemented.
//
// FEAT_SHA1 implements the functionality identified by the value 0b0001.
// From Armv8, the permitted values are 0b0000 and 0b0001.
// If the value of ID_AA64ISAR0_EL1.SHA2 is 0b0000, this field must have the
// value 0b0000.
//
// ID_AA64ISAR0_EL1.SHA2, bits [15:12]:
// Indicates support for SHA2 instructions in AArch64 state. Defined values are:
// - 0b0000 No SHA2 instructions implemented.
// - 0b0001 Implements instructions: SHA256H, SHA256H2, SHA256SU0, and
// SHA256SU1.
// - 0b0010 Implements instructions:
// • SHA256H, SHA256H2, SHA256SU0, and SHA256SU1.
// • SHA512H, SHA512H2, SHA512SU0, and SHA512SU1.
//
// FEAT_SHA256 implements the functionality identified by the value 0b0001.
// FEAT_SHA512 implements the functionality identified by the value 0b0010.
//
// In Armv8, the permitted values are 0b0000 and 0b0001.
// From Armv8.2, the permitted values are 0b0000, 0b0001, and 0b0010.
//
// If the value of ID_AA64ISAR0_EL1.SHA1 is 0b0000, this field must have the
// value 0b0000.
//
// If the value of this field is 0b0010, ID_AA64ISAR0_EL1.SHA3
// must have the value 0b0001.
//
// Other cryptographic features that we cannot detect such as sha512, sha3, sm3,
// sm4, sveaes, svepmull, svesha3, svesm4 we set to 0.
//
// FP/SIMD:
// -----------------------------------------------------------------------------
// FP/SIMD must be implemented on all Armv8.0 implementations, but
// implementations targeting specialized markets may support the following
// combinations:
//
// • No NEON or floating-point.
// • Full floating-point and SIMD support with exception trapping.
// • Full floating-point and SIMD support without exception trapping.
//
// ref:
// https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON
//
// So, we use `PF_ARM_VFP_32_REGISTERS_AVAILABLE`,
// `PF_ARM_NEON_INSTRUCTIONS_AVAILABLE` to detect `asimd` and `fp`
#ifndef CPU_FEATURES_INCLUDE_CPUINFO_AARCH64_H_
#define CPU_FEATURES_INCLUDE_CPUINFO_AARCH64_H_
@ -72,10 +166,11 @@ typedef struct
typedef struct
{
Aarch64Features features;
int implementer;
int variant;
int part;
int revision;
int implementer; // We set 0 for Windows.
int variant; // We set 0 for Windows.
int part; // We set 0 for Windows.
int revision; // We use GetNativeSystemInfo to get processor revision for
// Windows.
} Aarch64Info;
Aarch64Info GetAarch64Info(void);

View File

@ -22,5 +22,37 @@
#define PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38
#endif
#if !defined(PF_ARM_VFP_32_REGISTERS_AVAILABLE)
#define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
#endif
#if !defined(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE)
#define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
#endif
#if !defined(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE)
#define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
#endif
#if !defined(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE)
#define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
#endif
#if !defined(PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE)
#define PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE 34
#endif
#if !defined(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE)
#define PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE 43
#endif
#if !defined(PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE)
#define PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE 44
#endif
#if !defined(PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE)
#define PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE 45
#endif
#endif // CPU_FEATURES_OS_WINDOWS
#endif // CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_

View File

@ -0,0 +1,130 @@
// SPDX-FileCopyrightText: 2023 Google LLC
// SPDX-License-Identifier: Apache-2.0
#include "cpu_features_macros.h"
#ifdef CPU_FEATURES_ARCH_AARCH64
#ifdef CPU_FEATURES_OS_WINDOWS
#include "cpuinfo_aarch64.h"
////////////////////////////////////////////////////////////////////////////////
// Definitions for introspection.
////////////////////////////////////////////////////////////////////////////////
#define INTROSPECTION_TABLE \
LINE(AARCH64_FP, fp, , , ) \
LINE(AARCH64_ASIMD, asimd, , , ) \
LINE(AARCH64_EVTSTRM, evtstrm, , , ) \
LINE(AARCH64_AES, aes, , , ) \
LINE(AARCH64_PMULL, pmull, , , ) \
LINE(AARCH64_SHA1, sha1, , , ) \
LINE(AARCH64_SHA2, sha2, , , ) \
LINE(AARCH64_CRC32, crc32, , , ) \
LINE(AARCH64_ATOMICS, atomics, , , ) \
LINE(AARCH64_FPHP, fphp, , , ) \
LINE(AARCH64_ASIMDHP, asimdhp, , , ) \
LINE(AARCH64_CPUID, cpuid, , , ) \
LINE(AARCH64_ASIMDRDM, asimdrdm, , , ) \
LINE(AARCH64_JSCVT, jscvt, , , ) \
LINE(AARCH64_FCMA, fcma, , , ) \
LINE(AARCH64_LRCPC, lrcpc, , , ) \
LINE(AARCH64_DCPOP, dcpop, , , ) \
LINE(AARCH64_SHA3, sha3, , , ) \
LINE(AARCH64_SM3, sm3, , , ) \
LINE(AARCH64_SM4, sm4, , , ) \
LINE(AARCH64_ASIMDDP, asimddp, , , ) \
LINE(AARCH64_SHA512, sha512, , , ) \
LINE(AARCH64_SVE, sve, , , ) \
LINE(AARCH64_ASIMDFHM, asimdfhm, , , ) \
LINE(AARCH64_DIT, dit, , , ) \
LINE(AARCH64_USCAT, uscat, , , ) \
LINE(AARCH64_ILRCPC, ilrcpc, , , ) \
LINE(AARCH64_FLAGM, flagm, , , ) \
LINE(AARCH64_SSBS, ssbs, , , ) \
LINE(AARCH64_SB, sb, , , ) \
LINE(AARCH64_PACA, paca, , , ) \
LINE(AARCH64_PACG, pacg, , , ) \
LINE(AARCH64_DCPODP, dcpodp, , , ) \
LINE(AARCH64_SVE2, sve2, , , ) \
LINE(AARCH64_SVEAES, sveaes, , , ) \
LINE(AARCH64_SVEPMULL, svepmull, , , ) \
LINE(AARCH64_SVEBITPERM, svebitperm, , , ) \
LINE(AARCH64_SVESHA3, svesha3, , , ) \
LINE(AARCH64_SVESM4, svesm4, , , ) \
LINE(AARCH64_FLAGM2, flagm2, , , ) \
LINE(AARCH64_FRINT, frint, , , ) \
LINE(AARCH64_SVEI8MM, svei8mm, , , ) \
LINE(AARCH64_SVEF32MM, svef32mm, , , ) \
LINE(AARCH64_SVEF64MM, svef64mm, , , ) \
LINE(AARCH64_SVEBF16, svebf16, , , ) \
LINE(AARCH64_I8MM, i8mm, , , ) \
LINE(AARCH64_BF16, bf16, , , ) \
LINE(AARCH64_DGH, dgh, , , ) \
LINE(AARCH64_RNG, rng, , , ) \
LINE(AARCH64_BTI, bti, , , ) \
LINE(AARCH64_MTE, mte, , , ) \
LINE(AARCH64_ECV, ecv, , , ) \
LINE(AARCH64_AFP, afp, , , ) \
LINE(AARCH64_RPRES, rpres, , , )
#define INTROSPECTION_PREFIX Aarch64
#define INTROSPECTION_ENUM_PREFIX AARCH64
#include "define_introspection.inl"
////////////////////////////////////////////////////////////////////////////////
// Implementation.
////////////////////////////////////////////////////////////////////////////////
#include "internal/windows_utils.h"
#include <stdbool.h>
#ifdef CPU_FEATURES_MOCK_CPUID_AARCH64
extern bool GetWindowsIsProcessorFeaturePresent(DWORD);
extern WORD GetWindowsNativeSystemInfoProcessorRevision();
#else // CPU_FEATURES_MOCK_CPUID_AARCH64
static bool
GetWindowsIsProcessorFeaturePresent(DWORD dwProcessorFeature)
{
return IsProcessorFeaturePresent(dwProcessorFeature);
}
static WORD GetWindowsNativeSystemInfoProcessorRevision()
{
SYSTEM_INFO system_info;
GetNativeSystemInfo(&system_info);
return system_info.wProcessorRevision;
}
#endif
static const Aarch64Info kEmptyAarch64Info;
Aarch64Info GetAarch64Info(void)
{
Aarch64Info info = kEmptyAarch64Info;
info.revision = GetWindowsNativeSystemInfoProcessorRevision();
info.features.fp =
GetWindowsIsProcessorFeaturePresent(PF_ARM_VFP_32_REGISTERS_AVAILABLE);
info.features.asimd =
GetWindowsIsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE);
info.features.crc32 = GetWindowsIsProcessorFeaturePresent(
PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE);
info.features.asimddp =
GetWindowsIsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE);
info.features.jscvt = GetWindowsIsProcessorFeaturePresent(
PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE);
info.features.lrcpc = GetWindowsIsProcessorFeaturePresent(
PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE);
info.features.atomics = GetWindowsIsProcessorFeaturePresent(
PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE);
bool is_crypto_available = GetWindowsIsProcessorFeaturePresent(
PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE);
info.features.aes = is_crypto_available;
info.features.sha1 = is_crypto_available;
info.features.sha2 = is_crypto_available;
info.features.pmull = is_crypto_available;
return info;
}
#endif // CPU_FEATURES_OS_WINDOWS
#endif // CPU_FEATURES_ARCH_AARCH64

View File

@ -615,6 +615,8 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info)
// https://en.wikichip.org/wiki/intel/microarchitectures/rocket_lake
return INTEL_RCL;
case CPUID(0x06, 0xB7):
case CPUID(0x06, 0xBA):
case CPUID(0x06, 0xBF):
// https://en.wikichip.org/wiki/intel/microarchitectures/raptor_lake
return INTEL_RPL;
case CPUID(0x06, 0x85):

View File

@ -74,7 +74,11 @@ endif()
##------------------------------------------------------------------------------
## cpuinfo_aarch64_test
if(PROCESSOR_IS_AARCH64)
add_executable(cpuinfo_aarch64_test cpuinfo_aarch64_test.cc ../src/impl_aarch64_linux_or_android.c)
add_executable(cpuinfo_aarch64_test
cpuinfo_aarch64_test.cc
../src/impl_aarch64_linux_or_android.c
../src/impl_aarch64_windows.c)
target_compile_definitions(cpuinfo_aarch64_test PUBLIC CPU_FEATURES_MOCK_CPUID_AARCH64)
target_link_libraries(cpuinfo_aarch64_test all_libraries)
add_test(NAME cpuinfo_aarch64_test COMMAND cpuinfo_aarch64_test)
endif()

View File

@ -5,150 +5,103 @@
#include "filesystem_for_testing.h"
#include "gtest/gtest.h"
#include "hwcaps_for_testing.h"
#include <set>
#if defined(CPU_FEATURES_OS_WINDOWS)
#include "internal/windows_utils.h"
#endif // CPU_FEATURES_OS_WINDOWS
namespace cpu_features
{
namespace
{
#if defined(CPU_FEATURES_OS_DARWIN)
class FakeCpu
class FakeCpuAarch64
{
public:
bool GetDarwinSysCtlByName(std::string name) const
#if defined(CPU_FEATURES_OS_WINDOWS)
bool GetWindowsIsProcessorFeaturePresent(DWORD dwProcessorFeature)
{
return darwin_sysctlbyname_.count(name);
return windows_isprocessorfeaturepresent_.count(dwProcessorFeature);
}
int GetDarwinSysCtlByNameValue(std::string name) const
void SetWindowsIsProcessorFeaturePresent(DWORD dwProcessorFeature)
{
std::map<std::string, int>::const_iterator iter =
darwin_sysctlbynamevalue_.find(name);
if (iter != std::end(darwin_sysctlbynamevalue_))
{
return iter->second;
}
return 0;
windows_isprocessorfeaturepresent_.insert(dwProcessorFeature);
}
void SetDarwinSysCtlByName(std::string name)
WORD GetWindowsNativeSystemInfoProcessorRevision() const
{
darwin_sysctlbyname_.insert(name);
return processor_revision_;
}
void SetDarwinSysCtlByNameValue(std::string name, int value)
void SetWindowsNativeSystemInfoProcessorRevision(WORD wProcessorRevision)
{
darwin_sysctlbynamevalue_[name] = value;
processor_revision_ = wProcessorRevision;
}
private:
std::set<std::string> darwin_sysctlbyname_;
std::map<std::string, int> darwin_sysctlbynamevalue_;
std::set<DWORD> windows_isprocessorfeaturepresent_;
WORD processor_revision_{};
#endif // CPU_FEATURES_OS_WINDOWS
};
FakeCpu* g_fake_cpu = nullptr;
static FakeCpuAarch64* g_fake_cpu_instance = nullptr;
extern "C" bool GetDarwinSysCtlByName(const char* name)
static FakeCpuAarch64& cpu()
{
return g_fake_cpu->GetDarwinSysCtlByName(name);
assert(g_fake_cpu_instance != nullptr);
return *g_fake_cpu_instance;
}
extern "C" int GetDarwinSysCtlByNameValue(const char* name)
#if defined(CPU_FEATURES_OS_WINDOWS)
extern "C" bool GetWindowsIsProcessorFeaturePresent(DWORD dwProcessorFeature)
{
return g_fake_cpu->GetDarwinSysCtlByNameValue(name);
return cpu().GetWindowsIsProcessorFeaturePresent(dwProcessorFeature);
}
class CpuinfoAarch64Test : public ::testing::Test
extern "C" WORD GetWindowsNativeSystemInfoProcessorRevision()
{
return cpu().GetWindowsNativeSystemInfoProcessorRevision();
}
#endif // CPU_FEATURES_OS_WINDOWS
namespace
{
class CpuidAarch64Test : public ::testing::Test
{
protected:
void SetUp() override { g_fake_cpu = new FakeCpu(); }
void TearDown() override { delete g_fake_cpu; }
void SetUp() override
{
assert(g_fake_cpu_instance == nullptr);
g_fake_cpu_instance = new FakeCpuAarch64();
}
void TearDown() override
{
delete g_fake_cpu_instance;
g_fake_cpu_instance = nullptr;
}
};
TEST_F(CpuinfoAarch64Test, FromDarwinSysctlFromName)
{
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.floatingpoint");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.neon");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.neon_hpfp");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.neon_fp16");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.armv8_1_atomics");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.armv8_crc32");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.armv8_2_fhm");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.armv8_2_sha512");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.armv8_2_sha3");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.amx_version");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.ucnormal_mem");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.arm64");
g_fake_cpu->SetDarwinSysCtlByNameValue("hw.cputype", 16777228);
g_fake_cpu->SetDarwinSysCtlByNameValue("hw.cpusubtype", 2);
g_fake_cpu->SetDarwinSysCtlByNameValue("hw.cpu64bit", 1);
g_fake_cpu->SetDarwinSysCtlByNameValue("hw.cpufamily", 458787763);
g_fake_cpu->SetDarwinSysCtlByNameValue("hw.cpusubfamily", 2);
const auto info = GetAarch64Info();
EXPECT_EQ(info.implementer, 0x100000C);
EXPECT_EQ(info.variant, 2);
EXPECT_EQ(info.part, 0x1B588BB3);
EXPECT_EQ(info.revision, 2);
EXPECT_TRUE(info.features.fp);
EXPECT_FALSE(info.features.asimd);
EXPECT_FALSE(info.features.evtstrm);
EXPECT_FALSE(info.features.aes);
EXPECT_FALSE(info.features.pmull);
EXPECT_FALSE(info.features.sha1);
EXPECT_FALSE(info.features.sha2);
EXPECT_TRUE(info.features.crc32);
EXPECT_TRUE(info.features.atomics);
EXPECT_TRUE(info.features.fphp);
EXPECT_FALSE(info.features.asimdhp);
EXPECT_FALSE(info.features.cpuid);
EXPECT_FALSE(info.features.asimdrdm);
EXPECT_FALSE(info.features.jscvt);
EXPECT_FALSE(info.features.fcma);
EXPECT_FALSE(info.features.lrcpc);
EXPECT_FALSE(info.features.dcpop);
EXPECT_TRUE(info.features.sha3);
EXPECT_FALSE(info.features.sm3);
EXPECT_FALSE(info.features.sm4);
EXPECT_FALSE(info.features.asimddp);
EXPECT_TRUE(info.features.sha512);
EXPECT_FALSE(info.features.sve);
EXPECT_TRUE(info.features.asimdfhm);
EXPECT_FALSE(info.features.dit);
EXPECT_FALSE(info.features.uscat);
EXPECT_FALSE(info.features.ilrcpc);
EXPECT_FALSE(info.features.flagm);
EXPECT_FALSE(info.features.ssbs);
EXPECT_FALSE(info.features.sb);
EXPECT_FALSE(info.features.paca);
EXPECT_FALSE(info.features.pacg);
}
#else
void DisableHardwareCapabilities()
{
SetHardwareCapabilities(0, 0);
}
TEST(CpuinfoAarch64Test, Aarch64FeaturesEnum)
{
const char *last_name = GetAarch64FeaturesEnumName(AARCH64_LAST_);
const char* last_name = GetAarch64FeaturesEnumName(AARCH64_LAST_);
EXPECT_STREQ(last_name, "unknown_feature");
for (int i = static_cast<int>(AARCH64_FP); i != static_cast<int>(AARCH64_LAST_); ++i)
for (int i = static_cast<int>(AARCH64_FP);
i != static_cast<int>(AARCH64_LAST_); ++i)
{
const auto feature = static_cast<Aarch64FeaturesEnum>(i);
const char *name = GetAarch64FeaturesEnumName(feature);
const char* name = GetAarch64FeaturesEnumName(feature);
ASSERT_FALSE(name == nullptr);
EXPECT_STRNE(name, "");
EXPECT_STRNE(name, last_name);
}
}
#if defined(CPU_FEATURES_OS_LINUX)
void DisableHardwareCapabilities()
{
SetHardwareCapabilities(0, 0);
}
TEST(CpuinfoAarch64Test, FromHardwareCap)
{
ResetHwcaps();
@ -222,7 +175,7 @@ TEST(CpuinfoAarch64Test, FromHardwareCap2)
TEST(CpuinfoAarch64Test, ARMCortexA53)
{
ResetHwcaps();
auto &fs = GetEmptyFilesystem();
auto& fs = GetEmptyFilesystem();
fs.CreateFile("/proc/cpuinfo",
R"(Processor : AArch64 Processor rev 3 (aarch64)
processor : 0
@ -301,8 +254,33 @@ CPU revision : 3)");
EXPECT_FALSE(info.features.afp);
EXPECT_FALSE(info.features.rpres);
}
#endif // CPU_FEATURES_OS_LINUX
#endif
#if defined(CPU_FEATURES_OS_WINDOWS)
TEST_F(CpuidAarch64Test, WINDOWS_AARCH64_RPI4)
{
cpu().SetWindowsNativeSystemInfoProcessorRevision(0x03);
cpu().SetWindowsIsProcessorFeaturePresent(PF_ARM_VFP_32_REGISTERS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(
PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE);
const auto info = GetAarch64Info();
EXPECT_EQ(info.revision, 0x03);
EXPECT_TRUE(info.features.fp);
EXPECT_TRUE(info.features.asimd);
EXPECT_TRUE(info.features.crc32);
EXPECT_FALSE(info.features.aes);
EXPECT_FALSE(info.features.sha1);
EXPECT_FALSE(info.features.sha2);
EXPECT_FALSE(info.features.pmull);
EXPECT_FALSE(info.features.atomics);
EXPECT_FALSE(info.features.asimddp);
EXPECT_FALSE(info.features.jscvt);
EXPECT_FALSE(info.features.lrcpc);
}
#endif // CPU_FEATURES_OS_WINDOWS
} // namespace
} // namespace cpu_features
} // namespace cpu_features

View File

@ -1708,6 +1708,41 @@ TEST_F(CpuidX86Test, INTEL_HASWELL_LZCNT)
EXPECT_TRUE(info.features.lzcnt);
}
// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00B06A2_RaptorLakeP_03_CPUID.txt
TEST_F(CpuidX86Test, INTEL_RAPTOR_LAKE_P)
{
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000020, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000B06A3, 0x00400800, 0x7FFAFBFF, 0xBFEBFBFF}},
{{0x80000000, 0}, Leaf{0x80000008, 0x00000000, 0x00000000, 0x00000000}},
{{0x80000001, 0}, Leaf{0x00000000, 0x00000000, 0x00000121, 0x2C100000}},
});
const auto info = GetX86Info();
EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL);
EXPECT_EQ(info.family, 0x06);
EXPECT_EQ(info.model, 0xBA);
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_RPL);
}
// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00B06F2_RaptorLakeS_02_CPUID.txt
TEST_F(CpuidX86Test, INTEL_RAPTOR_LAKE_S)
{
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000020, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000B06F2, 0x00800800, 0x7FFAFBFF, 0xBFEBFBFF}},
{{0x80000000, 0}, Leaf{0x80000008, 0x00000000, 0x00000000, 0x00000000}},
{{0x80000001, 0}, Leaf{0x00000000, 0x00000000, 0x00000121, 0x2C100000}},
});
const auto info = GetX86Info();
EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL);
EXPECT_EQ(info.family, 0x06);
EXPECT_EQ(info.model, 0xBF);
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_RPL);
}
// https://github.com/google/cpu_features/issues/200
// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00206F2_Eagleton_CPUID.txt
#if defined(CPU_FEATURES_OS_WINDOWS)

View File

@ -633,11 +633,11 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
{
if (inputsc[0].size == 2)
{
run_cast_test1_s16ic((volk_gnsssdr_fn_1arg_s16ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
run_cast_test1_s16ic((volk_gnsssdr_fn_1arg_s16ic)(manual_func), test_data[i], lv_16sc_t(static_cast<int16_t>(scalar.real()), static_cast<int16_t>(scalar.imag())), vlen, iter, arch_list[i]);
}
else
{
run_cast_test1_s8ic((volk_gnsssdr_fn_1arg_s8ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
run_cast_test1_s8ic((volk_gnsssdr_fn_1arg_s8ic)(manual_func), test_data[i], lv_8sc_t(static_cast<int8_t>(scalar.real()), static_cast<int8_t>(scalar.imag())), vlen, iter, arch_list[i]);
}
}
else
@ -672,16 +672,16 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
{
if (inputsc[0].size == 2)
{
run_cast_test2_s16ic((volk_gnsssdr_fn_2arg_s16ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
run_cast_test2_s16ic((volk_gnsssdr_fn_2arg_s16ic)(manual_func), test_data[i], lv_16sc_t(static_cast<int16_t>(scalar.real()), static_cast<int16_t>(scalar.imag())), vlen, iter, arch_list[i]);
}
else
{
run_cast_test2_s8ic((volk_gnsssdr_fn_2arg_s8ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
run_cast_test2_s8ic((volk_gnsssdr_fn_2arg_s8ic)(manual_func), test_data[i], lv_8sc_t(static_cast<int8_t>(scalar.real()), static_cast<int8_t>(scalar.imag())), vlen, iter, arch_list[i]);
}
}
else
{
run_cast_test2_s8i((volk_gnsssdr_fn_2arg_s8i)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
run_cast_test2_s8i((volk_gnsssdr_fn_2arg_s8i)(manual_func), test_data[i], static_cast<char>(scalar.real()), vlen, iter, arch_list[i]);
}
}
// ADDED BY GNSS-SDR. END
@ -712,11 +712,11 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
{
if (inputsc[0].size == 4)
{
run_cast_test3_s16ic((volk_gnsssdr_fn_3arg_s16ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
run_cast_test3_s16ic((volk_gnsssdr_fn_3arg_s16ic)(manual_func), test_data[i], lv_16sc_t(static_cast<int16_t>(scalar.real()), static_cast<int16_t>(scalar.imag())), vlen, iter, arch_list[i]);
}
else
{
run_cast_test3_s8ic((volk_gnsssdr_fn_3arg_s8ic)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
run_cast_test3_s8ic((volk_gnsssdr_fn_3arg_s8ic)(manual_func), test_data[i], lv_8sc_t(static_cast<int8_t>(scalar.real()), static_cast<int8_t>(scalar.imag())), vlen, iter, arch_list[i]);
}
}
}

View File

@ -42,20 +42,24 @@ ZmqSignalSource::ZmqSignalSource(const ConfigurationInterface* configuration,
if (!endpoint.empty())
{
LOG(INFO) << "Connecting to ZMQ pub at " << endpoint;
// work around gnuradio interface deficiency
// work around gnuradio interface const-deficiency
d_source_block = gr::zeromq::sub_source::make(d_item_size, vlen, const_cast<char*>(endpoint.data()), timeout_ms, pass_tags, hwm);
d_source_block->set_tag_propagation_policy(gr::block::TPP_DONT); // GNSS-SDR doesn't do well with tags/
// work around another bug. GNU Radio passes tags through the ZMQ block
// unconditionally if pass_tags is true, but that flag controls protocol more
// than the intent of the block. Since we have the vector-to-stream block,
// unconditionally create it, and have it squelch the tags. GNSS-SDR should
// not fail if unexpected tags are received
// vector-to-stream should be coherent even if vlen == 1
d_vec_block = gr::blocks::vector_to_stream::make(item_size(), vlen);
d_vec_block->set_tag_propagation_policy(gr::block::TPP_DONT); // GNSS-SDR doesn't do well with tags/
}
else
{
std::cerr << "For ZMQ_Signal_Source " << property << " must be defined" << std::endl;
throw std::invalid_argument(property + ": undefined");
}
if (vlen > 1)
{
d_vec_block = gr::blocks::vector_to_stream::make(item_size(), vlen);
}
}
@ -64,15 +68,13 @@ auto ZmqSignalSource::item_size() -> size_t { return d_item_size; }
auto ZmqSignalSource::connect(gr::top_block_sptr top_block) -> void
{
if (d_vec_block)
{
top_block->connect(d_source_block, 0, d_vec_block, 0);
}
if (d_dump)
{
d_dump_sink = gr::blocks::file_sink::make(item_size(), d_dump_filename.data());
top_block->connect(get_right_block(), 0, d_dump_sink, 0);
}
top_block->connect(d_source_block, 0, d_vec_block, 0);
}
@ -83,25 +85,13 @@ auto ZmqSignalSource::disconnect(gr::top_block_sptr top_block) -> void
top_block->disconnect(d_dump_sink);
}
if (d_vec_block)
{
top_block->disconnect(d_vec_block);
}
// this might be redundant
top_block->disconnect(d_vec_block);
top_block->disconnect(d_source_block);
}
auto ZmqSignalSource::get_right_block() -> gr::basic_block_sptr
{
auto result = gr::basic_block_sptr();
if (d_vec_block)
{
result = d_vec_block;
}
else
{
result = d_source_block;
}
return result;
return d_vec_block;
}

View File

@ -50,27 +50,31 @@ public:
// google::protobuf::ShutdownProtobufLibrary();
}
inline Serdes_Nav_Message(const Serdes_Nav_Message& other) noexcept //!< Copy constructor
inline Serdes_Nav_Message(const Serdes_Nav_Message& other) noexcept : navmsg_(other.navmsg_) //!< Copy constructor
{
this->navmsg_ = other.navmsg_;
}
inline Serdes_Nav_Message& operator=(const Serdes_Nav_Message& rhs) noexcept //!< Copy assignment operator
{
this->navmsg_ = rhs.navmsg_;
if (this != &rhs)
{
this->navmsg_.CopyFrom(rhs.navmsg_);
}
return *this;
}
inline Serdes_Nav_Message(Serdes_Nav_Message&& other) noexcept //!< Move constructor
inline Serdes_Nav_Message(Serdes_Nav_Message&& other) noexcept : navmsg_(std::move(other.navmsg_)) //!< Move constructor
{
this->navmsg_ = std::move(other.navmsg_);
// Set the other object's navmsg_ to a default-constructed state
other.navmsg_ = gnss_sdr::navMsg{};
}
inline Serdes_Nav_Message& operator=(Serdes_Nav_Message&& other) noexcept //!< Move assignment operator
{
if (this != &other)
{
this->navmsg_ = std::move(other.navmsg_);
navmsg_ = std::move(other.navmsg_);
other.navmsg_ = gnss_sdr::navMsg{};
}
return *this;
}

View File

@ -12,7 +12,7 @@ static int ephemE_17_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb,
void *app_key)
{
unsigned long value;
// unsigned long value;
if (!sptr)
{
@ -21,7 +21,7 @@ static int ephemE_17_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
return -1;
}
value = *(const unsigned long *)sptr;
// value = *(const unsigned long *)sptr;
/* Constraint check succeeded */
return 0;
@ -132,7 +132,7 @@ static int ephemAPowerHalf_19_constraint(asn_TYPE_descriptor_t *td,
asn_app_constraint_failed_f *ctfailcb,
void *app_key)
{
unsigned long value;
// unsigned long value;
if (!sptr)
{
@ -141,7 +141,7 @@ static int ephemAPowerHalf_19_constraint(asn_TYPE_descriptor_t *td,
return -1;
}
value = *(const unsigned long *)sptr;
// value = *(const unsigned long *)sptr;
/* Constraint check succeeded */
return 0;
@ -647,7 +647,7 @@ static int memb_ephemE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb,
void *app_key)
{
unsigned long value;
// unsigned long value;
if (!sptr)
{
@ -656,7 +656,7 @@ static int memb_ephemE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
return -1;
}
value = *(const unsigned long *)sptr;
// value = *(const unsigned long *)sptr;
/* Constraint check succeeded */
return 0;
@ -695,7 +695,7 @@ static int memb_ephemAPowerHalf_constraint_1(
asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key)
{
unsigned long value;
// unsigned long value;
if (!sptr)
{
@ -704,7 +704,7 @@ static int memb_ephemAPowerHalf_constraint_1(
return -1;
}
value = *(const unsigned long *)sptr;
// value = *(const unsigned long *)sptr;
/* Constraint check succeeded */
return 0;

View File

@ -22,6 +22,8 @@
#include <cstddef>
#include <cstdint>
#include <string>
#include <unordered_map>
#include <utility>
/** \addtogroup Core
@ -116,6 +118,63 @@ const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_RESERVED({19, 4});
const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_MASK_ID({23, 5});
const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_IOD_SET_ID({28, 5});
// HAS SIS ICD v1.0 Table 20
const std::unordered_map<uint8_t, std::unordered_map<uint8_t, std::string>> HAS_SIGNAL_INDEX_TABLE = {
{0, {
{0, "L1 C/A"},
{1, "Reserved"},
{2, "Reserved"},
{3, "L1C(D)"},
{4, "L1C(P)"},
{5, "L1C(D+P)"},
{6, "L2 CM"},
{7, "L2 CL"},
{8, "L2 CM+CL"},
{9, "L2 P"},
{10, "Reserved"},
{11, "L5 I"},
{12, "L5 Q"},
{13, "L5 I + L5 Q"},
{14, "Reserved"},
{15, "Reserved"},
}},
{2, {
{0, "E1-B I/NAV OS"},
{1, "E1-C"},
{2, "E1-B + E1-C"},
{3, "E5a-I F/NAV OS"},
{4, "E5a-Q"},
{5, "E5a-I+E5a-Q"},
{6, "E5b-I I/NAV OS"},
{7, "E5b-Q"},
{8, "E5b-I+E5b-Q"},
{9, "E5-I"},
{10, "E5-Q"},
{11, "E5-I + E5-Q"},
{12, "E6-B C/NAV HAS"},
{13, "E6-C"},
{14, "E6-B + E6-C"},
{15, "Reserved"},
}}};
// HAS SIS ICD v1.0 Table 23
const std::unordered_map<uint8_t, uint16_t> HAS_VALIDITY_INTERVALS = {
{0, 5},
{1, 10},
{2, 15},
{3, 20},
{4, 30},
{5, 60},
{6, 90},
{7, 120},
{8, 180},
{9, 240},
{10, 300},
{11, 600},
{12, 900},
{13, 1800},
{14, 3600}};
/** \} */
/** \} */

View File

@ -19,10 +19,9 @@
#include <algorithm>
#include <bitset>
#include <iterator>
#include <map>
#include <numeric>
#include <sstream>
#include <unordered_map>
#include <stdexcept>
#include <utility>
@ -32,44 +31,6 @@ std::vector<std::string> Galileo_HAS_data::get_signals_in_mask(uint8_t nsys) con
{
return {};
}
// See HAS SIS ICD v1.0 Table 20
std::unordered_map<uint8_t, std::unordered_map<uint8_t, std::string>> signal_index_table = {
{0, {
{0, "L1 C/A"},
{1, "Reserved"},
{2, "Reserved"},
{3, "L1C(D)"},
{4, "L1C(P)"},
{5, "L1C(D+P)"},
{6, "L2 CM"},
{7, "L2 CL"},
{8, "L2 CM+CL"},
{9, "L2 P"},
{10, "Reserved"},
{11, "L5 I"},
{12, "L5 Q"},
{13, "L5 I + L5 Q"},
{14, "Reserved"},
{15, "Reserved"},
}},
{2, {
{0, "E1-B I/NAV OS"},
{1, "E1-C"},
{2, "E1-B + E1-C"},
{3, "E5a-I F/NAV OS"},
{4, "E5a-Q"},
{5, "E5a-I+E5a-Q"},
{6, "E5b-I I/NAV OS"},
{7, "E5b-Q"},
{8, "E5b-I+E5b-Q"},
{9, "E5-I"},
{10, "E5-Q"},
{11, "E5-I + E5-Q"},
{12, "E6-B C/NAV HAS"},
{13, "E6-C"},
{14, "E6-B + E6-C"},
{15, "Reserved"},
}}};
std::vector<std::string> signals_in_mask;
uint16_t sig = signal_mask[nsys];
@ -80,14 +41,14 @@ std::vector<std::string> Galileo_HAS_data::get_signals_in_mask(uint8_t nsys) con
{
if ((bits[HAS_MSG_NUMBER_SIGNAL_MASKS - k - 1]))
{
if (signal_index_table[system].count(k) == 0)
try
{
signals_in_mask.emplace_back(HAS_SIGNAL_INDEX_TABLE.at(system).at(k));
}
catch (const std::out_of_range& e)
{
signals_in_mask.emplace_back("Unknown");
}
else
{
signals_in_mask.push_back(signal_index_table[system][k]);
}
}
}
return signals_in_mask;
@ -923,26 +884,8 @@ uint16_t Galileo_HAS_data::get_nsat_sub() const
uint16_t Galileo_HAS_data::get_validity_interval_s(uint8_t validity_interval_index) const
{
// See HAS SIS ICD v1.0 Table 23
const std::map<uint8_t, uint16_t> validity_intervals = {
{0, 5},
{1, 10},
{2, 15},
{3, 20},
{4, 30},
{5, 60},
{6, 90},
{7, 120},
{8, 180},
{9, 240},
{10, 300},
{11, 600},
{12, 900},
{13, 1800},
{14, 3600}};
auto it = validity_intervals.find(validity_interval_index);
if (it == validity_intervals.end())
const auto it = HAS_VALIDITY_INTERVALS.find(validity_interval_index);
if (it == HAS_VALIDITY_INTERVALS.cend())
{
return 0;
}

View File

@ -30,10 +30,10 @@ Gnss_Satellite::Gnss_Satellite(const std::string& system_, uint32_t PRN_)
void Gnss_Satellite::reset()
{
system = std::string("");
block = std::string("");
PRN = 0;
rf_link = 0;
this->system.clear();
this->block.clear();
this->PRN = 0;
this->rf_link = 0;
}
@ -73,13 +73,16 @@ bool operator==(const Gnss_Satellite& sat1, const Gnss_Satellite& sat2)
// Copy constructor
Gnss_Satellite::Gnss_Satellite(const Gnss_Satellite& other) noexcept
: system(other.system),
block(other.block),
PRN(other.PRN),
rf_link(other.rf_link)
{
*this = other;
}
// Copy assignment operator
Gnss_Satellite& Gnss_Satellite::operator=(const Gnss_Satellite& rhs)
Gnss_Satellite& Gnss_Satellite::operator=(const Gnss_Satellite& rhs) noexcept
{
// Only do assignment if RHS is a different object from this.
if (this != &rhs)
@ -95,8 +98,15 @@ Gnss_Satellite& Gnss_Satellite::operator=(const Gnss_Satellite& rhs)
// Move constructor
Gnss_Satellite::Gnss_Satellite(Gnss_Satellite&& other) noexcept
: system(std::move(other.system)),
block(std::move(other.block)),
PRN(other.PRN),
rf_link(other.rf_link)
{
*this = std::move(other);
other.system.clear();
other.block.clear();
other.PRN = 0;
other.rf_link = 0;
}
@ -105,10 +115,14 @@ Gnss_Satellite& Gnss_Satellite::operator=(Gnss_Satellite&& other) noexcept
{
if (this != &other)
{
this->system = other.get_system();
this->block = other.get_block();
this->PRN = other.get_PRN();
this->rf_link = other.get_rf_link();
system = std::move(other.system);
block = std::move(other.block);
PRN = other.PRN;
rf_link = other.rf_link;
other.system.clear();
other.block.clear();
other.PRN = 0;
other.rf_link = 0;
}
return *this;
}
@ -613,7 +627,7 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_
block_ = std::string("FOC-FM19"); // Galileo Full Operational Capability (FOC) satellite FM19 / GSAT0219, launched on Jul. 25, 2018. UNDER COMMISSIONING.
break;
default:
block_ = std::string("Unknown(Simulated)");
block_ = std::string("Unknown");
}
}
if (system_ == "Beidou")
@ -760,7 +774,7 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_
block_ = std::string("BeiDou-3 GEOG3"); // launched 2020/06/2023
break;
default:
block_ = std::string("Unknown(Simulated)");
block_ = std::string("Unknown");
}
}
return block_;

View File

@ -44,7 +44,7 @@ public:
~Gnss_Satellite() = default; //!< Default Destructor.
Gnss_Satellite(const Gnss_Satellite& other) noexcept; //!< Copy constructor
Gnss_Satellite& operator=(const Gnss_Satellite&); //!< Copy assignment operator
Gnss_Satellite& operator=(const Gnss_Satellite&) noexcept; //!< Copy assignment operator
Gnss_Satellite(Gnss_Satellite&& other) noexcept; //!< Move constructor
Gnss_Satellite& operator=(Gnss_Satellite&& other) noexcept; //!< Move assignment operator

View File

@ -81,10 +81,7 @@ public:
bool Flag_PLL_180_deg_phase_locked{}; //!< Set by Telemetry Decoder processing block
/// Copy constructor
Gnss_Synchro(const Gnss_Synchro& other) noexcept
{
*this = other;
};
Gnss_Synchro(const Gnss_Synchro& other) noexcept = default;
/// Copy assignment operator
Gnss_Synchro& operator=(const Gnss_Synchro& rhs) noexcept
@ -125,10 +122,7 @@ public:
};
/// Move constructor
Gnss_Synchro(Gnss_Synchro&& other) noexcept
{
*this = std::move(other);
};
Gnss_Synchro(Gnss_Synchro&& other) noexcept = default;
/// Move assignment operator
Gnss_Synchro& operator=(Gnss_Synchro&& other) noexcept
@ -163,6 +157,36 @@ public:
this->Flag_valid_word = other.Flag_valid_word;
this->Flag_valid_pseudorange = other.Flag_valid_pseudorange;
this->Flag_PLL_180_deg_phase_locked = other.Flag_PLL_180_deg_phase_locked;
// Leave the source object in a valid but unspecified state
other.Signal[0] = '\0';
other.Signal[1] = '\0';
other.Signal[2] = '\0';
other.System = 0;
other.PRN = 0;
other.Channel_ID = 0;
other.Acq_delay_samples = 0.0;
other.Acq_doppler_hz = 0.0;
other.Acq_samplestamp_samples = 0;
other.Acq_doppler_step = 0;
other.fs = 0;
other.Prompt_I = 0.0;
other.Prompt_Q = 0.0;
other.CN0_dB_hz = 0.0;
other.Carrier_Doppler_hz = 0.0;
other.Carrier_phase_rads = 0.0;
other.Code_phase_samples = 0.0;
other.Tracking_sample_counter = 0;
other.correlation_length_ms = 0;
other.TOW_at_current_symbol_ms = 0;
other.Pseudorange_m = 0.0;
other.RX_time = 0.0;
other.interp_TOW_ms = 0.0;
other.Flag_valid_acquisition = false;
other.Flag_valid_symbol_output = false;
other.Flag_valid_word = false;
other.Flag_valid_pseudorange = false;
other.Flag_PLL_180_deg_phase_locked = false;
}
return *this;
};

View File

@ -18,7 +18,7 @@
*/
#ifndef GNSS_SDR_VERSION
#define GNSS_SDR_VERSION "0.0.17"
#define GNSS_SDR_VERSION "0.0.18"
#endif
#ifndef GOOGLE_STRIP_LOG

View File

@ -471,8 +471,8 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)
endif()
endif()
if(NOT ENABLE_PACKAGING OR NOT ENABLE_UNIT_TESTING_MINIMAL)
message(STATUS "Downloading some data files for testing...")
if(NOT (ENABLE_PACKAGING OR ENABLE_UNIT_TESTING_MINIMAL))
message(STATUS "Downloading some data files for testing ...")
if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat)
message(STATUS "Downloading file: Galileo_E1_ID_1_Fs_4Msps_8ms.dat")
file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/Galileo_E1_ID_1_Fs_4Msps_8ms.dat
@ -510,7 +510,7 @@ endif()
if(ENABLE_UNIT_TESTING_EXTRA)
add_definitions(-DEXTRA_TESTS)
message(STATUS "Downloading some extra data files for testing...")
message(STATUS "Downloading some extra data files for testing ...")
if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat)
message(STATUS "Downloading file: gps_l2c_m_prn7_5msps.dat")
file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/gps_l2c_m_prn7_5msps.dat

View File

@ -0,0 +1,12 @@
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-FileCopyrightText: 2023 Carles Fernandez-Prades <carles.fernandez@cttc.es>
--- port.h 2023-03-31 11:40:38.000000000 +0100
+++ port.h 2023-03-31 11:56:49.000000000 +0100
@@ -38,6 +38,7 @@
#include <cassert>
#include <cstddef>
+#include <cstdint>
#include <new>
#include <string>
#include <type_traits>

View File

@ -72,6 +72,7 @@ DECLARE_string(log_dir);
#include "unit-tests/signal-processing-blocks/adapter/adapter_test.cc"
#include "unit-tests/signal-processing-blocks/adapter/pass_through_test.cc"
#include "unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc"
#include "unit-tests/signal-processing-blocks/pvt/geohash_test.cc"
#include "unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc"
#include "unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc"
#include "unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc"

View File

@ -72,7 +72,6 @@ private:
public:
int rx_message{0};
~GpsL1CaPcpsAcquisitionTest_msg_rx() override; //!< Default destructor
};
@ -115,9 +114,6 @@ GpsL1CaPcpsAcquisitionTest_msg_rx::GpsL1CaPcpsAcquisitionTest_msg_rx()
}
GpsL1CaPcpsAcquisitionTest_msg_rx::~GpsL1CaPcpsAcquisitionTest_msg_rx() = default;
// ###########################################################
class GpsL1CaPcpsAcquisitionTest : public ::testing::Test
@ -131,8 +127,6 @@ protected:
gnss_synchro = Gnss_Synchro();
}
~GpsL1CaPcpsAcquisitionTest() override = default;
void init();
void plot_grid() const;

View File

@ -38,7 +38,6 @@ class DataTypeAdapter : public ::testing::Test
{
public:
DataTypeAdapter();
~DataTypeAdapter() override;
int run_byte_to_short_block() const;
int run_ibyte_to_cbyte_block() const;
int run_ibyte_to_complex_block() const;
@ -67,9 +66,6 @@ DataTypeAdapter::DataTypeAdapter()
}
DataTypeAdapter::~DataTypeAdapter() = default;
int DataTypeAdapter::run_ishort_to_cshort_block() const
{
std::shared_ptr<ConfigurationInterface> config = std::make_shared<InMemoryConfiguration>();

View File

@ -44,23 +44,24 @@ DEFINE_int32(filter_test_nsamples, 1000000, "Number of samples to filter in the
class FirFilterTest : public ::testing::Test
{
protected:
FirFilterTest() : item_size(sizeof(gr_complex))
FirFilterTest() : item_size(sizeof(gr_complex)),
nsamples(FLAGS_filter_test_nsamples)
{
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
config = std::make_shared<InMemoryConfiguration>();
}
~FirFilterTest() override = default;
void init();
void configure_cbyte_cbyte();
void configure_cbyte_gr_complex();
void configure_gr_complex_gr_complex();
void configure_cshort_cshort();
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
gr::top_block_sptr top_block;
std::shared_ptr<InMemoryConfiguration> config;
size_t item_size;
int nsamples = FLAGS_filter_test_nsamples;
int nsamples;
};

View File

@ -43,28 +43,28 @@ DEFINE_int32(notch_filter_lite_test_nsamples, 1000000, "Number of samples to fil
class NotchFilterLiteTest : public ::testing::Test
{
protected:
NotchFilterLiteTest() : item_size(sizeof(gr_complex)), nsamples(FLAGS_notch_filter_lite_test_nsamples)
NotchFilterLiteTest() : item_size(sizeof(gr_complex)),
nsamples(FLAGS_notch_filter_lite_test_nsamples)
{
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
config = std::make_shared<InMemoryConfiguration>();
}
~NotchFilterLiteTest() override = default;
bool stop = false;
std::thread ch_thread;
void start_queue();
void wait_message();
void process_message();
void stop_queue();
pmt::pmt_t message;
void init();
void configure_gr_complex_gr_complex();
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
gr::top_block_sptr top_block;
std::shared_ptr<InMemoryConfiguration> config;
pmt::pmt_t message;
std::thread ch_thread;
size_t item_size;
int nsamples;
bool stop{false};
};

View File

@ -43,28 +43,28 @@ DEFINE_int32(notch_filter_test_nsamples, 1000000, "Number of samples to filter i
class NotchFilterTest : public ::testing::Test
{
protected:
NotchFilterTest() : item_size(sizeof(gr_complex)), nsamples(FLAGS_notch_filter_test_nsamples)
NotchFilterTest() : item_size(sizeof(gr_complex)),
nsamples(FLAGS_notch_filter_test_nsamples)
{
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
config = std::make_shared<InMemoryConfiguration>();
}
~NotchFilterTest() override = default;
bool stop = false;
std::thread ch_thread;
void start_queue();
void wait_message();
void process_message();
void stop_queue();
pmt::pmt_t message;
void init();
void configure_gr_complex_gr_complex();
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
gr::top_block_sptr top_block;
std::shared_ptr<InMemoryConfiguration> config;
std::thread ch_thread;
pmt::pmt_t message;
size_t item_size;
int nsamples;
bool stop{false};
};

View File

@ -43,26 +43,28 @@ DEFINE_int32(pb_filter_test_nsamples, 1000000, "Number of samples to filter in t
class PulseBlankingFilterTest : public ::testing::Test
{
protected:
PulseBlankingFilterTest() : item_size(sizeof(gr_complex)), nsamples(FLAGS_pb_filter_test_nsamples)
PulseBlankingFilterTest() : item_size(sizeof(gr_complex)),
nsamples(FLAGS_pb_filter_test_nsamples)
{
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
config = std::make_shared<InMemoryConfiguration>();
}
~PulseBlankingFilterTest() override = default;
bool stop = false;
std::thread ch_thread;
void start_queue();
void wait_message();
void process_message();
void stop_queue();
void init();
void configure_gr_complex_gr_complex();
std::thread ch_thread;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
gr::top_block_sptr top_block;
std::shared_ptr<InMemoryConfiguration> config;
gr::top_block_sptr top_block;
pmt::pmt_t message;
size_t item_size;
int nsamples;
pmt::pmt_t message;
bool stop{false};
};

View File

@ -18,6 +18,7 @@
#include "acquisition_dump_reader.h"
#include <matio.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <utility>
@ -27,13 +28,13 @@ bool Acquisition_Dump_Reader::read_binary_acq()
mat_t* matfile = Mat_Open(d_dump_filename.c_str(), MAT_ACC_RDONLY);
if (matfile == nullptr)
{
std::cout << "¡¡¡Unreachable Acquisition dump file!!!\n";
std::cout << "Unreachable Acquisition dump file " << d_dump_filename << '\n';
return false;
}
matvar_t* var_ = Mat_VarRead(matfile, "acq_grid");
if (var_ == nullptr)
{
std::cout << "¡¡¡Unreachable grid variable into Acquisition dump file!!!\n";
std::cout << "Unreachable grid variable in Acquisition dump file.\n";
Mat_Close(matfile);
return false;
}
@ -162,7 +163,7 @@ Acquisition_Dump_Reader::Acquisition_Dump_Reader(const std::string& basename,
}
else
{
std::cout << "¡¡¡Unreachable Acquisition dump file!!!\n";
std::cout << "Unreachable Acquisition dump file " << d_dump_filename << '\n';
}
acq_doppler_hz = 0.0;
acq_delay_samples = 0.0;
@ -220,20 +221,31 @@ Acquisition_Dump_Reader::Acquisition_Dump_Reader(const std::string& basename,
}
}
// Copy constructor
Acquisition_Dump_Reader::Acquisition_Dump_Reader(const Acquisition_Dump_Reader& other) noexcept
{
*this = other;
}
// Copy assignment operator
Acquisition_Dump_Reader& Acquisition_Dump_Reader::operator=(const Acquisition_Dump_Reader& rhs)
Acquisition_Dump_Reader& Acquisition_Dump_Reader::operator=(const Acquisition_Dump_Reader& other)
{
// Only do assignment if RHS is a different object from this.
if (this != &rhs)
if (this != &other)
{
*this = rhs;
doppler = other.doppler;
samples = other.samples;
mag = other.mag;
acq_doppler_hz = other.acq_doppler_hz;
acq_delay_samples = other.acq_delay_samples;
test_statistic = other.test_statistic;
input_power = other.input_power;
threshold = other.threshold;
positive_acq = other.positive_acq;
PRN = other.PRN;
num_dwells = other.num_dwells;
sample_counter = other.sample_counter;
d_basename = other.d_basename;
d_dump_filename = other.d_dump_filename;
d_sat = other.d_sat;
d_doppler_max = other.d_doppler_max;
d_doppler_step = other.d_doppler_step;
d_samples_per_code = other.d_samples_per_code;
d_num_doppler_bins = other.d_num_doppler_bins;
}
return *this;
}
@ -241,17 +253,54 @@ Acquisition_Dump_Reader& Acquisition_Dump_Reader::operator=(const Acquisition_Du
// Move constructor
Acquisition_Dump_Reader::Acquisition_Dump_Reader(Acquisition_Dump_Reader&& other) noexcept
: doppler(std::move(other.doppler)),
samples(std::move(other.samples)),
mag(std::move(other.mag)),
acq_doppler_hz(other.acq_doppler_hz),
acq_delay_samples(other.acq_delay_samples),
test_statistic(other.test_statistic),
input_power(other.input_power),
threshold(other.threshold),
positive_acq(other.positive_acq),
PRN(other.PRN),
num_dwells(other.num_dwells),
sample_counter(other.sample_counter),
d_basename(std::move(other.d_basename)),
d_dump_filename(std::move(other.d_dump_filename)),
d_sat(other.d_sat),
d_doppler_max(other.d_doppler_max),
d_doppler_step(other.d_doppler_step),
d_samples_per_code(other.d_samples_per_code),
d_num_doppler_bins(other.d_num_doppler_bins)
{
*this = std::move(other);
}
// Move assignment operator
Acquisition_Dump_Reader& Acquisition_Dump_Reader::operator=(Acquisition_Dump_Reader&& other) noexcept
{
if (this != &other)
if (this != &other) // Check for self-assignment
{
*this = other;
// Move member variables from the other object to this object
d_basename = std::move(other.d_basename);
d_dump_filename = std::move(other.d_dump_filename);
d_sat = other.d_sat;
d_doppler_max = other.d_doppler_max;
d_doppler_step = other.d_doppler_step;
d_samples_per_code = other.d_samples_per_code;
d_num_doppler_bins = other.d_num_doppler_bins;
doppler = std::move(other.doppler);
samples = std::move(other.samples);
mag = std::move(other.mag);
acq_doppler_hz = other.acq_doppler_hz;
acq_delay_samples = other.acq_delay_samples;
test_statistic = other.test_statistic;
input_power = other.input_power;
threshold = other.threshold;
positive_acq = other.positive_acq;
PRN = other.PRN;
num_dwells = other.num_dwells;
sample_counter = other.sample_counter;
}
return *this;
}
}

View File

@ -37,10 +37,8 @@ public:
int channel = 0,
int execution = 1);
~Acquisition_Dump_Reader() = default;
Acquisition_Dump_Reader(const Acquisition_Dump_Reader& other) noexcept; //!< Copy constructor
Acquisition_Dump_Reader& operator=(const Acquisition_Dump_Reader&); //!< Copy assignment operator
Acquisition_Dump_Reader(const Acquisition_Dump_Reader& other) = default; //!< Copy constructor
Acquisition_Dump_Reader& operator=(const Acquisition_Dump_Reader& other); //!< Copy assignment operator
Acquisition_Dump_Reader(Acquisition_Dump_Reader&& other) noexcept; //!< Move constructor
Acquisition_Dump_Reader& operator=(Acquisition_Dump_Reader&& other) noexcept; //!< Move assignment operator
@ -61,12 +59,12 @@ public:
private:
std::string d_basename;
std::string d_dump_filename;
unsigned int d_sat{};
unsigned int d_doppler_max{};
unsigned int d_doppler_step{};
unsigned int d_samples_per_code{};
unsigned int d_num_doppler_bins{};
std::string d_dump_filename;
};
#endif // GNSS_SDR_ACQUISITION_DUMP_READER_H

View File

@ -0,0 +1,55 @@
/*!
* \file geohash_test.cc
* \brief Implements Unit Tests for the Geohash class.
* \author Carles Fernandez-Prades, 2023. cfernandez(at)cttc.es
*
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#include "geohash.h"
TEST(Geohash_Test, Encode)
{
Geohash gh = Geohash();
std::string geohash;
EXPECT_NO_THROW(geohash = gh.encode(52.205, 0.119, 7));
EXPECT_EQ(0, geohash.compare("u120fxw"));
EXPECT_NO_THROW(geohash = gh.encode(41.274966141209, 1.987518053501));
EXPECT_EQ(0, geohash.compare("sp36v1zk0e2g"));
EXPECT_THROW(gh.encode(52.205, 0.119, 0), std::invalid_argument);
}
TEST(Geohash_Test, Decode)
{
Geohash gh = Geohash();
auto latlon = gh.decode("sp36v1zk0e2g");
EXPECT_NEAR(41.274966141209, latlon[0], 1e-8);
EXPECT_NEAR(1.987518053501, latlon[1], 1e-8);
EXPECT_THROW(gh.decode(""), std::runtime_error);
latlon = gh.decode("w21zd2mkt");
EXPECT_NEAR(1.320527, latlon[0], 1e-8);
EXPECT_NEAR(103.81726, latlon[1], 1e-8);
latlon = gh.decode("W21ZD2MKT");
EXPECT_NEAR(1.320527, latlon[0], 1e-8);
EXPECT_NEAR(103.81726, latlon[1], 1e-8);
}
TEST(Geohash_Test, Precision)
{
Geohash gh = Geohash();
std::string hash;
EXPECT_NO_THROW(hash = gh.encode(52.205, 0.119, 6));
EXPECT_EQ(0, hash.compare("u120fx"));
EXPECT_NO_THROW(hash = gh.encode(52.205, 0.119, 5));
EXPECT_EQ(0, hash.compare("u120f"));
}

View File

@ -1,5 +1,5 @@
/*!
* \file nma_printer_test.cc
* \file nmea_printer_test.cc
* \brief Implements Unit Tests for the Nmea_Printer class.
* \author Carles Fernandez-Prades, 2017. cfernandez(at)cttc.es
*
@ -133,7 +133,8 @@ void NmeaPrinterTest::conf()
{{}, {}}, /* odisp[2][6*11] ocean tide loading parameters {rov,base} */
{{}, {{}, {}}, {{}, {}}, {}, {}}, /* exterr_t exterr extended receiver error model */
0, /* disable L2-AR */
{} /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */
{}, /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */
true /* enable Bancroft initialization for the first iteration of the PVT computation, useful in some geometries */
};
rtkinit(&rtk, &rtklib_configuration_options);

View File

@ -132,7 +132,8 @@ void RinexPrinterTest::conf()
{{}, {}}, /* odisp[2][6*11] ocean tide loading parameters {rov,base} */
{{}, {{}, {}}, {{}, {}}, {}, {}}, /* exterr_t exterr extended receiver error model */
0, /* disable L2-AR */
{} /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */
{}, /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */
true /* enable Bancroft initialization for the first iteration of the PVT computation, useful in some geometries */
};
rtkinit(&rtk, &rtklib_configuration_options);

View File

@ -363,7 +363,8 @@ rtk_t configure_rtklib_options()
{{}, {}}, /* odisp[2][6*11] ocean tide loading parameters {rov,base} */
{{}, {{}, {}}, {{}, {}}, {}, {}}, /* exterr_t exterr extended receiver error model */
0, /* disable L2-AR */
{} /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */
{}, /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */
true /* enable Bancroft initialization for the first iteration of the PVT computation, useful in some geometries */
};
rtk_t rtk;

View File

@ -126,14 +126,14 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime)
// create the concurrent correlator threads
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
{
thread_pool.emplace_back(std::thread(run_correlator_cpu_real_codes,
thread_pool.emplace_back(run_correlator_cpu_real_codes,
correlator_pool[current_thread],
d_rem_carrier_phase_rad,
d_carrier_phase_step_rad,
d_code_phase_step_chips,
d_code_phase_rate_step_chips,
d_rem_code_phase_chips,
correlation_sizes[correlation_sizes_idx]));
correlation_sizes[correlation_sizes_idx]);
}
// wait the threads to finish they work and destroy the thread objects
for (auto& t : thread_pool)
@ -224,14 +224,14 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTimeAlloc)
// create the concurrent correlator threads
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
{
thread_pool.emplace_back(std::thread(run_correlator_cpu_real_codes,
thread_pool.emplace_back(run_correlator_cpu_real_codes,
correlator_pool[current_thread],
d_rem_carrier_phase_rad,
d_carrier_phase_step_rad,
d_code_phase_step_chips,
d_code_phase_rate_step_chips,
d_rem_code_phase_chips,
correlation_sizes[correlation_sizes_idx]));
correlation_sizes[correlation_sizes_idx]);
}
// wait the threads to finish they work and destroy the thread objects
for (auto& t : thread_pool)

View File

@ -122,13 +122,13 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime)
// create the concurrent correlator threads
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
{
thread_pool.push_back(std::thread(run_correlator_cpu,
thread_pool.emplace_back(run_correlator_cpu,
correlator_pool[current_thread],
d_rem_carrier_phase_rad,
d_carrier_phase_step_rad,
d_code_phase_step_chips,
d_rem_code_phase_chips,
correlation_sizes[correlation_sizes_idx]));
correlation_sizes[correlation_sizes_idx]);
}
// wait the threads to finish they work and destroy the thread objects
for (auto& t : thread_pool)
@ -220,13 +220,13 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTimeAlloc)
// create the concurrent correlator threads
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
{
thread_pool.push_back(std::thread(run_correlator_cpu,
thread_pool.emplace_back(run_correlator_cpu,
correlator_pool[current_thread],
d_rem_carrier_phase_rad,
d_carrier_phase_step_rad,
d_code_phase_step_chips,
d_rem_code_phase_chips,
correlation_sizes[correlation_sizes_idx]));
correlation_sizes[correlation_sizes_idx]);
}
// wait the threads to finish they work and destroy the thread objects
for (auto& t : thread_pool)

View File

@ -45,11 +45,8 @@ protected:
{
factory = std::make_shared<GNSSBlockFactory>();
config = std::make_shared<InMemoryConfiguration>();
gnss_synchro = Gnss_Synchro();
}
~GalileoE1DllPllVemlTrackingInternalTest() override = default;
void init();
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
@ -58,8 +55,8 @@ protected:
std::shared_ptr<InMemoryConfiguration> config;
Gnss_Synchro gnss_synchro{};
size_t item_size;
bool stop{false};
int message{0};
bool stop{false};
};