updated build.sh for rfic compilation

This commit is contained in:
xianfeng.du 2023-09-26 11:29:28 +08:00
parent 0cc6b8347d
commit 49f94d96b6
6 changed files with 41 additions and 227 deletions

View File

@ -39,35 +39,38 @@ done
export DIR_ROOT=$(cd `dirname "$0"`;pwd)
#echo "# script_dir:${DIR_ROOT}"
export RFIC_DIR=${DIR_ROOT}/driver/rfic/adrv9026
export CJSON_DIR=${DIR_ROOT}/driver/rfic/ucp/cJSON
export RFIC_APP_DIR=${DIR_ROOT}/rfic
export BUILD_DIR=${DIR_ROOT}/build
if [ -d ${BUILD_DIR} ]; then
rm -rf ${BUILD_DIR}
fi
mkdir -p ${BUILD_DIR}
if [[ "${fronthaul_option}" == "jesd" ]]; then
export RFIC_DIR=${DIR_ROOT}/driver/rfic/adrv9026
export CJSON_DIR=${DIR_ROOT}/driver/rfic/ucp/cJSON
export RFIC_APP_DIR=${DIR_ROOT}/rfic
export BOARD_TYPE=${board_option}
chmod +x build_jesd.sh
source ./build_jesd.sh
cp ${RFIC_DIR}/out/rfic/*.a ${DIR_ROOT}/lib
cp ${RFIC_DIR}/out/rfic/*.h ${DIR_ROOT}/interface
cp ${RFIC_DIR}/out/jesd/*.a ${DIR_ROOT}/lib
cp ${RFIC_DIR}/out/jesd/*.h ${DIR_ROOT}/interface
mkdir -p ${BUILD_DIR}
cp ${DIR_ROOT}/lib/*.a ${BUILD_DIR}/
#cp ${BUILD_DIR}/librfic.a ${RFIC_APP_DIR}/lib/
cp ${DIR_ROOT}/interface/ucp_api_rfic.h ${RFIC_APP_DIR}/inc/
echo -e "\n"
echo "###### start building libjesd.a and librfic.a ######"
cd ${DIR_ROOT}/driver/rfic
chmod +x build.sh
source ./build.sh
cp ${RFIC_DIR}/out/jesd/*.a ${BUILD_DIR}
cp ${RFIC_DIR}/out/jesd/*.h ${DIR_ROOT}/interface
cp ${RFIC_DIR}/out/rfic/*.a ${DIR_ROOT}/lib
cp ${RFIC_DIR}/out/rfic/ucp_api_rfic.h ${RFIC_APP_DIR}/inc/
cp ${CJSON_DIR}/xzJSON.h ${RFIC_APP_DIR}/inc/
chmod +x build_rfic.sh
source ./build_rfic.sh
cp ${RFIC_APP_DIR}/build/*.out ${BUILD_DIR}/
echo -e "\n"
echo "###### start building rfic.out ######"
cd ${RFIC_APP_DIR}/
make
fi
echo -e "\n"
echo "###### start building msgTransfer.out and libmsgTransfer.a ######"
cd ${DIR_ROOT}/
make cache_option=${cache_option} fronthaul_option=${fronthaul_option} test_option=${test_option} test_id=${case_id}

View File

@ -1,18 +0,0 @@
set -e
git submodule init
git submodule update --remote --merge --recursive driver/rfic
pushd driver/rfic
git clean -dxf
git fetch
git checkout DEV
git pull
#git checkout commitid
#git submodule init
#git submodule update
make clean
echo "#board_type:${BOARD_TYPE}"
make all board_type=${BOARD_TYPE}
popd

View File

@ -1,7 +0,0 @@
set -e
pushd ./rfic
make clean
echo "start to build rfic.out and librfic_main.o"
make all
popd

@ -1 +1 @@
Subproject commit 0391452992501a90564728d5e5844c3f724eee5f
Subproject commit 90ca99bb1fa523129a881a9e552136b0cabc1ead

View File

@ -1,147 +0,0 @@
//******************** (C) COPYRIGHT 2022 SmartLogic*******************************
// FileName : ucp_api_rfic.h
// Author : Boheng Lin bhlin919@126.com
// Date First Issued : 2023-03-04 17:39:00 PM
// Last Modified :
// Description :
// ------------------------------------------------------------
// Modification History:
// Version Date Author Modification Description
//
//**********************************************************************************
#ifndef UCP_API_RFIC_H_
#define UCP_API_RFIC_H_
#include <stdio.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
//**********************************************************************************
// system option layer
/**
* \brief Sets up the cell's default config
*
* \param bw is bandwidth (Unit hz).
*
* \retval 0.
*/
extern int32_t UCP_API_RFIC_CellInit(uint64_t bw);
/**
* \brief Sets up the cell's default config
*
* \param txLo is Transmit local frequency (Unit hz).
* \param rxLo is Receive local frequency (Unit hz).
* \param initAtt is Initialize attenuation (Unit db, range 0 ~ 20).
*
* \retval 0.
*/
extern int32_t UCP_API_RFIC_CellSetup(uint64_t txLo, uint64_t rxLo, uint16_t initAtt);
/**
* \brief Sets up the transceiver's tx rx LO frenq, bandwidth, Initialize attenuation.
* then process Initialize transceiver
*
* \param txLo is Transmit local frequency (Unit hz).
* \param rxLo is Receive local frequency (Unit hz).
* \param bw is bandwidth (Unit hz).
* \param initAtt is Initialize attenuation (Unit db, range 0 ~ 20).
*
* \retval 0.
*/
extern int32_t UCP_API_RFIC_CellDelete(void);
//**********************************************************************************
// chip option layer
// TRANSCEIVER
/**
* \brief transceiver chip hardware reset.
*
* \param void.
*
* \retval void.
*/
extern int32_t UCP_API_TRANSCEIVER_Reset(void);
/**
* \brief Sets up the transceiver's MGC Mod.
*
* \param en, if set 1, MGC Mode; set 0, AGC Mode.
*
* \retval 0.
*/
extern int32_t UCP_API_TRANSCEIVER_MGC_Cfg(uint8_t en);
/**
* \brief Sets up the transceiver's rx gain at MGC mode.
*
* \param gain_db (Unit db, range 0~36, step 0.5db).
*
* \retval 0.
*/
extern int32_t UCP_API_TRANSCEIVER_Gain_Set(double gain_db);
/**
* \brief Get the transceiver's rx gain.
*
* \param gain_db (Unit db, range 0~36, step 0.5db).
*
* \retval gain_db (Unit db, range 0~36, step 0.5db).
*/
extern double UCP_API_TRANSCEIVER_Gain_Get(void);
/**
* \brief Set up the transceiver's tx attenuation.
*
* \param att_db (Unit db, range 0~20).
*
* \retval 0.
*/
extern int32_t UCP_API_TRANSCEIVER_Att_Set(uint8_t att_db);
/**
* \brief Get the transceiver's tx attenuation.
*
* \retval att_db (Unit db, range 0~20).
*/
extern uint8_t UCP_API_TRANSCEIVER_Att_Get(void);
//**********************************************************************************
// CLOCKGEN
/**
* \brief clockGen chip hardware reset.
*
* \param void.
*
* \retval void.
*/
extern void UCP_API_CLOCKGEN_Reset(void);
/**
* \brief clockGen chip init function.
*
* \param void.
*
* \retval void.
*/
extern int32_t UCP_API_CLOCKGEN_Init(void);
/**
* \brief Get the status of clockGen chip's pll.
*
* \param void.
*
* \retval lock code.
*/
extern uint8_t UCP_API_CLOCKGEN_LockStatus(void);
#ifdef __cplusplus
}
#endif
#endif /* #ifndef UCP_API_RFIC_H_ */

