From cc3ead3ea25bb8d017528b543689090a9a483aa6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 17 Sep 2018 11:30:42 +0200 Subject: [PATCH 1/4] Reserve memory only one if acquisition init is called multiple times --- .../gnuradio_blocks/pcps_acquisition.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index b1b6d699a..034cbbd10 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -271,8 +271,8 @@ void pcps_acquisition::init() d_num_doppler_bins = static_cast(std::ceil(static_cast(static_cast(acq_parameters.doppler_max) - static_cast(-acq_parameters.doppler_max)) / static_cast(d_doppler_step))); // Create the carrier Doppler wipeoff signals - d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins]; - if (acq_parameters.make_2_steps) + if (d_grid_doppler_wipeoffs == nullptr) d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins]; + if (acq_parameters.make_2_steps && (d_grid_doppler_wipeoffs_step_two == nullptr)) { d_grid_doppler_wipeoffs_step_two = new gr_complex*[d_num_doppler_bins_step2]; for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++) @@ -281,11 +281,18 @@ void pcps_acquisition::init() } } - d_magnitude_grid = new float*[d_num_doppler_bins]; + if (d_magnitude_grid == nullptr) + { + d_magnitude_grid = new float*[d_num_doppler_bins]; + for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) + { + d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + d_magnitude_grid[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); + } + } + for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) { - d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); - d_magnitude_grid[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); for (uint32_t k = 0; k < d_fft_size; k++) { d_magnitude_grid[doppler_index][k] = 0.0; From b1f106be7e26cace31f11d391b581827e9965a21 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 17 Sep 2018 21:20:39 +0200 Subject: [PATCH 2/4] Search for the GNSS-Simulator if already installed --- cmake/Modules/FindGnssSimulator.cmake | 28 +++++++++++++++ src/tests/CMakeLists.txt | 51 +++++++++++++++------------ 2 files changed, 57 insertions(+), 22 deletions(-) create mode 100644 cmake/Modules/FindGnssSimulator.cmake diff --git a/cmake/Modules/FindGnssSimulator.cmake b/cmake/Modules/FindGnssSimulator.cmake new file mode 100644 index 000000000..56bccc709 --- /dev/null +++ b/cmake/Modules/FindGnssSimulator.cmake @@ -0,0 +1,28 @@ +# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors) +# +# This file is part of GNSS-SDR. +# +# GNSS-SDR is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GNSS-SDR is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNSS-SDR. If not, see . + + +find_program(SW_GENERATOR_BIN gnss_sim + PATHS /usr/bin + /usr/local/bin + /opt/local/bin + ${CMAKE_INSTALL_PREFIX}/bin + PATH_SUFFIXES bin ) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNSS-SIMULATOR DEFAULT_MSG SW_GENERATOR_BIN) +MARK_AS_ADVANCED(SW_GENERATOR_BIN) \ No newline at end of file diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 4821afbd4..6c83f0576 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -188,31 +188,38 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) else(ENABLE_FPGA) set(CROSS_INSTALL_DIR "") endif(ENABLE_FPGA) - ExternalProject_Add( - gnss-sim - GIT_REPOSITORY https://bitbucket.org/jarribas/gnss-simulator - GIT_TAG ${GNSSSDR_GNSS_SIM_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gnss-sim - BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../gnss-sim - CMAKE_ARGS ${GTEST_COMPILER} ${TOOLCHAIN_ARG} ${CROSS_INSTALL_DIR} - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND "" - ) - if(ENABLE_INSTALL_TESTS) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/../../gnss-sim/gnss_sim DESTINATION bin) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/brdc3540.14n DESTINATION share/gnss-sim) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/circle.csv DESTINATION share/gnss-sim) - set(SW_GENERATOR_BIN ${CMAKE_INSTALL_PREFIX}/bin/gnss_sim) + find_package(GnssSimulator QUIET) + if(GNSS-SIMULATOR_FOUND) add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}") add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/brdc3540.14n") add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/circle.csv") - else(ENABLE_INSTALL_TESTS) - set(SW_GENERATOR_BIN ${CMAKE_CURRENT_BINARY_DIR}/../../gnss-sim/gnss_sim) - add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}") - add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/brdc3540.14n") - add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/circle.csv") - endif(ENABLE_INSTALL_TESTS) + else(GNSS-SIMULATOR_FOUND) + ExternalProject_Add( + gnss-sim + GIT_REPOSITORY https://bitbucket.org/jarribas/gnss-simulator + GIT_TAG ${GNSSSDR_GNSS_SIM_LOCAL_VERSION} + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gnss-sim + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../gnss-sim + CMAKE_ARGS ${GTEST_COMPILER} ${TOOLCHAIN_ARG} ${CROSS_INSTALL_DIR} + UPDATE_COMMAND "" + PATCH_COMMAND "" + INSTALL_COMMAND "" + ) + if(ENABLE_INSTALL_TESTS) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/../../gnss-sim/gnss_sim DESTINATION bin) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/brdc3540.14n DESTINATION share/gnss-sim) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/circle.csv DESTINATION share/gnss-sim) + set(SW_GENERATOR_BIN ${CMAKE_INSTALL_PREFIX}/bin/gnss_sim) + add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}") + add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/brdc3540.14n") + add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/circle.csv") + else(ENABLE_INSTALL_TESTS) + set(SW_GENERATOR_BIN ${CMAKE_CURRENT_BINARY_DIR}/../../gnss-sim/gnss_sim) + add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}") + add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/brdc3540.14n") + add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/circle.csv") + endif(ENABLE_INSTALL_TESTS) + endif(GNSS-SIMULATOR_FOUND) ################################################################################ # Local installation of GPSTk http://www.gpstk.org/ From c2966176c2d1f994b7957762326494d18957abd3 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 19 Sep 2018 18:49:06 +0200 Subject: [PATCH 3/4] Fix OE compilation --- src/tests/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 6c83f0576..cd07aead3 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -179,6 +179,7 @@ endif(ENABLE_UNIT_TESTING_MINIMAL) ################################################################################ # Optional generator ################################################################################ +option(ENABLE_GNSS_SIM_INSTALL "Enable the installation of gnss_sim on the fly" ON) if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) if(ENABLE_FPGA) set(CROSS_INSTALL_DIR "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}") @@ -189,11 +190,11 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) set(CROSS_INSTALL_DIR "") endif(ENABLE_FPGA) find_package(GnssSimulator QUIET) - if(GNSS-SIMULATOR_FOUND) + if(GNSS-SIMULATOR_FOUND OR NOT ENABLE_GNSS_SIM_INSTALL) add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}") add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/brdc3540.14n") add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/circle.csv") - else(GNSS-SIMULATOR_FOUND) + else(GNSS-SIMULATOR_FOUND OR NOT ENABLE_GNSS_SIM_INSTALL) ExternalProject_Add( gnss-sim GIT_REPOSITORY https://bitbucket.org/jarribas/gnss-simulator @@ -219,7 +220,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/brdc3540.14n") add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/circle.csv") endif(ENABLE_INSTALL_TESTS) - endif(GNSS-SIMULATOR_FOUND) + endif(GNSS-SIMULATOR_FOUND OR NOT ENABLE_GNSS_SIM_INSTALL) ################################################################################ # Local installation of GPSTk http://www.gpstk.org/ From c5727d630280f7075c0133b5f983805badcfefe2 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 25 Sep 2018 12:32:24 -0400 Subject: [PATCH 4/4] Update GPSTk version to 2.10.6 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 314bbab62..4e72a4b3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,7 +344,7 @@ set(GNSSSDR_GLOG_LOCAL_VERSION "0.3.5") set(GNSSSDR_ARMADILLO_LOCAL_VERSION "unstable") set(GNSSSDR_GTEST_LOCAL_VERSION "1.8.1") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") -set(GNSSSDR_GPSTK_LOCAL_VERSION "2.10") +set(GNSSSDR_GPSTK_LOCAL_VERSION "2.10.6") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.12")