From 4816ae64f7ca9957ba2da766c96fd4e725487693 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 1 Nov 2019 19:29:28 +0100 Subject: [PATCH] Add toolchain files for ARM processors --- CMakeLists.txt | 38 +++++++------ cmake/Modules/TestForARM.cmake | 19 ++++--- cmake/Toolchains/aarch64-linux-gnu.cmake | 50 +++++++++++++++++ cmake/Toolchains/arm-linux-gnueabihf.cmake | 53 +++++++++++++++++++ .../arm_cortex_a15_hardfp_native.cmake | 26 +++++++++ .../arm_cortex_a53_hardfp_native.cmake | 26 +++++++++ .../arm_cortex_a72_hardfp_native.cmake | 26 +++++++++ .../arm_cortex_a8_hardfp_native.cmake | 26 +++++++++ .../arm_cortex_a8_softfp_native.cmake | 26 +++++++++ .../arm_cortex_a9_hardfp_native.cmake | 26 +++++++++ cmake/Toolchains/raspi3.cmake | 26 +++++++++ cmake/Toolchains/raspi4.cmake | 26 +++++++++ .../arm_cortex_a15_hardfp_native.cmake | 2 +- .../arm_cortex_a53_hardfp_native.cmake | 2 +- .../arm_cortex_a72_hardfp_native.cmake | 2 +- .../arm_cortex_a8_hardfp_native.cmake | 2 +- .../arm_cortex_a8_softfp_native.cmake | 2 +- .../arm_cortex_a9_hardfp_native.cmake | 2 +- src/tests/CMakeLists.txt | 3 ++ 19 files changed, 354 insertions(+), 29 deletions(-) create mode 100644 cmake/Toolchains/aarch64-linux-gnu.cmake create mode 100644 cmake/Toolchains/arm-linux-gnueabihf.cmake create mode 100644 cmake/Toolchains/arm_cortex_a15_hardfp_native.cmake create mode 100644 cmake/Toolchains/arm_cortex_a53_hardfp_native.cmake create mode 100644 cmake/Toolchains/arm_cortex_a72_hardfp_native.cmake create mode 100644 cmake/Toolchains/arm_cortex_a8_hardfp_native.cmake create mode 100644 cmake/Toolchains/arm_cortex_a8_softfp_native.cmake create mode 100644 cmake/Toolchains/arm_cortex_a9_hardfp_native.cmake create mode 100644 cmake/Toolchains/raspi3.cmake create mode 100644 cmake/Toolchains/raspi4.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 5173456b2..c4d1542be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -978,6 +978,12 @@ if(NOT VOLKGNSSSDR_FOUND) -DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake -DCROSSCOMPILE_MULTILIB=TRUE ) + else() + if(CMAKE_TOOLCHAIN_FILE) + set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + ) + endif() endif() if(CMAKE_VERSION VERSION_LESS 3.2) ExternalProject_Add(volk_gnsssdr_module @@ -1770,6 +1776,10 @@ if(NOT PUGIXML_FOUND) if(DEFINED ENV{OECORE_TARGET_SYSROOT}) set(PUGIXML_COMPILER "") set(TOOLCHAIN_ARG "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake") + else() + if(CMAKE_TOOLCHAIN_FILE) + set(TOOLCHAIN_ARG "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") + endif() endif() if(CMAKE_VERSION VERSION_LESS 3.2) ExternalProject_Add(pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} @@ -2486,9 +2496,14 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0") add_compile_options(-Wno-missing-field-initializers) endif() - if(CMAKE_CROSSCOMPILING) + if(CMAKE_CROSSCOMPILING OR NOT ENABLE_PACKAGING) add_compile_options(-Wno-psabi) endif() + if(IS_ARM) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.1.0") + add_compile_options(-faligned-new) + endif() + endif() endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(NOT (CMAKE_VERSION VERSION_LESS "3.3")) @@ -2501,22 +2516,11 @@ endif() # Processor-architecture related flags # See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) - if(OS_IS_MACOSX) - add_compile_options(-march=corei7 -mfpmath=sse) - else() - if(NOT ENABLE_GENERIC_ARCH) - if(IS_ARM) - # ARM-specific options - # See https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html - if(NOT CMAKE_CROSSCOMPILING) - if(ARM_VERSION STREQUAL "arm") - # Unknown arm version - try our best to detect - add_compile_options(-mcpu=native) - else() - add_compile_options(-march=${ARM_VERSION}) - endif() - endif() - else() + if(NOT ENABLE_GENERIC_ARCH) + if(OS_IS_MACOSX) + add_compile_options(-march=corei7 -mfpmath=sse) + else() + if(NOT IS_ARM) add_compile_options(-march=native -mfpmath=sse) endif() endif() diff --git a/cmake/Modules/TestForARM.cmake b/cmake/Modules/TestForARM.cmake index 05a5c172e..1bc65eb42 100644 --- a/cmake/Modules/TestForARM.cmake +++ b/cmake/Modules/TestForARM.cmake @@ -38,12 +38,18 @@ endfunction() message(STATUS "Checking for ARM") -set(IS_ARM NO) +set(IS_ARM FALSE) set(ARM_VERSION "") +if(ENABLE_PACKAGING) + set(VERBOSE_BUILDING "-v") +else() + set(VERBOSE_BUILDING "") +endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") execute_process(COMMAND echo "int main(){}" - COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dM -E - + COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dM ${VERBOSE_BUILDING} -E - OUTPUT_VARIABLE TEST_FOR_ARM_RESULTS) string(REGEX MATCH "__arm" ARM_FOUND "${TEST_FOR_ARM_RESULTS}") @@ -52,7 +58,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") endif() if(NOT ARM_FOUND STREQUAL "") - set(IS_ARM YES) + set(IS_ARM TRUE) message(STATUS "ARM system detected") # detect the version @@ -92,10 +98,11 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") else() message(STATUS "System is not ARM") endif() - +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "ARMClang") + set(IS_ARM TRUE) + set(ARM_VERSION "arm") else() - # TODO: Other compilers - message(STATUS "Not detecting ARM on non-GNUCXX compiler. Defaulting to false") + message(STATUS "Not detecting ARM on non-GNUCXX or non-ARMClang compiler. Defaulting to false") message(STATUS "If you are compiling for ARM, set IS_ARM=ON manually") endif() diff --git a/cmake/Toolchains/aarch64-linux-gnu.cmake b/cmake/Toolchains/aarch64-linux-gnu.cmake new file mode 100644 index 000000000..610fde597 --- /dev/null +++ b/cmake/Toolchains/aarch64-linux-gnu.cmake @@ -0,0 +1,50 @@ +# Copyright (C) 2011-2019 (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 . + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR ARM) + +if(MINGW OR CYGWIN OR WIN32) + set(UTIL_SEARCH_CMD where) +elseif(UNIX OR APPLE) + set(UTIL_SEARCH_CMD which) +endif() + +set(TOOLCHAIN_PREFIX aarch64-linux-gnu-) + +execute_process( + COMMAND ${UTIL_SEARCH_CMD} ${TOOLCHAIN_PREFIX}gcc + OUTPUT_VARIABLE BINUTILS_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +get_filename_component(ARM_TOOLCHAIN_DIR ${BINUTILS_PATH} DIRECTORY) + +# The following is not needed on debian +# Without that flag CMake is not able to pass test compilation check +#set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs") + +set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc) +set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++) + +set(CMAKE_OBJCOPY ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}objcopy CACHE INTERNAL "objcopy tool") +set(CMAKE_SIZE_UTIL ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}size CACHE INTERNAL "size tool") + +set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH}) + +set(CMAKE_CROSSCOMPILING_EMULATOR "qemu-aarch64 -L /usr/aarch64-linux-gnu/") diff --git a/cmake/Toolchains/arm-linux-gnueabihf.cmake b/cmake/Toolchains/arm-linux-gnueabihf.cmake new file mode 100644 index 000000000..8c1d0144b --- /dev/null +++ b/cmake/Toolchains/arm-linux-gnueabihf.cmake @@ -0,0 +1,53 @@ +# Copyright (C) 2011-2019 (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 . + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR ARM) + +if(MINGW OR CYGWIN OR WIN32) + set(UTIL_SEARCH_CMD where) +elseif(UNIX OR APPLE) + set(UTIL_SEARCH_CMD which) +endif() + +set(TOOLCHAIN_PREFIX arm-linux-gnueabihf-) + +execute_process( + COMMAND ${UTIL_SEARCH_CMD} ${TOOLCHAIN_PREFIX}gcc + OUTPUT_VARIABLE BINUTILS_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +get_filename_component(ARM_TOOLCHAIN_DIR ${BINUTILS_PATH} DIRECTORY) + +# The following is not needed on debian +# Without that flag CMake is not able to pass test compilation check +#set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs") + +set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc) +set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++) +## the following is needed for CheckCSourceCompiles used in lib/CMakeLists.txt +set(CMAKE_C_FLAGS "-mfpu=neon" CACHE STRING "" FORCE) +set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "" FORCE) + +set(CMAKE_OBJCOPY ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}objcopy CACHE INTERNAL "objcopy tool") +set(CMAKE_SIZE_UTIL ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}size CACHE INTERNAL "size tool") + +set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH}) + +set(CMAKE_CROSSCOMPILING_EMULATOR "qemu-arm -L /usr/arm-linux-gnueabihf/") diff --git a/cmake/Toolchains/arm_cortex_a15_hardfp_native.cmake b/cmake/Toolchains/arm_cortex_a15_hardfp_native.cmake new file mode 100644 index 000000000..d629f8c11 --- /dev/null +++ b/cmake/Toolchains/arm_cortex_a15_hardfp_native.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2011-2019 (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 . + +######################################################################## +# Toolchain file for building native on a ARM Cortex A8 w/ NEON +# Usage: cmake -DCMAKE_TOOLCHAIN_FILE= +######################################################################## +set(CMAKE_CXX_COMPILER g++) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_FLAGS "-march=armv7-a -mtune=cortex-a15 -mfpu=neon -mfloat-abi=hard" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources +set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/cmake/Toolchains/arm_cortex_a53_hardfp_native.cmake b/cmake/Toolchains/arm_cortex_a53_hardfp_native.cmake new file mode 100644 index 000000000..3c33a042d --- /dev/null +++ b/cmake/Toolchains/arm_cortex_a53_hardfp_native.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2011-2019 (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 . + +######################################################################## +# Toolchain file for building native on a ARM Cortex A72 w/ NEON +# Usage: cmake -DCMAKE_TOOLCHAIN_FILE= +######################################################################## +set(CMAKE_CXX_COMPILER g++) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_FLAGS "-march=armv8-a -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources +set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -mthumb -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/cmake/Toolchains/arm_cortex_a72_hardfp_native.cmake b/cmake/Toolchains/arm_cortex_a72_hardfp_native.cmake new file mode 100644 index 000000000..581d72a80 --- /dev/null +++ b/cmake/Toolchains/arm_cortex_a72_hardfp_native.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2011-2019 (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 . + +######################################################################## +# Toolchain file for building native on a ARM Cortex A72 w/ NEON +# Usage: cmake -DCMAKE_TOOLCHAIN_FILE= +######################################################################## +set(CMAKE_CXX_COMPILER g++) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_FLAGS "-march=armv8-a -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources +set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -mthumb -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/cmake/Toolchains/arm_cortex_a8_hardfp_native.cmake b/cmake/Toolchains/arm_cortex_a8_hardfp_native.cmake new file mode 100644 index 000000000..3b69f9b88 --- /dev/null +++ b/cmake/Toolchains/arm_cortex_a8_hardfp_native.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2011-2019 (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 . + +######################################################################## +# Toolchain file for building native on a ARM Cortex A8 w/ NEON +# Usage: cmake -DCMAKE_TOOLCHAIN_FILE= +######################################################################## +set(CMAKE_CXX_COMPILER g++) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_FLAGS "-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources +set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/cmake/Toolchains/arm_cortex_a8_softfp_native.cmake b/cmake/Toolchains/arm_cortex_a8_softfp_native.cmake new file mode 100644 index 000000000..2aa09caf4 --- /dev/null +++ b/cmake/Toolchains/arm_cortex_a8_softfp_native.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2011-2019 (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 . + +######################################################################## +# Toolchain file for building native on a ARM Cortex A8 w/ NEON +# Usage: cmake -DCMAKE_TOOLCHAIN_FILE= +######################################################################## +set(CMAKE_CXX_COMPILER g++) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_FLAGS "-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources +set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/cmake/Toolchains/arm_cortex_a9_hardfp_native.cmake b/cmake/Toolchains/arm_cortex_a9_hardfp_native.cmake new file mode 100644 index 000000000..2ebeb69ea --- /dev/null +++ b/cmake/Toolchains/arm_cortex_a9_hardfp_native.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2011-2019 (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 . + +######################################################################## +# Toolchain file for building native on a ARM Cortex A8 w/ NEON +# Usage: cmake -DCMAKE_TOOLCHAIN_FILE= +######################################################################## +set(CMAKE_CXX_COMPILER g++) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_FLAGS "-march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources +set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/cmake/Toolchains/raspi3.cmake b/cmake/Toolchains/raspi3.cmake new file mode 100644 index 000000000..3c33a042d --- /dev/null +++ b/cmake/Toolchains/raspi3.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2011-2019 (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 . + +######################################################################## +# Toolchain file for building native on a ARM Cortex A72 w/ NEON +# Usage: cmake -DCMAKE_TOOLCHAIN_FILE= +######################################################################## +set(CMAKE_CXX_COMPILER g++) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_FLAGS "-march=armv8-a -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources +set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -mthumb -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/cmake/Toolchains/raspi4.cmake b/cmake/Toolchains/raspi4.cmake new file mode 100644 index 000000000..581d72a80 --- /dev/null +++ b/cmake/Toolchains/raspi4.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2011-2019 (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 . + +######################################################################## +# Toolchain file for building native on a ARM Cortex A72 w/ NEON +# Usage: cmake -DCMAKE_TOOLCHAIN_FILE= +######################################################################## +set(CMAKE_CXX_COMPILER g++) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_FLAGS "-march=armv8-a -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources +set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -mthumb -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a15_hardfp_native.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a15_hardfp_native.cmake index 9a461f21d..d629f8c11 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a15_hardfp_native.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a15_hardfp_native.cmake @@ -20,7 +20,7 @@ # Usage: cmake -DCMAKE_TOOLCHAIN_FILE= ######################################################################## set(CMAKE_CXX_COMPILER g++) -set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_COMPILER gcc) set(CMAKE_CXX_FLAGS "-march=armv7-a -mtune=cortex-a15 -mfpu=neon -mfloat-abi=hard" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a53_hardfp_native.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a53_hardfp_native.cmake index ebaa10bce..3c33a042d 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a53_hardfp_native.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a53_hardfp_native.cmake @@ -20,7 +20,7 @@ # Usage: cmake -DCMAKE_TOOLCHAIN_FILE= ######################################################################## set(CMAKE_CXX_COMPILER g++) -set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_COMPILER gcc) set(CMAKE_CXX_FLAGS "-march=armv8-a -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -mthumb -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a72_hardfp_native.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a72_hardfp_native.cmake index ea4c0dc25..581d72a80 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a72_hardfp_native.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a72_hardfp_native.cmake @@ -20,7 +20,7 @@ # Usage: cmake -DCMAKE_TOOLCHAIN_FILE= ######################################################################## set(CMAKE_CXX_COMPILER g++) -set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_COMPILER gcc) set(CMAKE_CXX_FLAGS "-march=armv8-a -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -mthumb -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a8_hardfp_native.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a8_hardfp_native.cmake index 0bd2b13cc..3b69f9b88 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a8_hardfp_native.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a8_hardfp_native.cmake @@ -20,7 +20,7 @@ # Usage: cmake -DCMAKE_TOOLCHAIN_FILE= ######################################################################## set(CMAKE_CXX_COMPILER g++) -set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_COMPILER gcc) set(CMAKE_CXX_FLAGS "-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a8_softfp_native.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a8_softfp_native.cmake index f870f5034..2aa09caf4 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a8_softfp_native.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a8_softfp_native.cmake @@ -20,7 +20,7 @@ # Usage: cmake -DCMAKE_TOOLCHAIN_FILE= ######################################################################## set(CMAKE_CXX_COMPILER g++) -set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_COMPILER gcc) set(CMAKE_CXX_FLAGS "-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a9_hardfp_native.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a9_hardfp_native.cmake index 7880d5e24..2ebeb69ea 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a9_hardfp_native.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/arm_cortex_a9_hardfp_native.cmake @@ -20,7 +20,7 @@ # Usage: cmake -DCMAKE_TOOLCHAIN_FILE= ######################################################################## set(CMAKE_CXX_COMPILER g++) -set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_COMPILER gcc) set(CMAKE_CXX_FLAGS "-march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS} -g" CACHE STRING "" FORCE) # same flags for asm sources diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index db4c32e24..8d733e8f2 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -29,6 +29,9 @@ if(DEFINED ENV{OECORE_TARGET_SYSROOT}) set(GTEST_COMPILER "") set(TOOLCHAIN_ARG "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Toolchains/oe-sdk_cross.cmake") else() + if(CMAKE_TOOLCHAIN_FILE) + set(TOOLCHAIN_ARG "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") + endif() if(ENABLE_PACKAGING) set(TOOLCHAIN_ARG "-DCMAKE_VERBOSE_MAKEFILE=ON") endif()