View File

@ -16,8 +16,8 @@ else
CROSS_CC ?= aarch64-linux-gnu-
endif
AR = ar
CC = $(CROSS_CC)gcc
AR := ar
CC := $(CROSS_CC)gcc
#$(info "CC=" $(CC))
git_id ?= $(shell git log -1 --format="%H")
@ -28,7 +28,7 @@ commit_time ?= $(shell date -d@$(commit_ts) +"%Y-%m-%d-%H:%M:%S")
$(info "commit_ts=" $(commit_ts))
$(info "commit_time=" $(commit_time))
DEFINES ?= RFIC_VER=\"commit_id:$(git_id),commit_time:$(commit_time)\"
#DEFINES ?= RFIC_VER=\"commit_id:$(git_id),commit_time:$(commit_time)\"
#optimization level -O2
C_OPT_FLAGS ?= -O2
@ -47,22 +47,16 @@ INCLUDE_DIRS ?= ./inc
LD_FLAGS ?= -lgcc -lc
LD_FLAGS += -lm -ldl -Wl,-rpath=./
LD_FLAGS += -lpthread
LD_FLAGS += ../lib/librfic.a
LD_FLAGS += -lrfic
LD_FLAGS += -rdynamic -funwind-tables -ffunction-sections
$(info "DEFINES=" $(DEFINES))
#Flatten files and remove the duplicate by sort
ABS_SRC_DIRS := $(foreach d,$(SRC_DIRS),$(abspath $(d)))
SRC_FILES := $(foreach d,$(ABS_SRC_DIRS),$(wildcard $(d)/*.c))
#main.c
MAIN_DIR := ./src
MAIN_FILE := ./src/main.c
# Allow certain files to be excluded from the build
EXCL_SRCS ?= $(MAIN_FILE)
EXCL_SRCS ?=
# Filter source files (allow files to be excluded)
FINAL_SRCS_FILES += $(foreach f,$(SRC_FILES),$(if $(findstring $(abspath $(f)),$(abspath $(EXCL_SRCS))),,$(f)))
@ -71,13 +65,16 @@ FINAL_SRCS_FILES += $(foreach f,$(SRC_FILES),$(if $(findstring $(abspath $(f)),$
# ==============================================================================
# Variables: Output Files
# ==============================================================================
BUILD_DIR := ./build
OBJ_MAIN_DIR := $(BUILD_DIR)/main
OBJ_DIR := $(BUILD_DIR)/obj
BIN_FILE := $(BUILD_DIR)/rfic.out
LIB_FILE := $(BUILD_DIR)/librfic_main.a
BJ_FILES += $(foreach f,$(FINAL_SRCS_FILES),$(OBJ_DIR)/$(patsubst %.c,%.o,$(notdir $(f))))
OBJ_MAIN_FILES += $(foreach f,$(MAIN_FILE),$(OBJ_MAIN_DIR)/$(patsubst %.c,%.o,$(notdir $(f))))
#BUILD_DIR := ./build
ifeq ($(BOARD_TYPE),EVB)
BIN_FILE_NAME := rfic_evb.out
else
BIN_FILE_NAME := rfic_evmy.out
endif
#$(info "BUILD_DIR=" $(BUILD_DIR))
OBJ_DIR := $(BUILD_DIR)/rfic
BIN_FILE := $(BUILD_DIR)/$(BIN_FILE_NAME)
OBJ_FILES += $(foreach f,$(FINAL_SRCS_FILES),$(OBJ_DIR)/$(patsubst %.c,%.o,$(notdir $(f))))
# ==============================================================================
# Rules: Compilation
@ -101,9 +98,8 @@ define DO_BUILD
endef
$(eval $(call DO_BUILD,$(OBJ_DIR),$(ABS_SRC_DIRS)))
$(eval $(call DO_BUILD,$(OBJ_MAIN_DIR), $(abspath $(MAIN_DIR))))
$(BIN_FILE):$(OBJ_FILES) $(OBJ_MAIN_FILES)
$(BIN_FILE):$(OBJ_FILES)
# @echo "# Creating bin directory $(BIN_DIR)"
# mkdir -p $(BIN_DIR)
@ -111,31 +107,18 @@ $(BIN_FILE):$(OBJ_FILES) $(OBJ_MAIN_FILES)
$(CC) -o $@ $^ $(LD_FLAGS) $(patsubst %,-L %,$(LIB_DIRS))
# $(CC) -o $@ $^ $(LD_FLAGS) -T$(LINK_FILE)
$(LIB_FILE):$(OBJ_FILES) $(RFIC_OBJ_FILES)
# @echo "# Creating lib directory $(LIB_DIR)"
# mkdir -p $(LIB_DIR)
@echo "# Linking objects to form $@"
$(AR) -rcs $@ $^
# $(CC) -shared -o $@ $^ $(LD_FLAGS)
# ==============================================================================
# Rules: Targets
# ==============================================================================
.DEFAULT_GOAL := all
.PHONY: build lib clean
all: build lib
.PHONY: build clean
all: build
build: $(BIN_FILE)
lib: $(LIB_FILE)
clean:
@echo "deleted all files"
rm -rf $(BUILD_DIR)
#rm -rf ./lib/librfic.a
#rm -rf ./inc/ucp_api_rfic.h
#rm -rf ./inc/xzJSON.h
#rm -rf $(BUILD_DIR)