添加获取版本信息接口
This commit is contained in:
parent
bded57a7c1
commit
1fefa69eef
7
build.sh
7
build.sh
@ -15,6 +15,9 @@ cache_option="no"
|
|||||||
test_option="no"
|
test_option="no"
|
||||||
case_id=0
|
case_id=0
|
||||||
board_option="EVB"
|
board_option="EVB"
|
||||||
|
arm_version=`git log -1 --format="%H"`
|
||||||
|
arm_tag=`git tag | sed -n '$p'`
|
||||||
|
arm_build_date=`date +"%Y-%m-%d-%H:%M:%S"`
|
||||||
|
|
||||||
while [[ "$#" > 0 ]]; do
|
while [[ "$#" > 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
@ -39,6 +42,10 @@ while [[ "$#" > 0 ]]; do
|
|||||||
*) variants+=" $1"; shift;;
|
*) variants+=" $1"; shift;;
|
||||||
esac;
|
esac;
|
||||||
done
|
done
|
||||||
|
export arm_version=${arm_version}
|
||||||
|
export arm_tag=${arm_tag}
|
||||||
|
export arm_build_date=${arm_build_date}
|
||||||
|
printf "#arm_version[%s], arm_tag[%s], arm_build_date:[%s]\n" $arm_version $arm_tag $arm_build_date
|
||||||
|
|
||||||
export DIR_ROOT=$(cd `dirname "$0"`;pwd)
|
export DIR_ROOT=$(cd `dirname "$0"`;pwd)
|
||||||
#echo "# script_dir:${DIR_ROOT}"
|
#echo "# script_dir:${DIR_ROOT}"
|
||||||
|
39
interface/ospVersion.h
Normal file
39
interface/ospVersion.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#ifndef __OSPVERSION__
|
||||||
|
#define __OSPVERSION__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAX_BUF_VERSION_LEN (128)
|
||||||
|
|
||||||
|
typedef struct OspVersionInfo {
|
||||||
|
char platform_commit[MAX_BUF_VERSION_LEN];
|
||||||
|
char platform_tag[MAX_BUF_VERSION_LEN];
|
||||||
|
char platform_build_date[MAX_BUF_VERSION_LEN/2];
|
||||||
|
} OspVersionInfo_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief: 将ARM、SPU侧版本信息print至终端
|
||||||
|
* @Date: 2024.05.17
|
||||||
|
* @param: void
|
||||||
|
* @ret: void
|
||||||
|
*/
|
||||||
|
void osp_soft_version_show();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief: 获取ARM侧的版本信息
|
||||||
|
* @Date: 2024.05.17
|
||||||
|
* @param: pVersion [out]: 版本信息结构体指针
|
||||||
|
* @ret: 0-success, 1-error
|
||||||
|
*/
|
||||||
|
int32_t osp_arm_version_get(OspVersionInfo_t *pVersion);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __OSPVERSION__ */
|
||||||
|
|
||||||
|
|
4
makefile
4
makefile
@ -23,6 +23,10 @@ CC = $(CROSS_CC)gcc
|
|||||||
DEFINES ?=
|
DEFINES ?=
|
||||||
#DEFINES ?= UBLOX_ENABLE
|
#DEFINES ?= UBLOX_ENABLE
|
||||||
|
|
||||||
|
DEFINES += ARM_VERSION=\"${arm_version}\"
|
||||||
|
DEFINES += ARM_TAG=\"${arm_tag}\"
|
||||||
|
DEFINES += ARM_BUILD_DATE=\"${arm_build_date}\"
|
||||||
|
|
||||||
ifeq ($(fronthaul_option),jesd)
|
ifeq ($(fronthaul_option),jesd)
|
||||||
DEFINES += ENABLE_JESD_TEST
|
DEFINES += ENABLE_JESD_TEST
|
||||||
endif
|
endif
|
||||||
|
39
osp/inc/ospVersion.h
Normal file
39
osp/inc/ospVersion.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#ifndef __OSPVERSION__
|
||||||
|
#define __OSPVERSION__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAX_BUF_VERSION_LEN (128)
|
||||||
|
|
||||||
|
typedef struct OspVersionInfo {
|
||||||
|
char platform_commit[MAX_BUF_VERSION_LEN];
|
||||||
|
char platform_tag[MAX_BUF_VERSION_LEN];
|
||||||
|
char platform_build_date[MAX_BUF_VERSION_LEN/2];
|
||||||
|
} OspVersionInfo_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief: 将ARM、SPU侧版本信息print至终端
|
||||||
|
* @Date: 2024.05.17
|
||||||
|
* @param: void
|
||||||
|
* @ret: void
|
||||||
|
*/
|
||||||
|
void osp_soft_version_show();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief: 获取ARM侧的版本信息
|
||||||
|
* @Date: 2024.05.17
|
||||||
|
* @param: pVersion [out]: 版本信息结构体指针
|
||||||
|
* @ret: 0-success, 1-error
|
||||||
|
*/
|
||||||
|
int32_t osp_arm_version_get(OspVersionInfo_t *pVersion);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __OSPVERSION__ */
|
||||||
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
|||||||
#include "pet_sm_mgt.h"
|
#include "pet_sm_mgt.h"
|
||||||
#include "msg_transfer_layer.h"
|
#include "msg_transfer_layer.h"
|
||||||
#include "ospHeartbeat.h"
|
#include "ospHeartbeat.h"
|
||||||
|
#include "ospVersion.h"
|
||||||
|
|
||||||
|
|
||||||
#define MAX_CMD_LEN (150) /*the max length of a shell command */
|
#define MAX_CMD_LEN (150) /*the max length of a shell command */
|
||||||
@ -97,6 +98,7 @@ OSP_CMD_RTN ospCmdRtnTbl[MAX_CMD_NUM] =
|
|||||||
{"hb", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)get_heartbeat_status, "test heartbeat", 0},
|
{"hb", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)get_heartbeat_status, "test heartbeat", 0},
|
||||||
{"apecmd", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_ape_cmd_show, "show ape register cmd", 0},
|
{"apecmd", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_ape_cmd_show, "show ape register cmd", 0},
|
||||||
{"armcmd", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_arm_cmd_show, "show arm register cmd", 0},
|
{"armcmd", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_arm_cmd_show, "show arm register cmd", 0},
|
||||||
|
{"version", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_soft_version_show, "show soft version info", 0},
|
||||||
//{"level_ape", (OSP_FUNCPTR)osp_shell_wrapper,(OSP_FUNCPTR)osp_ape_set_log_level, "set ape log level", 1},
|
//{"level_ape", (OSP_FUNCPTR)osp_shell_wrapper,(OSP_FUNCPTR)osp_ape_set_log_level, "set ape log level", 1},
|
||||||
//{"csu_stop_ape", (OSP_FUNCPTR)osp_shell_wrapper,(OSP_FUNCPTR)osp_ape_csu_stop_cfg, "set csu start or stop", 2},
|
//{"csu_stop_ape", (OSP_FUNCPTR)osp_shell_wrapper,(OSP_FUNCPTR)osp_ape_csu_stop_cfg, "set csu start or stop", 2},
|
||||||
//{"i_ape", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_ape_taskinfo, "show ape task info", 0},
|
//{"i_ape", (OSP_FUNCPTR)osp_shell_wrapper, (OSP_FUNCPTR)osp_show_ape_taskinfo, "show ape task info", 0},
|
||||||
@ -207,8 +209,9 @@ void help(void)
|
|||||||
{
|
{
|
||||||
if (ospApeCmdRtnTbl[i].cmd[0] != 0)
|
if (ospApeCmdRtnTbl[i].cmd[0] != 0)
|
||||||
{
|
{
|
||||||
|
if (strcmp(ospApeCmdRtnTbl[i].cmd, "ver_spu") != 0) {
|
||||||
len += sprintf(buf + len, "%-16s%s\n", ospApeCmdRtnTbl[i].cmd, ospApeCmdRtnTbl[i].descption);
|
len += sprintf(buf + len, "%-16s%s\n", ospApeCmdRtnTbl[i].cmd, ospApeCmdRtnTbl[i].descption);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1430,7 +1433,6 @@ void osp_arm_cmd_show()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void osp_cmd_insert_proc(Osp_Ape_Msg_Head *pMsg)
|
void osp_cmd_insert_proc(Osp_Ape_Msg_Head *pMsg)
|
||||||
{
|
{
|
||||||
|
66
osp/src/ospVersion.c
Normal file
66
osp/src/ospVersion.c
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include "osp.h"
|
||||||
|
#include "ospShell.h"
|
||||||
|
#include "ospDbg.h"
|
||||||
|
#include "ospSoftQue.h"
|
||||||
|
#include "ospBuf.h"
|
||||||
|
#include "ospTimer.h"
|
||||||
|
#include "ospHeap.h"
|
||||||
|
#include "ospTypes.h"
|
||||||
|
#include "ucp_printf.h"
|
||||||
|
#include "ospHeap.h"
|
||||||
|
#include "ospDump.h"
|
||||||
|
#include "ospSwQueue.h"
|
||||||
|
#include "pet_sm_mgt.h"
|
||||||
|
#include "msg_transfer_layer.h"
|
||||||
|
#include "ospHeartbeat.h"
|
||||||
|
#include "ospVersion.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* print软件版本信息 */
|
||||||
|
void osp_soft_version_show()
|
||||||
|
{
|
||||||
|
char buf[4096];
|
||||||
|
int32_t len = 0;
|
||||||
|
|
||||||
|
/* show arm version */
|
||||||
|
len = sprintf(buf, "\n\r[ARM]\n\rVersion:\t%s\n\rTag:\t\t%s\n\rBuild Date:\t%s\n\r", ARM_VERSION, ARM_TAG, ARM_BUILD_DATE);
|
||||||
|
osp_net_shell_out(buf, len);
|
||||||
|
|
||||||
|
/* show spuversion */
|
||||||
|
osp_ape_msg_send("ver_spu");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief: 获取ARM版本信息
|
||||||
|
* @author: haochen.zhang
|
||||||
|
* @Date: 2024.5.14
|
||||||
|
* @param: pVersion [out] : 版本信息结构体
|
||||||
|
*/
|
||||||
|
int32_t osp_arm_version_get(OspVersionInfo_t *pVersion)
|
||||||
|
{
|
||||||
|
if (NULL == pVersion) {
|
||||||
|
return OSP_PAR_ILL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sizeof(ARM_VERSION) > MAX_BUF_VERSION_LEN) || (sizeof(ARM_TAG) > MAX_BUF_VERSION_LEN) || (sizeof(ARM_BUILD_DATE) > MAX_BUF_VERSION_LEN/2)) {
|
||||||
|
return OSP_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy((void *)&pVersion->platform_commit, (void *)ARM_VERSION, sizeof(ARM_VERSION));
|
||||||
|
memcpy((void *)&pVersion->platform_tag, (void *)ARM_TAG, sizeof(ARM_TAG));
|
||||||
|
memcpy((void *)&pVersion->platform_build_date, (void *)ARM_BUILD_DATE, sizeof(ARM_BUILD_DATE));
|
||||||
|
|
||||||
|
return OSP_OK;
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user