Skip to content

Commit

Permalink
Fix #2447, updating cFE to use new versioning system.
Browse files Browse the repository at this point in the history
  • Loading branch information
dzbaker committed Nov 22, 2023
1 parent 0316672 commit 90a2027
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 24 deletions.
2 changes: 1 addition & 1 deletion cmake/target/src/target_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "cfe_es.h"
#include "cfe_time.h"
#include "cfe_es_resetdata_typedef.h"
#include "cfe_version.h" /* for CFE_VERSION_STRING */
#include "cfe_version.h" /* for CFE version information */
#include "osapi-version.h" /* for OS_VERSION_STRING */

#ifndef CFE_CPU_NAME_VALUE
Expand Down
13 changes: 13 additions & 0 deletions modules/config/fsw/src/cfe_config_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,16 @@ void CFE_Config_IterateAll(void *Arg, CFE_Config_Callback_t Callback)
++NamePtr;
}
}

/*----------------------------------------------------------------
*
* Defined per public API
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
void CFE_Config_GetVersionString(char *Buf, int Size, const char *Component, const char *BuildType,
const char *SrcVersion, const char *CodeName, const char *LastOffcRel)
{
snprintf(Buf, Size, "%s %s %s (Codename %s), Last Official Release: %s %s)",
Component, BuildType, SrcVersion, CodeName, Component, LastOffcRel);
}
5 changes: 4 additions & 1 deletion modules/config/fsw/src/cfe_config_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ void CFE_Config_SetupModuleVersions(CFE_ConfigName_t *ModuleListSet[], size_t Se
void CFE_Config_SetupBasicBuildInfo(void)
{
const char *KeyVal;
char VersionString[256];

/* Global mission name */
CFE_Config_SetString(CFE_CONFIGID_MISSION_NAME, GLOBAL_CONFIGDATA.MissionName);
Expand All @@ -184,7 +185,9 @@ void CFE_Config_SetupBasicBuildInfo(void)
CFE_Config_SetValue(CFE_CONFIGID_CORE_VERSION_BUILDNUM, CFE_BUILD_NUMBER);

CFE_Config_SetString(CFE_CONFIGID_CORE_VERSION_BASELINE, CFE_BUILD_BASELINE);
CFE_Config_SetString(CFE_CONFIGID_CORE_VERSION_DESCRIPTION, CFE_VERSION_STRING);
CFE_Config_GetVersionString(VersionString, "cFE", "DEVELOPMENT BUILD",
CFE_SRC_VERSION, "Equuleus", "v6.7.0");
CFE_Config_SetString(CFE_CONFIGID_CORE_VERSION_DESCRIPTION, VersionString);

/*
* Initialize values from the "target_config" CFE internal object
Expand Down
27 changes: 27 additions & 0 deletions modules/core_api/fsw/inc/cfe_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,31 @@ CFE_ConfigId_t CFE_Config_GetIdByName(const char *Name);
*/
void CFE_Config_IterateAll(void *Arg, CFE_Config_Callback_t Callback);

/**
* @brief Obtain the version string for a cFS component or app
*
* Assembles a standardized version string associated with the specified
* component/app.
*
* If the ID is not valid/known, then the implementation returns the
* special string '[unknown]' rather than NULL, so this function may
* be more easily used in printf() style calls.
*
* @param[in] Buf Buffer to place version string in. Will be populated
* with standard version string containing the provided
parameters (i.e.:
* "cFE DEVELOPMENT BUILD equuleus-rc1+dev0 (Codename
equueleus), Last Official Release: cFE 6.7.0"
* @param[in] Size Size of the provided buffer
* @param[in] Component Component for which to get version string
* (i.e. "cFE")
* @param[in] BuildType Type of build (i.e. "DEVELOPMENT BUILD")
* @param[in] SrcVersion Source version identifier (i.e. "equuleus-rc1+dev0")
* @param[in] CodeName Code name for the build (i.e. "equuleus")
* @param[in] LastOffcRel Last official release (i.e. "6.7.0")
*/
void CFE_Config_GetVersionString(char *Buf, int Size,
const char *Component, const char *BuildType, const char *SrcVersion,
const char *CodeName, const char *LastOffcRel);

#endif /* CFE_CONFIG_H */
16 changes: 4 additions & 12 deletions modules/core_api/fsw/inc/cfe_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
#define CFE_VERSION_H

/* Development Build Macro Definitions */
#define CFE_BUILD_NUMBER 405 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_BASELINE "v7.0.0-rc4" /**< @brief Development: Reference git tag for build number */
#define CFE_BUILD_NUMBER 405 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_BASELINE "equuleus-rc1" /**< @brief Development: Reference git tag for build number */
#define CFE_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle */

/* See \ref cfsversions for definitions */
#define CFE_MAJOR_VERSION 6 /*!< @brief Major version number */
Expand All @@ -41,7 +42,7 @@
* cFS open-source development use (pending resolution of nasa/cFS#440)
*
*/
#define CFE_MISSION_REV 0xFF
#define CFE_MISSION_REV 0x00

#define CFE_STR_HELPER(x) #x /**< @brief Convert argument to string */
#define CFE_STR(x) CFE_STR_HELPER(x) /**< @brief Expand macro before conversion */
Expand All @@ -54,13 +55,4 @@
*/
#define CFE_SRC_VERSION CFE_BUILD_BASELINE "+dev" CFE_STR(CFE_BUILD_NUMBER)

/**
* @brief Long Build Version String
*
* Long freeform string identifying the build, see @ref cfsversions for suggested format for development
* and official releases.
*/
#define CFE_VERSION_STRING \
" cFE DEVELOPMENT BUILD " CFE_SRC_VERSION " (Codename: Draco), Last Official Release: cfe v6.7.0"

#endif /* CFE_VERSION_H */
5 changes: 4 additions & 1 deletion modules/es/fsw/src/cfe_es_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ int32 CFE_ES_TaskInit(void)
uint32 SizeofCfeSegment;
cpuaddr CfeSegmentAddr;
uint8 VersionNumber[4];
char VersionString[256];

/*
** Initialize task command execution counters
Expand Down Expand Up @@ -394,8 +395,10 @@ int32 CFE_ES_TaskInit(void)
/*
** Task startup event message.
*/
CFE_Config_GetVersionString(VersionString, "cFE", "DEVELOPMENT BUILD",
CFE_SRC_VERSION, "Equuleus", "v6.7.0");
Status = CFE_EVS_SendEvent(CFE_ES_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE ES Initialized: %s",
CFE_VERSION_STRING);
VersionString);
if (Status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status);
Expand Down
10 changes: 8 additions & 2 deletions modules/evs/fsw/src/cfe_evs_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ int32 CFE_EVS_TaskInit(void)
{
int32 Status;
CFE_ES_AppId_t AppID;
char VersionString[256];

/* Query and verify the AppID */
Status = CFE_ES_GetAppID(&AppID);
Expand Down Expand Up @@ -302,7 +303,9 @@ int32 CFE_EVS_TaskInit(void)

/* Write the AppID to the global location, now that the rest of initialization is done */
CFE_EVS_Global.EVS_AppID = AppID;
EVS_SendEvent(CFE_EVS_STARTUP_EID, CFE_EVS_EventType_INFORMATION, "cFE EVS Initialized: %s", CFE_VERSION_STRING);
CFE_Config_GetVersionString(VersionString, "cFE", "DEVELOPMENT BUILD",
CFE_SRC_VERSION, "Equuleus", "v6.7.0");
EVS_SendEvent(CFE_EVS_STARTUP_EID, CFE_EVS_EventType_INFORMATION, "cFE EVS Initialized: %s", VersionString);

return CFE_SUCCESS;
}
Expand All @@ -315,7 +318,10 @@ int32 CFE_EVS_TaskInit(void)
*-----------------------------------------------------------------*/
int32 CFE_EVS_NoopCmd(const CFE_EVS_NoopCmd_t *data)
{
EVS_SendEvent(CFE_EVS_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING);
char VersionString[256];
CFE_Config_GetVersionString(VersionString, "cFE", "DEVELOPMENT BUILD",
CFE_SRC_VERSION, "Equuleus", "v6.7.0");
EVS_SendEvent(CFE_EVS_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", VersionString);
return CFE_SUCCESS;
}

Expand Down
10 changes: 8 additions & 2 deletions modules/sb/fsw/src/cfe_sb_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ int32 CFE_SB_AppInit(void)
uint32 CfgFileEventsToFilter = 0;
CFE_ES_MemPoolBuf_t TmpPtr;
int32 Status;
char VersionString[256];

/* Get the assigned Application ID for the SB Task */
CFE_ES_GetAppID(&CFE_SB_Global.AppId);
Expand Down Expand Up @@ -266,8 +267,10 @@ int32 CFE_SB_AppInit(void)
return Status;
}

