Commit 83bedef3 authored by frtabu's avatar frtabu

Allow build mode selection in build_oai (release, Debug, etc) using the -g...

Allow build mode selection in build_oai (release, Debug, etc) using the -g option. Fix some new warnings when building in Release mode. Modify default (no -g specified) to build Release version
parent 6260936e
......@@ -127,7 +127,7 @@ endfunction()
#set(CMAKE_BUILD_TYPE "Debug")
if (CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
set(CMAKE_BUILD_TYPE "Release")
endif()
message("CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
add_list_string_option(CMAKE_BUILD_TYPE "RelWithDebInfo" "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." Debug Release RelWithDebInfo MinSizeRel)
......@@ -330,14 +330,14 @@ add_custom_target (
${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" "NR_" "-findirect-choice"
DEPENDS ${NR_RRC_GRAMMAR}
)
# remove warnings in code generated by asn1c
set_property(SOURCE ${nr_rrc_source} PROPERTY COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-but-set-variable")
add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source}
${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c
)
add_dependencies(NR_RRC_LIB nr_rrc_flag)
include_directories ("${NR_RRC_FULL_DIR}")
# S1AP
# Same limitation as described in RRC: unknown generated file list
# so we generate it at cmake time
......@@ -371,6 +371,8 @@ add_library(S1AP_LIB
${S1AP_DIR}/s1ap_common.c
)
add_dependencies(S1AP_LIB rrc_flag s1ap_flag)
# remove warnings in code generated by asn1c
target_compile_options(S1AP_LIB PUBLIC -Wno-unused-variable -Wno-unused-but-set-variable)
include_directories ("${S1AP_C_DIR}")
include_directories ("${S1AP_DIR}")
......@@ -424,6 +426,8 @@ add_library(X2AP_LIB
${X2AP_DIR}/x2ap_common.c
)
add_dependencies(X2AP_LIB rrc_flag x2_flag)
# remove warnings in code generated by asn1c
target_compile_options(X2AP_LIB PUBLIC -Wno-unused-variable -Wno-unused-but-set-variable)
include_directories ("${X2AP_C_DIR}")
include_directories ("${X2AP_DIR}")
......@@ -447,7 +451,7 @@ add_dependencies(X2AP_ENB rrc_flag x2_flag)
add_list1_option(F1AP_RELEASE R15 "F1AP ASN.1 grammar version" R15)
set(F1AP_DIR ${OPENAIR2_DIR}/F1AP)
if (${F1AP_RELEASE} STREQUAL "R15")
make_version(F1AP_VERSION 15 2 1)
make_version(_VERSION 15 2 1)
set (ASN1RELDIR R15.2.1)
endif(${F1AP_RELEASE} STREQUAL "R15")
add_definitions(-DF1AP_VERSION=${F1AP_VERSION})
......@@ -477,7 +481,8 @@ file(GLOB F1AP_ASN_GENERATED_C_FILES ${F1AP_ASN_GENERATED_C_DIR}/*.c)
add_library(F1AP_LIB
${F1AP_ASN_GENERATED_C_FILES}
)
# remove warnings in code generated by asn1c
target_compile_options(F1AP_LIB PUBLIC -Wno-unused-variable -Wno-unused-but-set-variable)
include_directories ("${F1AP_ASN_GENERATED_C_DIR}")
include_directories ("${F1AP_DIR}")
......
......@@ -91,8 +91,11 @@ Options
-i | --install-system-files
Install OpenAirInterface required files in Linux system
This option will require root password
-g | --run-with-gdb
Add debugging symbols to compilation directives. It also disables any compiler optimization. Only for debugging. Do not use in normal operation!
-g | --run-with-gdb <Release | RelWithDebInfo | MinSizeRel | Debug
specify the build mode used by cmake. defaults to Debug mode if -g is used alone, with no mode parameter
if -g is not specifies, Release mode is used.
-G | --cmaketrace
enable cmake debugging messages
--eNB
Makes the LTE softmodem
--gNB
......@@ -193,10 +196,41 @@ function main() {
echo_info "Will copy OpenAirInterface files in Linux directories"
shift;;
-g | --run-with-gdb)
case "$2" in
"Release")
GDB=0
CMAKE_BUILD_TYPE="Release"
echo_info "Will Compile without gdb symbols and with compiler optimization"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Release"
shift
;;
"RelWithDebInfo")
GDB=0
CMAKE_BUILD_TYPE="RelWithDebInfo"
echo_info "Will Compile with gdb symbols"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=RelWithDebInfo"
shift
;;
"MinSizeRel")
GDB=0
CMAKE_BUILD_TYPE="MinSizeRel"
echo_info "Will Compile for minimal exec size"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=MinSizeRel"
shift
;;
"Debug" | *)
GDB=1
CMAKE_BUILD_TYPE="Debug"
echo_info "Will Compile with gdb symbols and disable compiler optimization"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Debug --trace-expand"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Debug"
if [ "$1" == "Debug" ] ; then
shift
fi
;;
esac
shift;;
-G | --cmaketrace)
CMAKE_CMD="$CMAKE_CMD --trace-expand"
shift;;
--eNB)
eNB=1
......
......@@ -39,28 +39,26 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
unsigned char symbol,
unsigned char Ns,
int sample_offset,
int no_prefix)
{
int no_prefix) {
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
NR_UE_COMMON *common_vars = &ue->common_vars;
unsigned char aa;
unsigned int nb_prefix_samples;
unsigned int nb_prefix_samples0;
if (ue->is_synchronized) {
nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0);
}
else {
} else {
nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
}
//unsigned int subframe_offset;//,subframe_offset_F;
unsigned int slot_offset;
//int i;
unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10;
unsigned int rx_offset;
void (*dft)(int16_t *,int16_t *, int);
int tmp_dft_in[8192] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs
......@@ -102,6 +100,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
break;
default:
dft=0;
printf("unsupported ofdm symbol size \n");
assert(0);
}
......@@ -124,11 +123,9 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
memset(&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
rx_offset = sample_offset + slot_offset + nb_prefix_samples0 - SOFFSET;
// Align with 256 bit
// rx_offset = rx_offset&0xfffffff8;
#ifdef DEBUG_FEP
// if (ue->frame <100)
/*LOG_I(PHY,*/printf("slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, slot_offset %u, sample_offset %d,rx_offset %u, frame_length_samples %u\n",
......@@ -136,10 +133,9 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
#endif
if (symbol==0) {
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
memcpy((short*) &common_vars->rxdata[aa][frame_length_samples],
(short*) &common_vars->rxdata[aa][0],
memcpy((short *) &common_vars->rxdata[aa][frame_length_samples],
(short *) &common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int));
if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs
......@@ -152,7 +148,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
#if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats);
#endif
dft((int16_t *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
#if UE_TIMING_TRACE
......@@ -160,7 +155,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
#endif
}
} else {
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*symbol;
// + (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
......@@ -168,6 +162,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
memcpy((void *) &common_vars->rxdata[aa][frame_length_samples],
(void *) &common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int));
#if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats);
#endif
......@@ -179,24 +174,21 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
dft((int16_t *)tmp_dft_in,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
} else { // use dft input from RX buffer directly
dft((int16_t *) &common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
}
#if UE_TIMING_TRACE
stop_meas(&ue->rx_dft_stats);
#endif
}
#ifdef DEBUG_FEP
#ifdef DEBUG_FEP
// if (ue->frame <100)
printf("slot_fep: frame %d: symbol %d rx_offset %u\n", ue->proc.proc_rxtx[(Ns)&1].frame_rx, symbol, rx_offset);
#endif
#endif
}
#ifdef DEBUG_FEP
printf("slot_fep: done\n");
#endif
......@@ -210,14 +202,11 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
unsigned char symbol,
unsigned char Ns,
int sample_offset,
int no_prefix)
{
int no_prefix) {
uint32_t slot_offset;
uint32_t rxdata_offset;
unsigned int nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
unsigned int nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0);
void (*dft)(int16_t *,int16_t *, int);
switch (frame_parms->ofdm_symbol_size) {
......@@ -260,7 +249,6 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
slot_offset = Ns * frame_parms->samples_per_slot;
if(symbol == 0)
rxdata_offset = slot_offset + nb_prefix_samples0 - SOFFSET;
else
......@@ -268,6 +256,5 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
dft((int16_t *)&rxdata[rxdata_offset],
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
return(0);
}
......@@ -4429,7 +4429,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) {
static LTE_InterFreqBandInfo_t InterFreqBandInfo[4][4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it
static LTE_BandInfoEUTRA_t BandInfoEUTRA[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it
asn_enc_rval_t enc_rval;
asn_dec_rval_t dec_rval;
__attribute__ ((unused)) asn_dec_rval_t dec_rval; /* prevent warning: used only in assert macro */
long maxNumberROHC_ContextSessions = LTE_PDCP_Parameters__maxNumberROHC_ContextSessions_cs16;
int i;
LTE_UE_EUTRA_Capability_t *UE_EUTRA_Capability;
......
This diff is collapsed.
......@@ -3,13 +3,14 @@
#include "conf_network.h"
int get_plmn_index(const char * mccmnc, const networks_t networks) {
int get_plmn_index(const char *mccmnc, const networks_t networks) {
char mcc[4];
char mnc[strlen(mccmnc) - 2];
strncpy(mcc, mccmnc, 3);
mcc[3] = '\0';
strncpy(mnc, mccmnc + 3, 3);
mnc[strlen(mccmnc) - 3] = '\0';
for (int i = 0; i < networks.size; i++) {
if (strcmp(networks.items[i].conf.mcc, mcc) == 0) {
if (strcmp(networks.items[i].conf.mnc, mnc) == 0) {
......@@ -17,36 +18,34 @@ int get_plmn_index(const char * mccmnc, const networks_t networks) {
}
}
}
return -1;
}
plmn_t make_plmn_from_conf(const plmn_conf_param_t *plmn_conf) {
plmn_t plmn;
char num[6];
memset(&plmn, 0xff, sizeof(plmn));
snprintf(num, 6, "%s%s", plmn_conf->mcc, plmn_conf->mnc);
plmn.MCCdigit2 = plmn_conf->mcc[1];
plmn.MCCdigit1 = plmn_conf->mcc[0];
plmn.MCCdigit3 = plmn_conf->mcc[2];
plmn.MNCdigit2 = plmn_conf->mnc[1];
plmn.MNCdigit1 = plmn_conf->mnc[0];
if (strlen(plmn_conf->mnc) > 2) {
plmn.MNCdigit3 = plmn_conf->mnc[2];
}
return plmn;
}
void gen_network_record_from_conf(const plmn_conf_param_t *conf, network_record_t *record) {
strcpy(record->fullname, conf->fullname);
strcpy(record->shortname, conf->shortname);
char num[6];
char num[10];
sprintf(num, "%s%s", conf->mcc, conf->mnc);
record->num = atoi(num);
record->plmn = make_plmn_from_conf(conf);
record->tac_end = 0xfffd;
record->tac_start = 0x0001;
......@@ -55,46 +54,54 @@ void gen_network_record_from_conf(const plmn_conf_param_t *conf, network_record_
bool parse_plmn_param(config_setting_t *plmn_setting, plmn_conf_param_t *conf) {
int rc = 0;
rc = config_setting_lookup_string(plmn_setting, FULLNAME, &conf->fullname);
if (rc != 1) {
printf("Error on FULLNAME\n");
return false;
}
rc = config_setting_lookup_string(plmn_setting, SHORTNAME, &conf->shortname);
if (rc != 1) {
printf("Error on SHORTNAME\n");
return false;
}
rc = config_setting_lookup_string(plmn_setting, MNC, &conf->mnc);
if (rc != 1 || strlen(conf->mnc) > 3
|| strlen(conf->mnc) < 2) {
printf("Error ond MNC. Exiting\n");
return false;
}
rc = config_setting_lookup_string(plmn_setting, MCC, &conf->mcc);
if (rc != 1 || strlen(conf->mcc) != 3) {
printf("Error on MCC\n");
return false;
}
return true;
}
bool parse_plmns(config_setting_t *all_plmn_setting, networks_t *networks) {
config_setting_t *plmn_setting = NULL;
char plmn[10];
char plmn[16];
int size = 0;
size = config_setting_length(all_plmn_setting);
networks->size = size;
networks->items = malloc(sizeof(network_t) * size);
for (int i = 0; i < size; i++) {
memset(&networks->items[i].record, 0xff, sizeof(network_record_t));
}
for (int i = 0; i < networks->size; i++) {
for ( int i = 0; i < networks->size; i++) {
network_t *network = &networks->items[i];
sprintf(plmn, "%s%d", PLMN, i);
plmn_setting = config_setting_get_member(all_plmn_setting, plmn);
if (plmn_setting == NULL) {
printf("PLMN%d not fouund\n", i);
return false;
......@@ -103,9 +110,11 @@ bool parse_plmns(config_setting_t *all_plmn_setting, networks_t *networks) {
if ( parse_plmn_param(plmn_setting, &network->conf) == false ) {
return false;
}
gen_network_record_from_conf(&network->conf, &network->record);
network->plmn = network->record.plmn;
}
return true;
}
......
......@@ -9,24 +9,23 @@
bool parse_config_file(const char *output_dir, const char *conf_filename, int output_flags) {
int rc = true;
int ret;
int ue_nb = 0;
short ue_nb = 0;
config_setting_t *root_setting = NULL;
config_setting_t *ue_setting = NULL;
config_setting_t *all_plmn_setting = NULL;
char user[10];
char user[16];
config_t cfg;
networks_t networks;;
ret = get_config_from_file(conf_filename, &cfg);
if (ret == false) {
exit(1);
}
root_setting = config_root_setting(&cfg);
ue_nb = config_setting_length(root_setting) - 1;
all_plmn_setting = config_setting_get_member(root_setting, PLMN);
if (all_plmn_setting == NULL) {
printf("NO PLMN SECTION...EXITING...\n");
return (false);
......@@ -38,18 +37,14 @@ bool parse_config_file(const char *output_dir, const char *conf_filename, int ou
for (int i = 0; i < ue_nb; i++) {
emm_nvdata_t emm_data;
user_nvdata_t user_data;
user_data_conf_t user_data_conf;
usim_data_t usim_data;
usim_data_conf_t usim_data_conf;
user_plmns_t user_plmns;
sprintf(user, "%s%d", UE, i);
ue_setting = config_setting_get_member(root_setting, user);
if (ue_setting == NULL) {
printf("Check UE%d settings\n", i);
return false;
......@@ -60,19 +55,21 @@ bool parse_config_file(const char *output_dir, const char *conf_filename, int ou
}
rc = parse_ue_user_data(ue_setting, i, &user_data_conf);
if (rc != true) {
printf("Problem in USER section for UE%d. EXITING...\n", i);
return false;
}
gen_user_data(&user_data_conf, &user_data);
gen_user_data(&user_data_conf, &user_data);
rc = parse_ue_sim_param(ue_setting, i, &usim_data_conf);
if (rc != true) {
printf("Problem in SIM section for UE%d. EXITING...\n", i);
return false;
}
gen_usim_data(&usim_data_conf, &usim_data, &user_plmns, networks);
gen_usim_data(&usim_data_conf, &usim_data, &user_plmns, networks);
gen_emm_data(&emm_data, usim_data_conf.hplmn, usim_data_conf.msin,
&user_plmns.equivalents_home, networks);
......@@ -89,8 +86,8 @@ bool parse_config_file(const char *output_dir, const char *conf_filename, int ou
}
user_plmns_free(&user_plmns);
}
free(networks.items);
networks.size=0;
config_destroy(&cfg);
......@@ -99,6 +96,7 @@ bool parse_config_file(const char *output_dir, const char *conf_filename, int ou
bool get_config_from_file(const char *filename, config_t *config) {
config_init(config);
if (filename == NULL) {
// XXX write error message ?
return(false);
......@@ -108,12 +106,15 @@ bool get_config_from_file(const char *filename, config_t *config) {
if (!config_read_file(config, filename)) {
fprintf(stderr, "Cant read config file '%s': %s\n", filename,
config_error_text(config));
if ( config_error_type(config) == CONFIG_ERR_PARSE ) {
fprintf(stderr, "This is line %d\n", config_error_line(config));
}
config_destroy(config);
return (false);
}
return true;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment