Skip to content

Commit

Permalink
Resolve #770, Add baseline and build number to version.h
Browse files Browse the repository at this point in the history
Update Version Numbers description to remove statement on Revision number increases with development build
Add description for build name and build number.

Add buildnumber macro
Add CFE_VERSION, OSAL_VERSION, and CFE_PSP_VERSION macros
Add CFE_VERSION_STRING macro
Add CFS_VERSIONS macro
Check for osal and psp version definitions

Use new version string in event messages

Use new macros in evs and tbl startup events
  • Loading branch information
astrogeco authored and Gerardo E. Cruz-Ortiz committed Jul 15, 2020
1 parent 1039f28 commit 1a4ab35
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 39 deletions.
41 changes: 30 additions & 11 deletions fsw/cfe-core/src/es/cfe_es_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,19 @@ int32 CFE_ES_TaskInit(void)
return(Status);
}

Status = CFE_EVS_SendEvent(CFE_ES_INITSTATS_INF_EID,
CFE_EVS_EventType_INFORMATION,
"Versions:cFE %d.%d.%d.%d, OSAL %d.%d.%d.%d, PSP %d.%d.%d.%d, chksm %d",
CFE_MAJOR_VERSION,CFE_MINOR_VERSION,CFE_REVISION,CFE_MISSION_REV,
OS_MAJOR_VERSION,OS_MINOR_VERSION,OS_REVISION,OS_MISSION_REV,
CFE_PSP_MAJOR_VERSION,CFE_PSP_MINOR_VERSION,CFE_PSP_REVISION,CFE_PSP_MISSION_REV,
(int)CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum);
#ifdef CFE_ENABLE_EXPERIMENTS
Status = CFE_EVS_SendEvent(CFE_ES_INITSTATS_INF_EID, CFE_EVS_EventType_INFORMATION,
"\n%s\n cFE chksm %d",
CFS_VERSIONS, (int)CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum);

#else /* CFE_ENABLE_EXPERIMENTS */
Status = CFE_EVS_SendEvent(CFE_ES_INITSTATS_INF_EID, CFE_EVS_EventType_INFORMATION,
"\ncFS Versions:\n cFE %s\n OSAL %d.%d.%d.%d\n PSP %d.%d.%d.%d\n cFE chksm %d",
CFE_VERSION, OS_MAJOR_VERSION, OS_MINOR_VERSION, OS_REVISION, OS_MISSION_REV,
CFE_PSP_MAJOR_VERSION, CFE_PSP_MINOR_VERSION, CFE_PSP_REVISION, CFE_PSP_MISSION_REV,
(int)CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum);
#endif /* CFE_ENABLE_EXPERIMENTS */

if ( Status != CFE_SUCCESS )
{
CFE_ES_WriteToSysLog("ES:Error sending version event:RC=0x%08X\n", (unsigned int)Status);
Expand Down Expand Up @@ -788,11 +794,24 @@ int32 CFE_ES_NoopCmd(const CFE_ES_Noop_t *Cmd)
** This command will always succeed.
*/
CFE_ES_TaskData.CommandCounter++;


#ifdef CFE_ENABLE_EXPERIMENTS

CFE_EVS_SendEvent(CFE_ES_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION,
"No-op command:\n %s",
CFS_VERSIONS);

#else /* CFE_ENABLE_EXPERIMENTS */

CFE_EVS_SendEvent(CFE_ES_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION,
"No-op command. Versions:cFE %d.%d.%d.%d, OSAL %d.%d.%d.%d, PSP %d.%d.%d.%d",
CFE_MAJOR_VERSION,CFE_MINOR_VERSION,CFE_REVISION,CFE_MISSION_REV,
OS_MAJOR_VERSION,OS_MINOR_VERSION,OS_REVISION,OS_MISSION_REV,
CFE_PSP_MAJOR_VERSION,CFE_PSP_MINOR_VERSION,CFE_PSP_REVISION,CFE_PSP_MISSION_REV);
"No-op command.\ncFS Versions:\n cFE %s\n OSAL %d.%d.%d.%d\n PSP %d.%d.%d.%d",
CFE_VERSION,
OS_MAJOR_VERSION, OS_MINOR_VERSION, OS_REVISION,
OS_MISSION_REV, CFE_PSP_MAJOR_VERSION, CFE_PSP_MINOR_VERSION, CFE_PSP_REVISION,
CFE_PSP_MISSION_REV);

#endif /* CFE_ENABLE_EXPERIMENTS */

return CFE_SUCCESS;
} /* End of CFE_ES_NoopCmd() */
Expand Down
3 changes: 1 addition & 2 deletions fsw/cfe-core/src/evs/cfe_evs_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,7 @@ int32 CFE_EVS_TaskInit ( void )

/* Write the AppID to the global location, now that the rest of initialization is done */
CFE_EVS_GlobalData.EVS_AppID = AppID;
EVS_SendEvent(CFE_EVS_STARTUP_EID, CFE_EVS_EventType_INFORMATION, "cFE EVS Initialized. cFE Version %d.%d.%d.%d",
CFE_MAJOR_VERSION,CFE_MINOR_VERSION,CFE_REVISION,CFE_MISSION_REV);
EVS_SendEvent(CFE_EVS_STARTUP_EID, CFE_EVS_EventType_INFORMATION, "cFE EVS Initialized.\n%s", CFE_VERSION_STRING);

return CFE_SUCCESS;

Expand Down
113 changes: 89 additions & 24 deletions fsw/cfe-core/src/inc/cfe_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,42 @@
*/

/*
** File: cfe_version.h
**
** Purpose:
** Provide version identifiers for the cFE core.
*/
* File: cfe_version.h
*
* Purpose:
* Provide version identifiers for the cFE core.
*/

/**
/*
* \page cfeversion Version Numbers
*
* <H2> Version Number Semantics </H2>
*
* The version number is a sequence of four numbers, generally separated by dots when written. These are, in order,
* the Major number, the Minor number, the Implementation Revision number, and the Mission Revision number. At
* the Major number, the Minor number, the Revision number, and the Mission Revision number. At
* their option, Missions may modify the Mission Revision information as needed to suit their needs.
*
* The Major number shall be incremented on release to indicate when there is a change to an API
* that may cause existing correctly-written cFS components to stop working. It may also be incremented for a
* It is important to note that Major, Minor, and Revision numbers are only updated upon official releases of tagged
* versions, \b NOT on development builds.
*
* The MAJOR number shall be incremented on release to indicate when there is a change to an API
* that may cause existing, correctly-written cFS components to stop working. It may also be incremented for a
* release that contains changes deemed to be of similar impact, even if there are no actual changes to the API.
*
* The Minor number shall be incremented on release to indicate the addition of features to the API,
* The MINOR number shall be incremented on release to indicate the addition of features to the API
* which do not break the existing code. It may also be incremented for a release that contains changes deemed
* to be of similar impact, even if there are no actual updates to the API.
*
* The Implementation Revision Version number shall be incremented on changes to software in the master branch,
* or other changes that benefit from unique identification. It is used for identifying open source development
* versions. It is important to note that Major and Minor numbers are only updated upon official releases
* of tagged versions (see the release tab), \b NOT on development version updates in the master branch.
* The REVISION number shall be incremented on changes that benefit from unique identification such as bug fixes or
* major documentation updates. The Revision number may also be updated if there are other changes contained within a
* release that make it desirable for applications to distinguish one release from another.
*
* The Major, Minor, and Implementation Revision numbers are provided in this header file as part of the API
* The Major, Minor, and Revision numbers are provided in this header file as part of the API
* definition; this macro must expand to a simple integer value, so that it can be used in simple if directives
* by the macro preprocessor.
*
* The Mission Version number shall be set to zero in all officially released packages, and is entirely reserved
* for the use of the mission. The Mission Version is provided as a simple macro defined in the cfe_platform_cfg.h
* for the use of the mission. The Mission Version is provided as a simple macro defined in the cfe_platform_cfg.h
* header file.
*
* <H2> Version Number Flexibility </H2>
Expand All @@ -63,20 +65,29 @@
* The minor number may increment when there have been no augmentations to the API, if changes are as significant as
* additions to the public API.
*
* The revision numbers may update in implementations where no actual implementation-specific code has changed, if
* The revision numbers may increment in implementations where no actual implementation-specific code has changed, if
* there are other changes within the release with similar significance.
*
* <H2> How and Where Defined </H2>
*
* The Major, Minor, and Revision components of the version are provided as simple macros defined in the cfe_version.h
* header file as part of the API definition; these macros must expand to simple integer values, so that they can be used
* in simple if directives by the macro preprocessor.
* header file as part of the API definition; these macros must expand to simple integer values, so that they can be
* used in simple if directives by the macro preprocessor.
*
* The Mission Version is provided as a simple macro defined in the cfe_platform_cfg.h header file. As delivered in
* official releases, these macros must expand to simple integer values, so that they can be used in simple macro
* preprocessor conditions, but delivered code should not prevent a mission from, for example, deciding that the Mission
* Version is actually a text string.
*
* <H2> Identification of development builds </H2>
*
* In order to distinguish between development versions, we also provide a BUILDNUMBER.
*
* The BUILDNUMBER reflects the number of commits since a specified baseline git tag for each particular component. The
* BUILDNUMBER integer increases monotonically for a given development cycle. The development cycle can be identified by
* the git tag baseline in the CFE_VERSION macro, which looks like vX.Y.Z+dev, or by the codename in the version string.
* When a new baseline tag and codename are created, the the BUILDNUMBER resets to zero and begins increasing from that
* new epoch.
*/

#ifndef _cfe_version_
Expand All @@ -90,12 +101,66 @@
#include <target_config.h>


#define CFE_STR_HELPER(x) #x
#define CFE_STR(x) CFE_STR_HELPER(x)


#define CFE_BUILDNUMBER 295 /* Number of commits since baseline */


#define CFE_VERSION "v6.7.0+dev" CFE_STR(CFE_BUILDNUMBER) /* Baseling git tag + Number of commits since baseline */

#define CFE_VERSION_STRING /* Used to report the full version */ \
" cFE Development Build\n " \
CFE_VERSION " (Codename: Bootes)" /* Codename for current development */ \
"\n Last Offical Release: cfe v6.7.0" /* For full support please use this version */

/*
** Macro Definitions
* Macro Definitions
* ONLY APPLY for OFFICIAL releases
*/
#define CFE_MAJOR_VERSION 6 /**< @brief Major version number */
#define CFE_MINOR_VERSION 7 /**< @brief Minor version number */
#define CFE_REVISION 0 /**< @brief Revision number */
#define CFE_MISSION_REV 0 /**< @brief Mission revision */

/* Keep this here to use as the string for official releases
// #define CFE_VERSION \
// CFE_STR(CFE_MAJOR_VERSION) "." \
// CFE_STR(CFE_MINOR_VERSION) "." \
// CFE_STR(CFE_REVISION) "." \
// CFE_STR(CFE_MISSION_REV)
//
// #define CFE_VERSION_STRING "cFE version " CFE_VERSION
*/

/* Component Version Definitions */
/* Here for backwards compatibility for integration test
*/
#define CFE_MAJOR_VERSION 6
#define CFE_MINOR_VERSION 7
#define CFE_REVISION 21

#ifndef OS_VERSION /* This will be defined by osal in the future */
#define OS_VERSION \
CFE_STR(OS_MAJOR_VERSION) "." \
CFE_STR(OS_MINOR_VERSION) "." \
CFE_STR(OS_REVISION) "." \
CFE_STR(OS_MISSION_REV)
#endif

#ifndef CFE_PSP_VERSION /* This will be defined by psp in the future */
#define CFE_PSP_VERSION \
CFE_STR(CFE_PSP_MAJOR_VERSION) "." \
CFE_STR(CFE_PSP_MINOR_VERSION) "." \
CFE_STR(CFE_PSP_REVISION) "." \
CFE_STR(CFE_PSP_MISSION_REV)
#endif

/* Combined string with formated combination of all major component versions */
/* Keeping as a conditional definition in case we move this into the build system */
#define CFS_VERSIONS \
"cFS Development Version (Codename: Bootes)\n" \
" cfe: " CFE_VERSION "\n" \
" osal: " OS_VERSION "\n" \
" psp: " CFE_PSP_VERSION


#endif /* _cfe_version_ */
#endif /* _cfe_version_ */
3 changes: 1 addition & 2 deletions fsw/cfe-core/src/tbl/cfe_tbl_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ int32 CFE_TBL_TaskInit(void)
/*
** Task startup event message
*/
Status = CFE_EVS_SendEvent(CFE_TBL_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE TBL Initialized. cFE Version %d.%d.%d.%d",
CFE_MAJOR_VERSION,CFE_MINOR_VERSION,CFE_REVISION,CFE_MISSION_REV);
Status = CFE_EVS_SendEvent(CFE_TBL_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE TBL Initialized.\n%s", CFE_VERSION_STRING);

if(Status != CFE_SUCCESS)
{
Expand Down

0 comments on commit 1a4ab35

Please sign in to comment.