CFE_Config_GetVersionString(VersionString, "cFE", "DEVELOPMENT BUILD",
CFE_SRC_VERSION, "Equuleus", "v6.7.0");
Status =
CFE_EVS_SendEvent(CFE_SB_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE SB Initialized: %s", CFE_VERSION_STRING);
CFE_EVS_SendEvent(CFE_SB_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE SB Initialized: %s", VersionString);
if (Status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status);
Expand All @@ -285,7 +288,10 @@ int32 CFE_SB_AppInit(void)
*-----------------------------------------------------------------*/
int32 CFE_SB_NoopCmd(const CFE_SB_NoopCmd_t *data)
{
CFE_EVS_SendEvent(CFE_SB_CMD0_RCVD_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING);
char VersionString[256];
CFE_Config_GetVersionString(VersionString, "cFE", "DEVELOPMENT BUILD",
CFE_SRC_VERSION, "Equuleus", "v6.7.0");
CFE_EVS_SendEvent(CFE_SB_CMD0_RCVD_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", VersionString);
CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++;

return CFE_SUCCESS;
Expand Down
5 changes: 4 additions & 1 deletion modules/tbl/fsw/src/cfe_tbl_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void CFE_TBL_TaskMain(void)
int32 CFE_TBL_TaskInit(void)
{
int32 Status;
char VersionString[256];

/*
** Initialize global Table Services data
Expand Down Expand Up @@ -162,8 +163,10 @@ int32 CFE_TBL_TaskInit(void)
/*
** Task startup event message
*/
CFE_Config_GetVersionString(VersionString, "cFE", "DEVELOPMENT BUILD",
CFE_SRC_VERSION, "Equuleus", "v6.7.0");
Status = CFE_EVS_SendEvent(CFE_TBL_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE TBL Initialized: %s",
CFE_VERSION_STRING);
VersionString);

if (Status != CFE_SUCCESS)
{
Expand Down
5 changes: 4 additions & 1 deletion modules/tbl/fsw/src/cfe_tbl_task_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,11 @@ void CFE_TBL_GetTblRegData(void)
*-----------------------------------------------------------------*/
int32 CFE_TBL_NoopCmd(const CFE_TBL_NoopCmd_t *data)
{
char VersionString[256];
/* Acknowledge receipt of NOOP with Event Message */
CFE_EVS_SendEvent(CFE_TBL_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING);
CFE_Config_GetVersionString(VersionString, "cFE", "DEVELOPMENT BUILD",
CFE_SRC_VERSION, "Equuleus", "v6.7.0");
CFE_EVS_SendEvent(CFE_TBL_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", VersionString);

return CFE_TBL_INC_CMD_CTR;
}
Expand Down
13 changes: 10 additions & 3 deletions modules/time/fsw/src/cfe_time_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ int32 CFE_TIME_TaskInit(void)
int32 OsStatus;
osal_id_t TimeBaseId;
osal_id_t TimerId;
char VersionString[256];

Status = CFE_EVS_Register(NULL, 0, 0);
if (Status != CFE_SUCCESS)
Expand Down Expand Up @@ -258,9 +259,11 @@ int32 CFE_TIME_TaskInit(void)
CFE_ES_WriteToSysLog("%s: Error subscribing to time task gnd cmds:RC=0x%08X\n", __func__, (unsigned int)Status);
return Status;
}


CFE_Config_GetVersionString(VersionString, "cFE", "DEVELOPMENT BUILD",
CFE_SRC_VERSION, "Equuleus", "v6.7.0");
Status = CFE_EVS_SendEvent(CFE_TIME_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE TIME Initialized: %s",
CFE_VERSION_STRING);
VersionString);
if (Status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status);
Expand Down Expand Up @@ -443,9 +446,13 @@ int32 CFE_TIME_ToneSendCmd(const CFE_TIME_FakeToneCmd_t *data)
*-----------------------------------------------------------------*/
int32 CFE_TIME_NoopCmd(const CFE_TIME_NoopCmd_t *data)
{
char VersionString[256];

CFE_TIME_Global.CommandCounter++;

CFE_EVS_SendEvent(CFE_TIME_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING);
CFE_Config_GetVersionString(VersionString, "cFE", "DEVELOPMENT BUILD",
CFE_SRC_VERSION, "Equuleus", "v6.7.0");
CFE_EVS_SendEvent(CFE_TIME_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", VersionString);

return CFE_SUCCESS;
}
Expand Down

0 comments on commit 90a2027

Please sign in to comment.