Added option to force 32bit compilation (useful for debug). Fixed various warnings when compiling in a 32 bit arch.

This commit is contained in:
Pedro Alvarez 2019-12-19 18:07:08 +00:00 committed by Andre Puschmann
parent a96a7fe20a
commit 6d4303cd94
6 changed files with 16 additions and 7 deletions

View File

@ -87,6 +87,8 @@ option(USE_LTE_RATES "Use standard LTE sampling rates" OFF)
option(USE_GLIBC_IPV6 "Use glibc's own ipv6.h" ON)
option(USE_MKL "Use MKL instead of fftw" OFF)
option(FORCE_32BIT "Add flags to force 32 bit compilation" OFF)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
set(GCC_ARCH armv8-a CACHE STRING "GCC compile for specific architecture.")
message(STATUS "Detected aarch64 processor")
@ -329,6 +331,13 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(NOT WIN32)
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_CXX)
endif(NOT WIN32)
if(FORCE_32BIT)
ADD_C_COMPILER_FLAG_IF_AVAILABLE("-m32" HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-m32" HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
set(CMAKE_SHARED_LINKER_FLAGS "-m32")
endif(FORCE_32BIT)
endif(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
ADD_C_COMPILER_FLAG_IF_AVAILABLE("-Werror=incompatible-pointer-types" HAVE_ERROR_INCOMPATIBLE)

View File

@ -260,7 +260,7 @@ private:
* @tparam T
* @tparam Nthres number of elements T that can be stored in the stack
*/
template <class T, uint32_t Nthres = ceil_frac(16lu, sizeof(T))>
template <class T, uint32_t Nthres = ceil_frac(size_t(16), sizeof(T))>
class ext_array
{
public:

View File

@ -625,7 +625,7 @@ int rf_zmq_recv_with_time_multi(void* h,
// Check available buffer size
if (nbytes > ZMQ_MAX_BUFFER_SIZE) {
fprintf(stderr,
"[zmq] Error: Trying to receive %d B but buffer is only %ld B at channel %d.\n",
"[zmq] Error: Trying to receive %d B but buffer is only %zu B at channel %d.\n",
nbytes,
ZMQ_MAX_BUFFER_SIZE,
0);
@ -762,7 +762,7 @@ int rf_zmq_send_timed_multi(void* h,
uint32_t nbytes_baseband = NSAMPLES2NBYTES(nsamples_baseband);
if (nbytes_baseband > ZMQ_MAX_BUFFER_SIZE) {
fprintf(stderr, "Error: trying to transmit too many samples (%d > %ld).\n", nbytes, ZMQ_MAX_BUFFER_SIZE);
fprintf(stderr, "Error: trying to transmit too many samples (%d > %zu).\n", nbytes, ZMQ_MAX_BUFFER_SIZE);
goto clean_exit;
}
@ -790,7 +790,7 @@ int rf_zmq_send_timed_multi(void* h,
if (num_tx_gap_samples < 0) {
fprintf(stderr,
"[zmq] Error: tx time is %.3f ms in the past (%ld < %ld)\n",
"[zmq] Error: tx time is %.3f ms in the past (%" PRIu64 " < %" PRIu64 ")\n",
-1000.0 * num_tx_gap_samples / handler->base_srate,
tx_ts,
handler->transmitter[0].nsamples);

View File

@ -20,7 +20,7 @@
*/
#include <stdbool.h>
#include <stdint.h>
#include <inttypes.h>
#include "srslte/config.h"
#include "srslte/phy/rf/rf.h"

View File

@ -67,7 +67,7 @@ static void* rf_zmq_async_rx_thread(void* h)
} else if (n > ZMQ_MAX_BUFFER_SIZE) {
fprintf(stderr,
"[zmq] Error: receiver expected <= %ld bytes and received %d at channel %d.\n",
"[zmq] Error: receiver expected <= %zu bytes and received %d at channel %d.\n",
ZMQ_MAX_BUFFER_SIZE,
n,
0);

View File

@ -567,7 +567,7 @@ public:
if (lcid == 0) {
if (mac_msg_dl.new_subh()) {
if (mac_msg_dl.get()->set_con_res_id(conres_id)) {
log.info("CE: Added Contention Resolution ID=0x%lx\n", conres_id);
log.info("CE: Added Contention Resolution ID=0x%" PRIx64 "\n", conres_id);
} else {
log.error("CE: Setting Contention Resolution ID CE\n");
}