Skip to content

Commit

Permalink
Merge pull request nasa#891 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
Integration Candidate: 2020-09-16
  • Loading branch information
yammajamma authored Sep 22, 2020
2 parents 60917a2 + 6d97ddd commit 983157d
Show file tree
Hide file tree
Showing 12 changed files with 361 additions and 179 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

### Development Build: 6.8.0-rc1+dev91

- Sets Revision to 99 for development build.
- Installs unit test to target directory.
- Returns processor ID to default to unbreak toolchain
- Applies the appid/taskid/counterid pattern to Library resources.
- See <https://github.com/nasa/cFE/pull/891>

### Development Build: 6.8.0-rc1+dev81

- Deconflict CFE_ES_LIB_ALREADY_LOADED and CFE_ES_ERR_SYS_LOG_TRUNCATED EIDs
Expand Down
8 changes: 4 additions & 4 deletions cmake/sample_defs/targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ SET(FT_INSTALL_SUBDIR "host/functional-test")
# Each target board can have its own HW arch selection and set of included apps
SET(MISSION_CPUNAMES cpu1)

SET(cpu1_PROCESSORID 10)
SET(cpu1_PROCESSORID 1)
SET(cpu1_APPLIST ci_lab to_lab sch_lab)
SET(cpu1_FILELIST cfe_es_startup.scr)

# CPU2/3 are duplicates of CPU1. These are not built by default anymore but are
# commented out to serve as an example of how one would configure multiple cpus.
SET(cpu2_PROCESSORID 11)
# CPU2 example. This is not built by default anymore but
# serves as an example of how one would configure multiple cpus.
SET(cpu2_PROCESSORID 2)
SET(cpu2_APPLIST ci_lab to_lab sch_lab)
SET(cpu2_FILELIST cfe_es_startup.scr)

78 changes: 40 additions & 38 deletions docs/src/cfs_versions.dox
Original file line number Diff line number Diff line change
@@ -1,94 +1,96 @@
/**
\page cfsversions 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 Revision number, and the Mission Revision number. Missions may modify the Mission Revision information as needed to suit their needs.

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. We aim to follow the Semantic Versioning v2.0 specification with our versioning.

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
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 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 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.
WARNING: The revision number is set to the number 99 in development builds. To distinguish between development builds refer to the BUILD_NUMBER and BUILD_BASELINE detailed in the section "Identifying Development Builds".

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 header file.

<H2> Version Number Flexibility </H2>

The major number may increment when there is no breaking change to the API, if the changes are significant enough to
warrant the same level of attention as a breaking API change.

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 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.

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.

<H2> Identifying Development Builds </H2>

In order to distinguish between development versions, we also provide a BUILD_NUMBER.

The BUILD_NUMBER reflects the number of commits since the BUILD_BASELINE, a baseline git tag, for each particular
component. The BUILD_NUMBER integer increases monotonically for a given development cycle. The BUILD_BASELINE identifies the current development cycle and is a git tag with format vX.Y.Z. The Codename used in the version string also refers to the current development cycle. When a new baseline tag and codename are created, the the BUILD_NUMBER resets to zero and begins increasing
from a new baseline.

<H2> Templates for the version and version string </H2>

The following templates are the code to be used in cfe_version.h for either official releases or development builds. The apps and repositories follow the same pattern by replacing the CFE_ prefix with the appropriate name; for example, osal uses OS_, psp uses CFE_PSP_IMPL, and so on.

<H3> Template for Official Releases </H3>

\verbatim

/*<! Official Release Version Number */
#define CFE_SRC_VERSION \
/*<! Official Release Version Number */
#define CFE_SRC_VERSION \
CFE_STR(CFE_MAJOR_VERSION) "." \
CFE_STR(CFE_MINOR_VERSION) "." \
CFE_STR(CFE_REVISION) "." \
CFE_STR(CFE_MISSION_REV)
CFE_STR(CFE_MISSION_REV)

#define CFE_VERSION_STRING \
"cFE version " CFE_SRC_VERSION

\endverbatim

<H3> Template for Development Builds </H3>

\verbatim

/*! @brief Development Build Version Number.
/*! @brief Development Build Version Number.
* Baseline git tag + Number of commits since baseline. @n
* See cfs_versions.dox for format differences between development and release versions.
*/
#define CFE_SRC_VERSION \
CFE_BUILD_BASELINE CFE_STR(CFE_BUILD_NUMBER)
#define CFE_SRC_VERSION \
CFE_BUILD_BASELINE CFE_STR(CFE_BUILD_NUMBER)

/*! @brief Development Build Version String.
/*! @brief Development Build Version String.
* Reports the current development build's baseline, number, and name. Also includes a note about the latest official version. @n
* See cfs_versions.dox for format differences between development and release versions.
*/
* See cfs_versions.dox for format differences between development and release versions.
*/
#define CFE_VERSION_STRING \
" cFE Development Build " \
CFE_SRC_VERSION " (Codename: CONSTELLATION_NAME)" /* Codename for current development */ \
", Last Official Release: cfe vX.Y.Z" /* For full support please use this version */

\endverbatim

**/
37 changes: 37 additions & 0 deletions fsw/cfe-core/src/es/cfe_es_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,25 @@ int32 CFE_ES_AppID_ToIndex(uint32 AppId, uint32 *Idx)
return CFE_SUCCESS;
}

/*
* A conversion function to obtain an index value correlating to a LibID
* This is a zero based value that can be used for indexing into a table.
*/
int32 CFE_ES_LibID_ToIndex(uint32 LibId, uint32 *Idx)
{
if (LibId >= CFE_PLATFORM_ES_MAX_LIBRARIES)
{
return CFE_ES_BAD_ARGUMENT; /* these do not have a dedicated error */
}

/*
* Currently this is a direct/simple pass through.
* Will evolve in a future rev to make it more safe.
*/
*Idx = LibId;
return CFE_SUCCESS;
}

/*
* A conversion function to obtain an index value correlating to an TaskID
* This is a zero based value that can be used for indexing into a table.
Expand Down Expand Up @@ -1777,6 +1796,24 @@ CFE_ES_AppRecord_t *CFE_ES_LocateAppRecordByID(uint32 AppID)
return AppRecPtr;
}

extern CFE_ES_LibRecord_t* CFE_ES_LocateLibRecordByID(uint32 LibID)
{
CFE_ES_LibRecord_t *LibRecPtr;
uint32 Idx;

if (CFE_ES_LibID_ToIndex(LibID, &Idx) == CFE_SUCCESS)
{
LibRecPtr = &CFE_ES_Global.LibTable[Idx];
}
else
{
LibRecPtr = NULL;
}

return LibRecPtr;
}


/*
* Note - this gets the table entry pointer but does not dereference or
* otherwise check/validate said pointer, as that would have to be done while
Expand Down
33 changes: 20 additions & 13 deletions fsw/cfe-core/src/es/cfe_es_apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,8 @@ int32 CFE_ES_LoadLibrary(uint32 *LibraryIdPtr,
CFE_ES_LibRecord_t * LibSlotPtr;
size_t StringLength;
int32 Status;
uint32 CheckSlot;
uint32 LibIndex;
uint32 PendingLibId;
osal_id_t ModuleId;
bool IsModuleLoaded;

Expand All @@ -576,7 +577,7 @@ int32 CFE_ES_LoadLibrary(uint32 *LibraryIdPtr,
* (currently sized to OS_MAX_API_NAME, but not assuming that will always be)
*/
StringLength = strlen(LibName);
if (StringLength >= sizeof(CFE_ES_Global.LibTable[0].LibName))
if (StringLength >= sizeof(LibSlotPtr->LibName))
{
return CFE_ES_BAD_ARGUMENT;
}
Expand All @@ -585,16 +586,17 @@ int32 CFE_ES_LoadLibrary(uint32 *LibraryIdPtr,
** Allocate an ES_LibTable entry
*/
IsModuleLoaded = false;
LibSlotPtr = NULL;
FunctionPointer = NULL;
ModuleId = OS_OBJECT_ID_UNDEFINED;
PendingLibId = 0xFFFFFFFF;
Status = CFE_ES_ERR_LOAD_LIB; /* error that will be returned if no slots found */
CFE_ES_LockSharedData(__func__,__LINE__);
for ( CheckSlot = 0; CheckSlot < CFE_PLATFORM_ES_MAX_LIBRARIES; CheckSlot++ )
LibSlotPtr = CFE_ES_Global.LibTable;
for ( LibIndex = 0; LibIndex < CFE_PLATFORM_ES_MAX_LIBRARIES; ++LibIndex )
{
if (CFE_ES_Global.LibTable[CheckSlot].RecordUsed)
if (CFE_ES_LibRecordIsUsed(LibSlotPtr))
{
if (strcmp(CFE_ES_Global.LibTable[CheckSlot].LibName, LibName) == 0)
if (strcmp(LibSlotPtr->LibName, LibName) == 0)
{
/*
* Indicate to caller that the library is already loaded.
Expand All @@ -603,29 +605,34 @@ int32 CFE_ES_LoadLibrary(uint32 *LibraryIdPtr,
* Do nothing more; not logging this event as it may or may
* not be an error.
*/
*LibraryIdPtr = CheckSlot;
*LibraryIdPtr = CFE_ES_LibRecordGetID(LibSlotPtr);
Status = CFE_ES_LIB_ALREADY_LOADED;
break;
}
}
else if (LibSlotPtr == NULL)
else if (PendingLibId == 0xFFFFFFFF)
{
/* Remember list position as possible place for new entry. */
LibSlotPtr = &CFE_ES_Global.LibTable[CheckSlot];
*LibraryIdPtr = CheckSlot;
PendingLibId = LibIndex;
Status = CFE_SUCCESS;
}
else
{
/* No action */
}

++LibSlotPtr;
}

if (Status == CFE_SUCCESS)
{
/* reset back to the saved index that was free */
LibSlotPtr = CFE_ES_LocateLibRecordByID(PendingLibId);

/* reserve the slot while still under lock */
strcpy(LibSlotPtr->LibName, LibName);
LibSlotPtr->RecordUsed = true;
CFE_ES_LibRecordSetUsed(LibSlotPtr, PendingLibId);
*LibraryIdPtr = PendingLibId;
}

CFE_ES_UnlockSharedData(__func__,__LINE__);
Expand Down Expand Up @@ -761,8 +768,8 @@ int32 CFE_ES_LoadLibrary(uint32 *LibraryIdPtr,
OS_ModuleUnload( ModuleId );
}

/* Release Slot - No need to lock as it is resetting just a single bool value */
LibSlotPtr->RecordUsed = false;
/* Release Slot - No need to lock as it is resetting just a single value */
CFE_ES_LibRecordSetFree(LibSlotPtr);
}

return(Status);
Expand Down
Loading

0 comments on commit 983157d

Please sign in to comment.