diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index c23b0d1a91471d406910790e3c54dddb42dbc9d3..67cc6cfc3a33e7950d88c432817bae1927f526fe 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1518,7 +1518,7 @@ if (${RF_BOARD} STREQUAL "OAI_USRP") include_directories(${LIBBOOST_INCLUDE_DIR}) endif (${RF_BOARD} STREQUAL "OAI_USRP") -pkg_search_module(OPENPGM openpgm-5.1) +pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2) if(NOT ${OPENPGM_FOUND}) message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built") else() @@ -1625,7 +1625,7 @@ add_executable(lte-softmodem ${T_SOURCE} ) -target_link_libraries (lte-softmodem +target_link_libraries (lte-softmodem -ldl -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} -Wl,--end-group ) @@ -1652,8 +1652,8 @@ add_executable(lte-softmodem-nos1 ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c ${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c - #${OPENAIR2_DIR}/RRC/NAS/nas_config.c # enable if you want rrc to mount ip interface - #${OPENAIR2_DIR}/RRC/NAS/rb_config.c + ${OPENAIR2_DIR}/RRC/NAS/nas_config.c + ${OPENAIR2_DIR}/RRC/NAS/rb_config.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${HW_SOURCE} ${TRANSPORT_SOURCE} @@ -1929,6 +1929,11 @@ foreach( d ${DirDefs} ) list(APPEND itti_compiler_options "-I${d}") endforeach() +# castxml doesn't work with c11 (gcc 5 default) +# force castxml and clang compilation with gnu89 standard +# we can't use cXX standard as pthread_rwlock_t is gnu standard +list(APPEND itti_compiler_options "-std=gnu89") + set (ITTI_H ${ITTI_DIR}/intertask_interface_types.h) add_custom_command ( OUTPUT ${OPENAIR_BIN_DIR}/messages.xml diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index d1306b804b3073f35c7b30a2bf8d15fbdc816793..04289a83fa0c1b23f233b1aac01e24295cb6e0b1 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -33,6 +33,7 @@ # brief OAI automated build tool that can be used to install, compile, run OAI. # author Navid Nikaein, Lionel GAUTHIER, Laurent Thomas +set -e ################################ # include helper functions @@ -59,6 +60,7 @@ RUN_GROUP=0 TEST_CASE_GROUP="" BUILD_DOXYGEN=0 T_TRACER="False" +DISABLE_HARDWARE_DEPENDENCY="False" trap handle_ctrl_c INT function print_help() { @@ -131,6 +133,8 @@ Options Disables CPU Affinity between UHD/TX/RX Threads (Valid only when deadline scheduler is disabled). By defaulT, CPU Affinity is enabled when not using deadline scheduler. It is enabled only with >2 CPUs. For eNB, CPU_0-> Device library (UHD), CPU_1->TX Threads, CPU_2...CPU_MAX->Rx Threads. For UE, CPU_0->Device Library(UHD), CPU_1..CPU_MAX -> All the UE threads --T-tracer Enables the T tracer. +--disable-hardware-dependency + Disable HW dependency during installation Usage (first build): oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB -x --install-system-files @@ -277,6 +281,10 @@ function main() { T_TRACER="True" echo_info "Enabling the T tracer" shift 1;; + --disable-hardware-dependency) + echo_info "Disabling hardware dependency for compiling software" + DISABLE_HARDWARE_DEPENDENCY="True" + shift 1;; -h | --help) print_help exit 1;; @@ -386,10 +394,16 @@ function main() { if [ "$HW" == "OAI_USRP" ] ; then echo_info "installing packages for USRP support" check_install_usrp_uhd_driver + if [ ! "$DISABLE_HARDWARE_DEPENDENCY" == "True" ]; then + install_usrp_uhd_driver + fi fi if [ "$HW" == "OAI_BLADERF" ] ; then echo_info "installing packages for BLADERF support" check_install_bladerf_driver + if [ ! "$DISABLE_HARDWARE_DEPENDENCY" == "True" ]; then + flash_firmware_bladerf + fi fi fi diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index f6d0d2b0dbd2932093616bef015910fe78e01d8f..a0697cd54796a1b285b8d0ebb4c0a49653cf0eda 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -67,7 +67,45 @@ echo_warning() { cecho "$*" $yellow ;} echo_success() { cecho "$*" $green ;} echo_info() { cecho "$*" $blue ;} +######################## +# distribution helpers # +######################## + +# This function return a string to identify the distribution we are running +# If we can't check the distribution, it returns "Unknown" +# This function return always true as exit code by design +# Examples: +# Ubuntu16.04 +# Debian8.5 +get_distribution_release() { + local distributor + if distributor=$(lsb_release -si 2>/dev/null) ; then + echo $distributor$(lsb_release -sr) + else + echo Unknown + fi +} + +check_supported_distribution() { + local distribution=$(get_distribution_release) + case "$distribution" in + "Ubuntu16.04") return 0 ;; + "Ubuntu14.04") return 0 ;; + esac + return 1 +} +################## +# Error handlers # +################## + +handler_EXIT() { + local exit_code=$? + [ "$exit_code" -eq 0 ] || echo_error "build have failed" + exit $exit_code +} + +trap handler_EXIT EXIT ########################### # Cleaners @@ -109,6 +147,8 @@ clean_all_files() { compilations() { cd $OPENAIR_DIR/cmake_targets/$1/build + echo_info "Log file for compilation written in: $dlog/$2.$REL.txt" + set +e { rm -f $3 if [ "$VERBOSE_COMPILE" == "1" ]; then @@ -118,12 +158,14 @@ compilations() { fi } > $dlog/$2.$REL.txt 2>&1 + set -e echo_info "Log file for compilation has been written to: $dlog/$2.$REL.txt" if [ -s $3 ] ; then cp $3 $4 echo_success "$2 compiled" else echo_error "$2 compilation failed" + exit 1 fi } @@ -186,23 +228,36 @@ install_gnutls_from_source(){ check_install_usrp_uhd_driver(){ #first we remove old installation - $SUDO apt-get remove uhd libuhd-dev libuhd003 uhd-host -y + $SUDO apt-get remove -y uhd || true + $SUDO apt-get remove libuhd-dev libuhd003 uhd-host -y v=$(lsb_release -cs) $SUDO apt-add-repository --remove "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main" #The new USRP repository $SUDO add-apt-repository ppa:ettusresearch/uhd -y $SUDO apt-get update $SUDO apt-get -y install python python-tk libboost-all-dev libusb-1.0-0-dev - $SUDO apt-get -y install libuhd-dev libuhd003 uhd-host + $SUDO apt-get -y install libuhd-dev libuhd003 +} + +install_usrp_uhd_driver() { + # We move uhd-host apart because it depends on linux kernel version + # On newer kernels, it fails to install + $SUDO apt-get -y install uhd-host $SUDO uhd_images_downloader } + check_install_bladerf_driver(){ - $SUDO add-apt-repository -y ppa:bladerf/bladerf - $SUDO apt-get update + if [ "$(get_distribution_release)" == "Ubuntu14.04" ] ; then + $SUDO add-apt-repository -y ppa:bladerf/bladerf + $SUDO apt-get update + fi $SUDO apt-get install -y bladerf libbladerf-dev $SUDO apt-get install -y bladerf-firmware-fx3 $SUDO apt-get install -y bladerf-fpga-hostedx40 - $SUDO bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img +} + +flash_firmware_bladerf() { + $SUDO bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img } check_install_additional_tools (){ @@ -228,7 +283,10 @@ check_install_additional_tools (){ ctags \ ntpdate \ iperf3 \ - android-tools-adb + android-tools-adb \ + wvdial \ + python-numpy \ + sshpass $SUDO pip install paramiko $SUDO pip install pyroute2 @@ -248,8 +306,26 @@ check_install_additional_tools (){ } check_install_oai_software() { + local specific_packages="" + if ! check_supported_distribution; then + echo_error "Your distribution $(get_distribution_release) is not supported by oai !" + exit 1 + fi $SUDO apt-get update + $SUDO apt install -y software-properties-common + case "$(get_distribution_release)" in + "Ubuntu14.04") + specific_packages="libtasn1-3-dev" + # For iperf3 + $SUDO add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty-backports universe" + $SUDO apt-get update + ;; + "Ubuntu16.04") + specific_packages="libtasn1-6-dev" + ;; + esac $SUDO apt-get install -y \ + $specific_packages \ autoconf \ automake \ bison \ @@ -273,9 +349,9 @@ check_install_oai_software() { iptables-dev \ libatlas-base-dev \ libatlas-dev \ - libblas3gf \ libblas-dev \ libconfig8-dev \ + libffi-dev \ libforms-bin \ libforms-dev \ libgcrypt11-dev \ @@ -285,16 +361,16 @@ check_install_oai_software() { libidn11-dev \ libmysqlclient-dev \ liboctave-dev \ - libpgm-5.1 \ libpgm-dev \ + libpython2.7-dev \ libsctp1 \ libsctp-dev \ libssl-dev \ - libtasn1-3-dev \ libtool \ libusb-1.0-0-dev \ libxml2 \ libxml2-dev \ + libxslt1-dev \ linux-headers-`uname -r` \ mscgen \ octave \ @@ -307,11 +383,7 @@ check_install_oai_software() { xmlstarlet \ python-pip \ pydb \ - wvdial \ - python-numpy \ - sshpass \ - libxslt1-dev \ - android-tools-adb + wget $SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so @@ -337,6 +409,7 @@ install_asn1c_from_source(){ ./configure make -j`nproc` $SUDO make install + cd - ) > $asn1_install_log 2>&1 } diff --git a/targets/ARCH/LMSSDR/USERSPACE/LIB/lmsSDR/dataTypes.h b/targets/ARCH/LMSSDR/USERSPACE/LIB/lmsSDR/dataTypes.h index cba2b7341e2ad89ccdb8047d5fbb9628674e629e..c97ac7857df021918df23abbddee645ed18e35e1 100644 --- a/targets/ARCH/LMSSDR/USERSPACE/LIB/lmsSDR/dataTypes.h +++ b/targets/ARCH/LMSSDR/USERSPACE/LIB/lmsSDR/dataTypes.h @@ -14,14 +14,15 @@ typedef struct int16_t q; } complex16_t; -typedef struct +class SamplesPacket { + public: uint64_t timestamp; //timestamp of the packet uint16_t first; //index of first unused sample in samples[] uint16_t last; //end index of samples static const uint16_t samplesCount = 1024; //maximum number of samples in packet complex16_t samples[samplesCount]; //must be power of two -} SamplesPacket; +}; complex16_t operator &=(complex16_t & other1, const complex16_t & other) // copy assignment { @@ -30,4 +31,4 @@ complex16_t operator &=(complex16_t & other1, const complex16_t & other) // copy return other1; } -#endif \ No newline at end of file +#endif