From 6bda4966799a26e6b78066fa2743a71f613bd0a0 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 17 May 2024 12:44:20 -0400 Subject: [PATCH 01/10] Fix #2545, migrate TBL, ES, and SB arrays to config list Utilize the compile-time generated list feature of the config module to replace hardcoded lists of items in ES, SB, and TBL. In particular this applies to the ES mempool sizes, SB mempool sizes, and the spacecraft and processor ID lists in TBL. Note that the TBL code was not in accordance with coding standards as it was (by default) compiled out via an #if directive, and thus not being tested as it should be. This fixes that, by removing the conditional compile and always testing the code. --- .../config/tool/cfeconfig_platformdata_tool.c | 2 +- modules/es/fsw/src/cfe_es_cds_mempool.c | 47 +++--- modules/es/fsw/src/cfe_es_generic_pool.c | 6 + modules/es/fsw/src/cfe_es_mempool.c | 45 +++--- modules/es/fsw/src/cfe_es_verify.h | 135 +----------------- modules/es/ut-coverage/es_UT.c | 24 ++++ .../sb/config/default_cfe_sb_internal_cfg.h | 18 ++- modules/sb/fsw/src/cfe_sb_init.c | 22 +-- modules/sb/fsw/src/cfe_sb_verify.h | 64 --------- modules/tbl/fsw/src/cfe_tbl_internal.c | 55 +++---- modules/tbl/fsw/src/cfe_tbl_verify.h | 17 --- modules/tbl/ut-coverage/tbl_UT.c | 52 +++---- 12 files changed, 152 insertions(+), 335 deletions(-) diff --git a/modules/config/tool/cfeconfig_platformdata_tool.c b/modules/config/tool/cfeconfig_platformdata_tool.c index 162b21b09..a07bfd6c7 100644 --- a/modules/config/tool/cfeconfig_platformdata_tool.c +++ b/modules/config/tool/cfeconfig_platformdata_tool.c @@ -289,4 +289,4 @@ int main(int argc, char *argv[]) } return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/modules/es/fsw/src/cfe_es_cds_mempool.c b/modules/es/fsw/src/cfe_es_cds_mempool.c index 884007493..4b95f595b 100644 --- a/modules/es/fsw/src/cfe_es_cds_mempool.c +++ b/modules/es/fsw/src/cfe_es_cds_mempool.c @@ -38,23 +38,7 @@ #include "cfe_es_module_all.h" -/*****************************************************************************/ -/* -** Type Definitions -*/ - -/*****************************************************************************/ -/* -** File Global Data -*/ - -const size_t CFE_ES_CDSMemPoolDefSize[CFE_ES_CDS_NUM_BLOCK_SIZES] = { - CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01}; +#include "cfe_config.h" /*****************************************************************************/ /* @@ -103,27 +87,27 @@ int32 CFE_ES_CDS_PoolCommit(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, size_t Offset *-----------------------------------------------------------------*/ int32 CFE_ES_CreateCDSPool(size_t CDSPoolSize, size_t StartOffset) { - CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - int32 Status; - size_t SizeCheck; - size_t ActualSize; + CFE_ES_CDS_Instance_t * CDS = &CFE_ES_Global.CDSVars; + int32 Status; + size_t SizeCheck; + CFE_Config_ArrayValue_t CDSMemPoolDefSize; - SizeCheck = CFE_ES_GenPoolCalcMinSize(CFE_ES_CDS_NUM_BLOCK_SIZES, CFE_ES_CDSMemPoolDefSize, 1); - ActualSize = CDSPoolSize; + CDSMemPoolDefSize = CFE_Config_GetArrayValue(CFE_CONFIGID_PLATFORM_ES_CDS_MEM_BLOCK_SIZE); + SizeCheck = CFE_ES_GenPoolCalcMinSize(CDSMemPoolDefSize.NumElements, CDSMemPoolDefSize.ElementPtr, 1); - if (ActualSize < SizeCheck) + if (CDSPoolSize < SizeCheck) { /* Must be able make Pool verification, block descriptor and at least one of the smallest blocks */ CFE_ES_SysLogWrite_Unsync("%s: Pool size(%lu) too small for one CDS Block, need >=%lu\n", __func__, - (unsigned long)ActualSize, (unsigned long)SizeCheck); + (unsigned long)CDSPoolSize, (unsigned long)SizeCheck); return CFE_ES_CDS_INVALID_SIZE; } Status = CFE_ES_GenPoolInitialize(&CDS->Pool, StartOffset, /* starting offset */ - ActualSize, /* total size */ + CDSPoolSize, /* total size */ 4, /* alignment */ - CFE_ES_CDS_NUM_BLOCK_SIZES, CFE_ES_CDSMemPoolDefSize, CFE_ES_CDS_PoolRetrieve, - CFE_ES_CDS_PoolCommit); + CDSMemPoolDefSize.NumElements, CDSMemPoolDefSize.ElementPtr, + CFE_ES_CDS_PoolRetrieve, CFE_ES_CDS_PoolCommit); return Status; } @@ -351,9 +335,10 @@ int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle) *-----------------------------------------------------------------*/ size_t CFE_ES_CDSReqdMinSize(uint32 MaxNumBlocksToSupport) { - size_t ReqSize; + CFE_Config_ArrayValue_t CDSMemPoolDefSize; - ReqSize = CFE_ES_GenPoolCalcMinSize(CFE_ES_CDS_NUM_BLOCK_SIZES, CFE_ES_CDSMemPoolDefSize, MaxNumBlocksToSupport); + CDSMemPoolDefSize = CFE_Config_GetArrayValue(CFE_CONFIGID_PLATFORM_ES_CDS_MEM_BLOCK_SIZE); - return ReqSize; + return CFE_ES_GenPoolCalcMinSize(CDSMemPoolDefSize.NumElements, CDSMemPoolDefSize.ElementPtr, + MaxNumBlocksToSupport); } diff --git a/modules/es/fsw/src/cfe_es_generic_pool.c b/modules/es/fsw/src/cfe_es_generic_pool.c index 6f6cbc3bd..fd7bd314f 100644 --- a/modules/es/fsw/src/cfe_es_generic_pool.c +++ b/modules/es/fsw/src/cfe_es_generic_pool.c @@ -240,6 +240,12 @@ int32 CFE_ES_GenPoolInitialize(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t StartO uint32 j; CFE_ES_GenPoolBucket_t *BucketPtr; + if (NumBlockSizes == 0) + { + CFE_ES_WriteToSysLog("%s: cannot create pool with 0 block sizes\n", __func__); + return CFE_ES_BAD_ARGUMENT; + } + /* * Note - being an internal/non-public API this does not need to * check the directly-supplied arguments, it is assumed they are already diff --git a/modules/es/fsw/src/cfe_es_mempool.c b/modules/es/fsw/src/cfe_es_mempool.c index c3856eed6..4d34ae143 100644 --- a/modules/es/fsw/src/cfe_es_mempool.c +++ b/modules/es/fsw/src/cfe_es_mempool.c @@ -33,6 +33,7 @@ ** Includes */ #include "cfe_es_module_all.h" +#include "cfe_config.h" #include #include @@ -53,19 +54,6 @@ } *)0) \ ->Align) -/*****************************************************************************/ -/* -** Type Definitions -*/ - -const size_t CFE_ES_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = { - CFE_PLATFORM_ES_MAX_BLOCK_SIZE, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01}; - /*****************************************************************************/ /* ** Functions @@ -158,7 +146,11 @@ CFE_ES_MemPoolRecord_t *CFE_ES_LocateMemPoolRecordByID(CFE_ES_MemHandle_t PoolID *-----------------------------------------------------------------*/ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size) { - return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, &CFE_ES_MemPoolDefSize[0], + CFE_Config_ArrayValue_t MemPoolDefSize; + + MemPoolDefSize = CFE_Config_GetArrayValue(CFE_CONFIGID_PLATFORM_ES_MEM_BLOCK_SIZE); + + return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, MemPoolDefSize.NumElements, MemPoolDefSize.ElementPtr, CFE_ES_NO_MUTEX); } @@ -170,7 +162,11 @@ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, void *MemPtr, si *-----------------------------------------------------------------*/ CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size) { - return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, &CFE_ES_MemPoolDefSize[0], + CFE_Config_ArrayValue_t MemPoolDefSize; + + MemPoolDefSize = CFE_Config_GetArrayValue(CFE_CONFIGID_PLATFORM_ES_MEM_BLOCK_SIZE); + + return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, MemPoolDefSize.NumElements, MemPoolDefSize.ElementPtr, CFE_ES_USE_MUTEX); } @@ -190,6 +186,7 @@ CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_ size_t Alignment; size_t MinimumSize; char MutexName[OS_MAX_API_NAME]; + CFE_Config_ArrayValue_t MemPoolDefSize; /* Sanity Check inputs */ if (MemPtr == NULL || PoolID == NULL) @@ -198,10 +195,10 @@ CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_ } /* If too many sizes are specified, return an error */ - if (NumBlockSizes > CFE_PLATFORM_ES_POOL_MAX_BUCKETS) + if (NumBlockSizes > CFE_MISSION_ES_POOL_MAX_BUCKETS) { CFE_ES_WriteToSysLog("%s: Num Block Sizes (%d) greater than max (%d)\n", __func__, (int)NumBlockSizes, - CFE_PLATFORM_ES_POOL_MAX_BUCKETS); + CFE_MISSION_ES_POOL_MAX_BUCKETS); return CFE_ES_BAD_ARGUMENT; } @@ -210,10 +207,20 @@ CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_ */ if (BlockSizes == NULL) { - BlockSizes = CFE_ES_MemPoolDefSize; + MemPoolDefSize = CFE_Config_GetArrayValue(CFE_CONFIGID_PLATFORM_ES_MEM_BLOCK_SIZE); + + BlockSizes = MemPoolDefSize.ElementPtr; if (NumBlockSizes == 0) { - NumBlockSizes = CFE_PLATFORM_ES_POOL_MAX_BUCKETS; + NumBlockSizes = MemPoolDefSize.NumElements; + } + + /* If too many sizes are specified, return an error */ + if (NumBlockSizes > MemPoolDefSize.NumElements) + { + CFE_ES_WriteToSysLog("%s: Num Block Sizes (%d) greater than max (%lu)\n", __func__, (int)NumBlockSizes, + (unsigned long)MemPoolDefSize.NumElements); + return CFE_ES_BAD_ARGUMENT; } } diff --git a/modules/es/fsw/src/cfe_es_verify.h b/modules/es/fsw/src/cfe_es_verify.h index d8895ba26..dae790c72 100644 --- a/modules/es/fsw/src/cfe_es_verify.h +++ b/modules/es/fsw/src/cfe_es_verify.h @@ -166,8 +166,8 @@ /* ** Intermediate ES Memory Pool Block Sizes */ -#if CFE_PLATFORM_ES_MAX_BLOCK_SIZE < CFE_MISSION_SB_MAX_SB_MSG_SIZE -#error CFE_PLATFORM_ES_MAX_BLOCK_SIZE must be equal to or larger than CFE_MISSION_SB_MAX_SB_MSG_SIZE! +#if CFE_MISSION_ES_POOL_MAX_BUCKETS < CFE_PLATFORM_ES_POOL_MAX_BUCKETS +#error CFE_MISSION_ES_POOL_MAX_BUCKETS must be equal to or larger than CFE_PLATFORM_ES_POOL_MAX_BUCKETS! #endif #if CFE_PLATFORM_ES_MAX_BLOCK_SIZE < CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE @@ -178,137 +178,6 @@ #error CFE_PLATFORM_ES_MAX_BLOCK_SIZE must be equal to or larger than CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE! #endif -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 -#endif - -#if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 > CFE_PLATFORM_ES_MAX_BLOCK_SIZE -#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 must be less than CFE_PLATFORM_ES_MAX_BLOCK_SIZE -#endif - -/* -** Intermediate ES Critical Data Store Memory Pool Block Sizes -*/ -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 -#endif - -#if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 > CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE -#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 must be less than CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE -#endif - /* ** Validate task stack size... */ diff --git a/modules/es/ut-coverage/es_UT.c b/modules/es/ut-coverage/es_UT.c index 1511de87b..e848a9e3d 100644 --- a/modules/es/ut-coverage/es_UT.c +++ b/modules/es/ut-coverage/es_UT.c @@ -85,6 +85,15 @@ typedef struct CFE_ES_GMP_DirectBuffer_t UT_MemPoolDirectBuffer; CFE_ES_GMP_IndirectBuffer_t UT_MemPoolIndirectBuffer; +/* + * Memory pool block sizes used for unit test + * The platform config values are not used for UT as the test cases + * require certain sizes. A large max block and small min block + * are needed for testing size thresholds when creating pools. + */ +static const size_t UT_MemPoolSizeArray[5] = {131072, 512, 128, 32, 8}; +static const CFE_Config_ArrayValue_t UT_MemPoolAV = {5, UT_MemPoolSizeArray}; + /* Create a startup script buffer for a maximum of 5 lines * 80 chars/line */ char StartupScript[MAX_STARTUP_SCRIPT]; @@ -624,6 +633,12 @@ static int32 ES_UT_SetAppStateHook(void *UserObj, int32 StubRetcode, uint32 Call return StubRetcode; } +static void UT_ArrayConfigHandler(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + CFE_Config_ArrayValue_t Val = *((const CFE_Config_ArrayValue_t *)UserObj); + UT_Stub_SetReturnValue(FuncKey, Val); +} + void UtTest_Setup(void) { UT_Init("es"); @@ -674,10 +689,19 @@ void ES_ResetUnitTest(void) * so it must be re-initialized here every time CFE_ES_Global is reset. */ CFE_ES_Global.ResetDataPtr = ES_UT_PersistentResetData; + + UT_SetHandlerFunction(UT_KEY(CFE_Config_GetArrayValue), UT_ArrayConfigHandler, (void *)&UT_MemPoolAV); + } /* end ES_ResetUnitTest() */ void TestInit(void) { + size_t SizeValue; + CFE_Config_ArrayValue_t UTAV = {1, &SizeValue}; + + SizeValue = 1; + UT_SetHandlerFunction(UT_KEY(CFE_Config_GetArrayValue), UT_ArrayConfigHandler, &UTAV); + UtPrintf("Begin Test Init"); UT_SetCDSSize(128 * 1024); diff --git a/modules/sb/config/default_cfe_sb_internal_cfg.h b/modules/sb/config/default_cfe_sb_internal_cfg.h index ef34dd381..6c1976366 100644 --- a/modules/sb/config/default_cfe_sb_internal_cfg.h +++ b/modules/sb/config/default_cfe_sb_internal_cfg.h @@ -232,6 +232,21 @@ #define CFE_PLATFORM_SB_FILTERED_EVENT8 0 #define CFE_PLATFORM_SB_FILTER_MASK8 CFE_EVS_NO_FILTER +/** +** \cfeescfg Number of block sizes in SB memory pool structure +** +** \par Description: +** The number of block sizes for the software bus memory pool +** +** \par Limits: +** Must be at least one. No specific upper limit, but the number is +** anticipated to be reasonably small (i.e. tens, not hundreds). Large +** values have not been tested. +** +** The SB block size list must correlate with this value +*/ +#define CFE_PLATFORM_SB_POOL_MAX_BUCKETS 17 + /** ** \cfeescfg Define SB Memory Pool Block Sizes ** @@ -240,8 +255,7 @@ ** ** \par Limits ** These sizes MUST be increasing and MUST be an integral multiple of 4. -** The number of block sizes defined cannot exceed -** #CFE_PLATFORM_ES_POOL_MAX_BUCKETS +** The number of block sizes defined should match #CFE_PLATFORM_SB_POOL_MAX_BUCKETS */ #define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 8 #define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 16 diff --git a/modules/sb/fsw/src/cfe_sb_init.c b/modules/sb/fsw/src/cfe_sb_init.c index 2ebaa5dd4..1a3b1bbd3 100644 --- a/modules/sb/fsw/src/cfe_sb_init.c +++ b/modules/sb/fsw/src/cfe_sb_init.c @@ -31,21 +31,10 @@ */ #include "cfe_sb_module_all.h" +#include "cfe_config.h" #include -/* -** External Declarations -*/ - -const size_t CFE_SB_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = { - CFE_PLATFORM_SB_MAX_BLOCK_SIZE, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01}; - /*---------------------------------------------------------------- * * Implemented per public API @@ -99,11 +88,14 @@ int32 CFE_SB_EarlyInit(void) *-----------------------------------------------------------------*/ int32 CFE_SB_InitBuffers(void) { - int32 Stat = 0; + int32 Stat = 0; + CFE_Config_ArrayValue_t MemPoolDefSize; + + MemPoolDefSize = CFE_Config_GetArrayValue(CFE_CONFIGID_PLATFORM_SB_MEM_BLOCK_SIZE); Stat = CFE_ES_PoolCreateEx(&CFE_SB_Global.Mem.PoolHdl, CFE_SB_Global.Mem.Partition.Data, - CFE_PLATFORM_SB_BUF_MEMORY_BYTES, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - &CFE_SB_MemPoolDefSize[0], CFE_ES_NO_MUTEX); + CFE_PLATFORM_SB_BUF_MEMORY_BYTES, MemPoolDefSize.NumElements, MemPoolDefSize.ElementPtr, + CFE_ES_NO_MUTEX); if (Stat != CFE_SUCCESS) { diff --git a/modules/sb/fsw/src/cfe_sb_verify.h b/modules/sb/fsw/src/cfe_sb_verify.h index 7eed2d432..101540d62 100644 --- a/modules/sb/fsw/src/cfe_sb_verify.h +++ b/modules/sb/fsw/src/cfe_sb_verify.h @@ -83,70 +83,6 @@ #error CFE_PLATFORM_SB_MAX_BLOCK_SIZE must be > or = to CFE_MISSION_SB_MAX_SB_MSG_SIZE! #endif -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 -#endif - -#if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 >= CFE_PLATFORM_SB_MAX_BLOCK_SIZE -#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 must be less than CFE_PLATFORM_SB_MAX_BLOCK_SIZE -#endif - #if CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT < 4 #error CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT cannot be less than 4! #endif diff --git a/modules/tbl/fsw/src/cfe_tbl_internal.c b/modules/tbl/fsw/src/cfe_tbl_internal.c index fe736b0df..fc19caad3 100644 --- a/modules/tbl/fsw/src/cfe_tbl_internal.c +++ b/modules/tbl/fsw/src/cfe_tbl_internal.c @@ -31,6 +31,7 @@ ** Required header files... */ #include "cfe_tbl_module_all.h" +#include "cfe_config.h" #include #include @@ -845,16 +846,14 @@ int32 CFE_TBL_ReadHeaders(osal_id_t FileDescriptor, CFE_FS_Header_t *StdFileHead int32 OsStatus; int32 EndianCheck = 0x01020304; -#if (CFE_PLATFORM_TBL_VALID_SCID_COUNT > 0) - static uint32 ListSC[2] = {CFE_PLATFORM_TBL_VALID_SCID_1, CFE_PLATFORM_TBL_VALID_SCID_2}; - uint32 IndexSC; -#endif + const uint32 *ListPtr; + uint32 Idx; -#if (CFE_PLATFORM_TBL_VALID_PRID_COUNT > 0) - static uint32 ListPR[4] = {CFE_PLATFORM_TBL_VALID_PRID_1, CFE_PLATFORM_TBL_VALID_PRID_2, - CFE_PLATFORM_TBL_VALID_PRID_3, CFE_PLATFORM_TBL_VALID_PRID_4}; - uint32 IndexPR; -#endif + CFE_Config_ArrayValue_t ListPR; + CFE_Config_ArrayValue_t ListSC; + + ListSC = CFE_Config_GetArrayValue(CFE_CONFIGID_PLATFORM_TBL_VALID_SCID); + ListPR = CFE_Config_GetArrayValue(CFE_CONFIGID_PLATFORM_TBL_VALID_PRID); /* Once the file is open, read the headers to determine the target Table */ Status = CFE_FS_ReadHeader(StdFileHeaderPtr, FileDescriptor); @@ -927,51 +926,53 @@ int32 CFE_TBL_ReadHeaders(osal_id_t FileDescriptor, CFE_FS_Header_t *StdFileHead */ TblFileHeaderPtr->TableName[sizeof(TblFileHeaderPtr->TableName) - 1] = '\0'; -/* Verify Spacecraft ID contained in table file header [optional] */ -#if (CFE_PLATFORM_TBL_VALID_SCID_COUNT > 0) - if (Status == CFE_SUCCESS) + /* Verify Spacecraft ID contained in table file header [optional] */ + if (Status == CFE_SUCCESS && ListSC.NumElements != 0) { - Status = CFE_TBL_ERR_BAD_SPACECRAFT_ID; - for (IndexSC = 0; IndexSC < CFE_PLATFORM_TBL_VALID_SCID_COUNT; IndexSC++) + ListPtr = ListSC.ElementPtr; + for (Idx = 0; Idx < ListSC.NumElements; ++Idx) { - if (StdFileHeaderPtr->SpacecraftID == ListSC[IndexSC]) + if (StdFileHeaderPtr->SpacecraftID == *ListPtr) { - Status = CFE_SUCCESS; + break; } + + ++ListPtr; } - if (Status == CFE_TBL_ERR_BAD_SPACECRAFT_ID) + if (Idx == ListSC.NumElements) { + Status = CFE_TBL_ERR_BAD_SPACECRAFT_ID; CFE_EVS_SendEventWithAppID(CFE_TBL_SPACECRAFT_ID_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, "Unable to verify Spacecraft ID for '%s', ID = 0x%08X", LoadFilename, (unsigned int)StdFileHeaderPtr->SpacecraftID); } } -#endif -/* Verify Processor ID contained in table file header [optional] */ -#if (CFE_PLATFORM_TBL_VALID_PRID_COUNT > 0) - if (Status == CFE_SUCCESS) + /* Verify Processor ID contained in table file header [optional] */ + if (Status == CFE_SUCCESS && ListPR.NumElements != 0) { - Status = CFE_TBL_ERR_BAD_PROCESSOR_ID; - for (IndexPR = 0; IndexPR < CFE_PLATFORM_TBL_VALID_PRID_COUNT; IndexPR++) + ListPtr = ListPR.ElementPtr; + for (Idx = 0; Idx < ListPR.NumElements; ++Idx) { - if (StdFileHeaderPtr->ProcessorID == ListPR[IndexPR]) + if (StdFileHeaderPtr->ProcessorID == *ListPtr) { - Status = CFE_SUCCESS; + break; } + + ++ListPtr; } - if (Status == CFE_TBL_ERR_BAD_PROCESSOR_ID) + if (Idx == ListPR.NumElements) { + Status = CFE_TBL_ERR_BAD_PROCESSOR_ID; CFE_EVS_SendEventWithAppID(CFE_TBL_PROCESSOR_ID_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, "Unable to verify Processor ID for '%s', ID = 0x%08X", LoadFilename, (unsigned int)StdFileHeaderPtr->ProcessorID); } } -#endif } } } diff --git a/modules/tbl/fsw/src/cfe_tbl_verify.h b/modules/tbl/fsw/src/cfe_tbl_verify.h index ad00f2022..b102afd04 100644 --- a/modules/tbl/fsw/src/cfe_tbl_verify.h +++ b/modules/tbl/fsw/src/cfe_tbl_verify.h @@ -47,23 +47,6 @@ #error CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES cannot be greater than CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES! #endif -/* -** Any modifications to the "_VALID_" limits defined below must match -** source code changes made to the function CFE_TBL_ReadHeaders() in -** the file "cfe_tbl_internal.c". -*/ -#if CFE_PLATFORM_TBL_VALID_SCID_COUNT < 0 -#error CFE_PLATFORM_TBL_VALID_SCID_COUNT must be greater than or equal to zero -#elif CFE_PLATFORM_TBL_VALID_SCID_COUNT > 2 -#error CFE_PLATFORM_TBL_VALID_SCID_COUNT must be less than or equal to 2 -#endif - -#if CFE_PLATFORM_TBL_VALID_PRID_COUNT < 0 -#error CFE_PLATFORM_TBL_VALID_PRID_COUNT must be greater than or equal to zero -#elif CFE_PLATFORM_TBL_VALID_PRID_COUNT > 4 -#error CFE_PLATFORM_TBL_VALID_PRID_COUNT must be less than or equal to 4 -#endif - /* ** Validate task stack size... */ diff --git a/modules/tbl/ut-coverage/tbl_UT.c b/modules/tbl/ut-coverage/tbl_UT.c index 3d245b005..39a487532 100644 --- a/modules/tbl/ut-coverage/tbl_UT.c +++ b/modules/tbl/ut-coverage/tbl_UT.c @@ -38,6 +38,7 @@ */ #include "tbl_UT.h" #include "cfe_core_resourceid_basevalues.h" +#include "cfe_config.h" /* ** External global variables @@ -199,6 +200,12 @@ void UT_TBL_ResetDumpCtrlState(uint32 ArrayIndex) memset(DumpCtrlPtr, 0, sizeof(*DumpCtrlPtr)); } +static void UT_ArrayConfigHandler(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + CFE_Config_ArrayValue_t Val = *((const CFE_Config_ArrayValue_t *)UserObj); + UT_Stub_SetReturnValue(FuncKey, Val); +} + /* ** Functions */ @@ -1242,6 +1249,9 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_LoadCmd_t LoadCmd; CFE_ES_AppId_t AppID; + uint32 IdValue; + CFE_Config_ArrayValue_t UTAV = {1, &IdValue}; + CFE_ES_GetAppID(&AppID); UtPrintf("Begin Test Load Command"); @@ -1254,13 +1264,16 @@ void Test_CFE_TBL_LoadCmd(void) /* Start with a cleared global (no tables registered) */ memset(&CFE_TBL_Global, 0, sizeof(CFE_TBL_Global)); + IdValue = 0x123; + UT_SetHandlerFunction(UT_KEY(CFE_Config_GetArrayValue), UT_ArrayConfigHandler, &UTAV); + /* Set up the headers */ strncpy(StdFileHeader.Description, "FS header description", sizeof(StdFileHeader.Description) - 1); StdFileHeader.Description[sizeof(StdFileHeader.Description) - 1] = '\0'; StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - StdFileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; + StdFileHeader.SpacecraftID = IdValue; + StdFileHeader.ProcessorID = IdValue; /* Test response to inability to open file */ UT_InitData(); @@ -1989,9 +2002,6 @@ void Test_CFE_TBL_Share(void) UtPrintf("Begin Test Share"); - StdFileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; - /* Test response to a null table handle and null table name */ UT_InitData(); UtAssert_INT32_EQ(CFE_TBL_Share(NULL, "ut_cfe_tbl.UT_Table2"), CFE_TBL_BAD_ARGUMENT); @@ -2144,9 +2154,6 @@ void Test_CFE_TBL_Load(void) UtPrintf("Begin Test Load"); - StdFileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; - /* Set up for table load test */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); @@ -3085,9 +3092,6 @@ void Test_CFE_TBL_TblMod(void) UtPrintf("Begin Test Table Modified"); - FileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - FileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; - /* Test adding a TBL API for notifying table services that the table has * been updated by the application */ @@ -3258,12 +3262,14 @@ void Test_CFE_TBL_Internal(void) CFE_TBL_File_Hdr_t TblFileHeader; osal_id_t FileDescriptor; void * TblPtr; + uint32 IdValue; + CFE_Config_ArrayValue_t UTAV = {1, &IdValue}; + + IdValue = 0x123; UtPrintf("Begin Test Internal"); - FileDescriptor = OS_OBJECT_ID_UNDEFINED; - StdFileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; + FileDescriptor = OS_OBJECT_ID_UNDEFINED; /* Test setup - register a double buffered table */ UT_InitData(); @@ -3942,13 +3948,13 @@ void Test_CFE_TBL_Internal(void) UtAssert_INT32_EQ(DumpCtrlPtr->State, CFE_TBL_DUMP_PENDING); CFE_UtAssert_RESOURCEID_EQ(RegRecPtr->OwnerAppId, UT_TBL_APPID_2); -#if (CFE_PLATFORM_TBL_VALID_SCID_COUNT > 0) /* Test CFE_TBL_ReadHeaders response to an invalid spacecraft ID */ UT_InitData(); + UT_SetHandlerFunction(UT_KEY(CFE_Config_GetArrayValue), UT_ArrayConfigHandler, &UTAV); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - StdFileHeader.SpacecraftID = -1; - StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; + StdFileHeader.SpacecraftID = ~IdValue; + StdFileHeader.ProcessorID = IdValue; strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; TblFileHeader.NumBytes = sizeof(UT_Table1_t) - 1; @@ -3968,17 +3974,14 @@ void Test_CFE_TBL_Internal(void) CFE_TBL_ERR_BAD_SPACECRAFT_ID); CFE_UtAssert_EVENTSENT(CFE_TBL_SPACECRAFT_ID_ERR_EID); CFE_UtAssert_EVENTCOUNT(1); -#else - UtAssert_NA("*Not tested* Invalid spacecraft ID "); -#endif -#if (CFE_PLATFORM_TBL_VALID_PRID_COUNT > 0) /* Test CFE_TBL_ReadHeaders response to an invalid processor ID */ UT_InitData(); + UT_SetHandlerFunction(UT_KEY(CFE_Config_GetArrayValue), UT_ArrayConfigHandler, &UTAV); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - StdFileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - StdFileHeader.ProcessorID = -1; + StdFileHeader.SpacecraftID = IdValue; + StdFileHeader.ProcessorID = ~IdValue; strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; TblFileHeader.NumBytes = sizeof(UT_Table1_t) - 1; @@ -3998,9 +4001,6 @@ void Test_CFE_TBL_Internal(void) CFE_TBL_ERR_BAD_PROCESSOR_ID); CFE_UtAssert_EVENTSENT(CFE_TBL_PROCESSOR_ID_ERR_EID); CFE_UtAssert_EVENTCOUNT(1); -#else - UtAssert_NA("*Not tested* Invalid processor ID "); -#endif /* Test CFE_TBL_RestoreTableDataFromCDS() when failed to get a working buffer */ UT_InitData(); From 7e6504d3c87c192707b7f9d873c104f2bc36b47a Mon Sep 17 00:00:00 2001 From: "Jose F. Martinez Pedraza" Date: Wed, 14 Aug 2024 17:09:32 -0400 Subject: [PATCH 02/10] Fix #2590, Use proper printf format for size_t --- modules/sb/fsw/src/cfe_sb_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/sb/fsw/src/cfe_sb_api.c b/modules/sb/fsw/src/cfe_sb_api.c index 2eb3eedee..377179f4e 100644 --- a/modules/sb/fsw/src/cfe_sb_api.c +++ b/modules/sb/fsw/src/cfe_sb_api.c @@ -1398,7 +1398,7 @@ CFE_SB_Buffer_t *CFE_SB_AllocateMessageBuffer(size_t MsgSize) if (MsgSize > CFE_MISSION_SB_MAX_SB_MSG_SIZE) { CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)); - CFE_ES_WriteToSysLog("%s %s: Failed, requested size %ld larger than allowed %d\n", + CFE_ES_WriteToSysLog("%s %s: Failed, requested size %zu larger than allowed %d\n", AppName, __func__, MsgSize, CFE_MISSION_SB_MAX_SB_MSG_SIZE); return NULL; } From 9cf9939dfcada7c373d41273e347b9923d09f06b Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 16 Aug 2024 08:19:05 -0400 Subject: [PATCH 03/10] Updating documentation and version numbers for equuleus-rc1+dev187 --- CHANGELOG.md | 4 ++++ modules/core_api/fsw/inc/cfe_version.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd0fcba12..6b9d8cbbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Development Build: equuleus-rc1+dev187 +- Use proper printf format for size_t +- See + ## Development Build: equuleus-rc1+dev183 - Runtime Error in coverage-es-ALL, TestApps - add config tool for platform-specific settings diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index 578cad7e9..b95d3432a 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -26,7 +26,7 @@ #define CFE_VERSION_H /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 183 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ +#define CFE_BUILD_NUMBER 187 /**< @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 */ #define CFE_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */ From 42c3fbdbcf951e85eff806829ab0604055572ecb Mon Sep 17 00:00:00 2001 From: "Jose F. Martinez Pedraza" Date: Fri, 16 Aug 2024 15:59:52 -0400 Subject: [PATCH 04/10] Fix #2595, Use string append and add newline to avoid using list, which appends an undesired semicolon --- modules/config/tool/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config/tool/CMakeLists.txt b/modules/config/tool/CMakeLists.txt index 491b2bd77..9c74cc586 100644 --- a/modules/config/tool/CMakeLists.txt +++ b/modules/config/tool/CMakeLists.txt @@ -47,7 +47,7 @@ foreach(SYSVAR ${TGTSYS_LIST}) set(PLATFORM_DEFINE_FILE ${MISSION_BINARY_DIR}/src/${OBJLIB_NAME}.c) set(PLATFORM_LIST_FILE ${MISSION_BINARY_DIR}/src/${OBJLIB_NAME}.list) list(APPEND PLATFORM_CONFIG_LIST $) - list(APPEND PLATFORM_OBJ_NAMES "CFE_PLATFORM(${SYSVAR})") + string(APPEND PLATFORM_OBJ_NAMES "CFE_PLATFORM(${SYSVAR})\n") add_custom_command( OUTPUT ${PLATFORM_DEFINE_FILE} From 8826b1f69567fc2a675037f70b70c13f554fd599 Mon Sep 17 00:00:00 2001 From: "Jose F. Martinez Pedraza" Date: Wed, 14 Aug 2024 17:14:31 -0400 Subject: [PATCH 05/10] Fix #2592, Yield cpu to let other task run This avoids the timeout on SB receives for the receiver tasks --- modules/cfe_testcase/src/sb_performance_test.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/cfe_testcase/src/sb_performance_test.c b/modules/cfe_testcase/src/sb_performance_test.c index fc3135543..bbdbe0c64 100644 --- a/modules/cfe_testcase/src/sb_performance_test.c +++ b/modules/cfe_testcase/src/sb_performance_test.c @@ -209,6 +209,9 @@ void RunSingleCmdSendRecv(void) UtAssert_UINT32_EQ(CmdPtr->Payload.Value, CmdMsg.Payload.Value); break; } + + /* Yield cpu to other task with same priority */ + OS_TaskDelay(0); } CFE_PSP_GetTime(&BulkCmd.EndTime); @@ -255,6 +258,9 @@ void RunSingleTlmSendRecv(void) UtAssert_UINT32_EQ(TlmPtr->Payload.Value, TlmMsg.Payload.Value); break; } + + /* Yield cpu to other task with same priority */ + OS_TaskDelay(0); } CFE_PSP_GetTime(&BulkTlm.EndTime); @@ -388,6 +394,9 @@ void UT_CommandTransmitterTask(void) CFE_Assert_STATUS_MUST_BE(CFE_SUCCESS); break; } + + /* Yield cpu to other task with same priority */ + OS_TaskDelay(0); } BulkCmd.XmitFinished = true; @@ -424,6 +433,9 @@ void UT_TelemtryTransmitterTask(void) CFE_Assert_STATUS_MUST_BE(CFE_SUCCESS); break; } + + /* Yield cpu to other task with same priority */ + OS_TaskDelay(0); } BulkTlm.XmitFinished = true; From 9443adb55388dccaf31a239ff380975d70df42a7 Mon Sep 17 00:00:00 2001 From: "Jose F. Martinez Pedraza" Date: Thu, 15 Aug 2024 08:51:06 -0400 Subject: [PATCH 06/10] Fix #2592, typo fix --- modules/cfe_testcase/src/sb_performance_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cfe_testcase/src/sb_performance_test.c b/modules/cfe_testcase/src/sb_performance_test.c index bbdbe0c64..df64dfc25 100644 --- a/modules/cfe_testcase/src/sb_performance_test.c +++ b/modules/cfe_testcase/src/sb_performance_test.c @@ -402,7 +402,7 @@ void UT_CommandTransmitterTask(void) BulkCmd.XmitFinished = true; } -void UT_TelemtryTransmitterTask(void) +void UT_TelemetryTransmitterTask(void) { CFE_SB_Buffer_t * BufPtr; CFE_TEST_TestTlmMessage32_t *TlmMsgPtr; @@ -533,7 +533,7 @@ void TestBulkTransferMulti4(void) CFE_ES_CreateChildTask(&BulkCmd.TaskIdXmit, "CmdXmit", UT_CommandTransmitterTask, NULL, 32768, 150, 0), CFE_SUCCESS); UtAssert_INT32_EQ( - CFE_ES_CreateChildTask(&BulkTlm.TaskIdXmit, "TlmXmit", UT_TelemtryTransmitterTask, NULL, 32768, 150, 0), + CFE_ES_CreateChildTask(&BulkTlm.TaskIdXmit, "TlmXmit", UT_TelemetryTransmitterTask, NULL, 32768, 150, 0), CFE_SUCCESS); UtAssert_INT32_EQ( CFE_ES_CreateChildTask(&BulkCmd.TaskIdRecv, "CmdRecv", UT_CommandReceiverTask, NULL, 32768, 100, 0), From 43ccbe8eee5d7a57189fffb09b2a9d894fab5431 Mon Sep 17 00:00:00 2001 From: "Jose F. Martinez Pedraza" Date: Thu, 29 Aug 2024 13:50:07 -0400 Subject: [PATCH 07/10] Fix #2592, Only yield CPU once every 1024 messages --- .../cfe_testcase/src/sb_performance_test.c | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/modules/cfe_testcase/src/sb_performance_test.c b/modules/cfe_testcase/src/sb_performance_test.c index df64dfc25..bf7f6c159 100644 --- a/modules/cfe_testcase/src/sb_performance_test.c +++ b/modules/cfe_testcase/src/sb_performance_test.c @@ -37,6 +37,9 @@ /* Number of messages to send during test */ uint32_t UT_BulkTestDuration = 1000; +/* Number of SB messages sent before yielding CPU (has to be power of 2 minus 1)*/ +static uint32_t UT_CpuYieldMask = 1024 - 1; + /* State structure for multicore test - shared between threads */ typedef struct UT_BulkMultiCoreSharedState { @@ -210,8 +213,12 @@ void RunSingleCmdSendRecv(void) break; } - /* Yield cpu to other task with same priority */ - OS_TaskDelay(0); + /* Only yield CPU once in a while to avoid slowing down the test with too many context switches */ + if ((BulkCmd.SendCount & UT_CpuYieldMask) == 0) + { + /* Yield cpu to other task with same priority */ + OS_TaskDelay(0); + } } CFE_PSP_GetTime(&BulkCmd.EndTime); @@ -259,8 +266,12 @@ void RunSingleTlmSendRecv(void) break; } - /* Yield cpu to other task with same priority */ - OS_TaskDelay(0); + /* Only yield CPU once in a while to avoid slowing down the test with too many context switches */ + if ((BulkTlm.SendCount & UT_CpuYieldMask) == 0) + { + /* Yield cpu to other task with same priority */ + OS_TaskDelay(0); + } } CFE_PSP_GetTime(&BulkTlm.EndTime); @@ -395,8 +406,12 @@ void UT_CommandTransmitterTask(void) break; } - /* Yield cpu to other task with same priority */ - OS_TaskDelay(0); + /* Only yield CPU once in a while to avoid slowing down the test with too many context switches */ + if ((BulkCmd.SendCount & UT_CpuYieldMask) == 0) + { + /* Yield cpu to other task with same priority */ + OS_TaskDelay(0); + } } BulkCmd.XmitFinished = true; @@ -434,8 +449,12 @@ void UT_TelemetryTransmitterTask(void) break; } - /* Yield cpu to other task with same priority */ - OS_TaskDelay(0); + /* Only yield CPU once in a while to avoid slowing down the test with too many context switches */ + if ((BulkTlm.SendCount & UT_CpuYieldMask) == 0) + { + /* Yield cpu to other task with same priority */ + OS_TaskDelay(0); + } } BulkTlm.XmitFinished = true; From b4f7f71351aa93d3f0d4fa5fd74be0db306d241f Mon Sep 17 00:00:00 2001 From: Dylan Date: Thu, 29 Aug 2024 15:25:01 -0400 Subject: [PATCH 08/10] Updating documentation and version numbers for equuleus-rc1+dev195 --- CHANGELOG.md | 5 +++++ modules/core_api/fsw/inc/cfe_version.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b9d8cbbe..940d56e3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Development Build: equuleus-rc1+dev195 +- Use string append and add newline +- Yield cpu to other tasks in SB Perf Test +- See and + ## Development Build: equuleus-rc1+dev187 - Use proper printf format for size_t - See diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index b95d3432a..e9070e3b3 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -26,7 +26,7 @@ #define CFE_VERSION_H /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 187 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ +#define CFE_BUILD_NUMBER 195 /**< @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 */ #define CFE_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */ From 9353379cd7e87b263f22f40bcab21c27b477ea3d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 22:11:35 +0000 Subject: [PATCH 09/10] Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.1.7. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v3...v4.1.7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .github/workflows/build-documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index 2f319de62..c0c152c94 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -80,7 +80,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4.1.7 - name: Display structure of downloaded files run: ls -R From f9de14dc16e4b1a9a20b697652228b151bce89fc Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 16 Sep 2024 14:25:18 -0400 Subject: [PATCH 10/10] Updating documentation and version numbers for equuleus-rc1+dev199 --- CHANGELOG.md | 4 ++++ modules/core_api/fsw/inc/cfe_version.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 940d56e3c..1fd77ed32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Development Build: equuleus-rc1+dev199 +- Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows +- See + ## Development Build: equuleus-rc1+dev195 - Use string append and add newline - Yield cpu to other tasks in SB Perf Test diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index e9070e3b3..7e8c293da 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -26,7 +26,7 @@ #define CFE_VERSION_H /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 195 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ +#define CFE_BUILD_NUMBER 199 /**< @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 */ #define CFE_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */