diff --git a/modules/cfe_assert/inc/cfe_assert.h b/modules/cfe_assert/inc/cfe_assert.h index 52faa6d9d..082b0872e 100644 --- a/modules/cfe_assert/inc/cfe_assert.h +++ b/modules/cfe_assert/inc/cfe_assert.h @@ -110,21 +110,6 @@ typedef void (*CFE_Assert_StatusCallback_t)(uint8 MessageType, const char *Prefi #define CFE_Assert_RESOURCEID_UNDEFINED(id) \ UtAssert_True(!CFE_RESOURCEID_TEST_DEFINED(id), "%s (0x%lx) not defined", #id, CFE_RESOURCEID_TO_ULONG(id)) -/*****************************************************************************/ -/** -** \brief Macro to check CFE memory size/offset for equality -** -** \par Description -** A macro that checks two memory offset/size values for equality. -** -** \par Assumptions, External Events, and Notes: -** This is a simple unsigned comparison which logs the values as hexadecimal -** -******************************************************************************/ -#define CFE_Assert_MEMOFFSET_EQ(off1, off2) \ - UtAssert_GenericUnsignedCompare(off1, UtAssert_Compare_EQ, off2, UtAssert_Radix_HEX, __FILE__, __LINE__, \ - "Offset Check: ", #off1, #off2) - /*****************************************************************************/ /** ** \brief Macro to check CFE message ID for equality diff --git a/modules/cfe_testcase/src/es_info_test.c b/modules/cfe_testcase/src/es_info_test.c index c51f94cd9..020c7fb7a 100644 --- a/modules/cfe_testcase/src/es_info_test.c +++ b/modules/cfe_testcase/src/es_info_test.c @@ -70,24 +70,17 @@ void TestGetAppInfo(void) TestAppInfo.FileName); UtAssert_True(strlen(ESAppInfo.FileName) == 0, "ES App Info -> FileName = %s", ESAppInfo.FileName); - UtAssert_True(TestAppInfo.StackSize > 0, "Test App Info -> StackSz = %d", (int)TestAppInfo.StackSize); - UtAssert_True(ESAppInfo.StackSize > 0, "ES App Info -> StackSz = %d", (int)ESAppInfo.StackSize); + UtAssert_NONZERO(CFE_ES_MEMOFFSET_TO_SIZET(TestAppInfo.StackSize)); + UtAssert_NONZERO(CFE_ES_MEMOFFSET_TO_SIZET(ESAppInfo.StackSize)); if (TestAppInfo.AddressesAreValid) { - UtAssert_True(TestAppInfo.AddressesAreValid > 0, "Test App Info -> AddrsValid? = %d", - (int)TestAppInfo.AddressesAreValid); - UtAssert_True(TestAppInfo.CodeAddress > 0, "Test App Info -> CodeAddress = %ld", - (unsigned long)TestAppInfo.CodeAddress); - UtAssert_True(TestAppInfo.CodeSize > 0, "Test App Info -> CodeSize = %ld", - (unsigned long)TestAppInfo.CodeSize); - UtAssert_True(TestAppInfo.DataAddress > 0, "Test App Info -> DataAddress = %ld", - (unsigned long)TestAppInfo.DataAddress); - UtAssert_True(TestAppInfo.DataSize > 0, "Test App Info -> DataSize = %ld", - (unsigned long)TestAppInfo.DataSize); - UtAssert_True(TestAppInfo.BSSAddress > 0, "Test App Info -> BSSAddress = %ld", - (unsigned long)TestAppInfo.BSSAddress); - UtAssert_True(TestAppInfo.BSSSize > 0, "Test App Info -> BSSSize = %ld", (unsigned long)TestAppInfo.BSSSize); + UtAssert_NOT_NULL(CFE_ES_MEMADDRESS_TO_PTR(TestAppInfo.CodeAddress)); + UtAssert_NONZERO(CFE_ES_MEMOFFSET_TO_SIZET(TestAppInfo.CodeSize)); + UtAssert_NOT_NULL(CFE_ES_MEMADDRESS_TO_PTR(TestAppInfo.DataAddress)); + UtAssert_NONZERO(CFE_ES_MEMOFFSET_TO_SIZET(TestAppInfo.DataSize)); + UtAssert_NOT_NULL(CFE_ES_MEMADDRESS_TO_PTR(TestAppInfo.BSSAddress)); + UtAssert_NONZERO(CFE_ES_MEMOFFSET_TO_SIZET(TestAppInfo.BSSSize)); } else { @@ -102,10 +95,8 @@ void TestGetAppInfo(void) UtAssert_True(ESAppInfo.AddressesAreValid == 0, "ES App Info -> AddrsValid? = %d", (int)ESAppInfo.AddressesAreValid); - UtAssert_True(TestAppInfo.StartAddress > 0, "Test App Info -> StartAddress = 0x%8lx", - (unsigned long)TestAppInfo.StartAddress); - UtAssert_True(ESAppInfo.StartAddress == 0, "ES App Info -> StartAddress = 0x%8lx", - (unsigned long)ESAppInfo.StartAddress); + UtAssert_NOT_NULL(CFE_ES_MEMADDRESS_TO_PTR(TestAppInfo.StartAddress)); + UtAssert_NULL(CFE_ES_MEMADDRESS_TO_PTR(ESAppInfo.StartAddress)); UtAssert_INT32_EQ(TestAppInfo.ExceptionAction, 0); UtAssert_INT32_EQ(ESAppInfo.ExceptionAction, 1); @@ -180,18 +171,17 @@ void TestGetLibInfo(void) UtAssert_StrCmp(LibInfo.EntryPoint, "CFE_Assert_LibInit", "Lib Info -> EntryPt = %s", LibInfo.EntryPoint); UtAssert_True(strstr(LibInfo.FileName, FileName) != NULL, "Lib Info -> FileName = %s contains %s", LibInfo.FileName, FileName); - UtAssert_True(LibInfo.StackSize == 0, "Lib Info -> StackSz = %d", (int)LibInfo.StackSize); + + UtAssert_ZERO(CFE_ES_MEMOFFSET_TO_SIZET(LibInfo.StackSize)); if (LibInfo.AddressesAreValid) { - UtAssert_True(LibInfo.AddressesAreValid > 0, "Lib Info -> AddrsValid? = %ld", - (unsigned long)LibInfo.AddressesAreValid); - UtAssert_True(LibInfo.CodeAddress > 0, "Lib Info -> CodeAddress = %ld", (unsigned long)LibInfo.CodeAddress); - UtAssert_True(LibInfo.CodeSize > 0, "Lib Info -> CodeSize = %ld", (unsigned long)LibInfo.CodeSize); - UtAssert_True(LibInfo.DataAddress > 0, "Lib Info -> DataAddress = %ld", (unsigned long)LibInfo.DataAddress); - UtAssert_True(LibInfo.DataSize > 0, "Lib Info -> DataSize = %ld", (unsigned long)LibInfo.DataSize); - UtAssert_True(LibInfo.BSSAddress > 0, "Lib Info -> BSSAddress = %ld", (unsigned long)LibInfo.BSSAddress); - UtAssert_True(LibInfo.BSSSize > 0, "Lib Info -> BSSSize = %ld", (unsigned long)LibInfo.BSSSize); + UtAssert_NOT_NULL(CFE_ES_MEMADDRESS_TO_PTR(LibInfo.CodeAddress)); + UtAssert_NONZERO(CFE_ES_MEMOFFSET_TO_SIZET(LibInfo.CodeSize)); + UtAssert_NOT_NULL(CFE_ES_MEMADDRESS_TO_PTR(LibInfo.DataAddress)); + UtAssert_NONZERO(CFE_ES_MEMOFFSET_TO_SIZET(LibInfo.DataSize)); + UtAssert_NOT_NULL(CFE_ES_MEMADDRESS_TO_PTR(LibInfo.BSSAddress)); + UtAssert_NONZERO(CFE_ES_MEMOFFSET_TO_SIZET(LibInfo.BSSSize)); } else { diff --git a/modules/cfe_testcase/src/es_mempool_test.c b/modules/cfe_testcase/src/es_mempool_test.c index a1e7a0f8e..9878cb998 100644 --- a/modules/cfe_testcase/src/es_mempool_test.c +++ b/modules/cfe_testcase/src/es_mempool_test.c @@ -185,10 +185,10 @@ void TestMemPoolDelete(void) UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, Buffer, sizeof(Buffer), 0, NULL, CFE_ES_NO_MUTEX), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_ES_GetMemPoolStats(&Stats, PoolID), CFE_SUCCESS); - UtAssert_UINT32_EQ(Stats.PoolSize, sizeof(Buffer)); + UtAssert_EQ(size_t, CFE_ES_MEMOFFSET_TO_SIZET(Stats.PoolSize), sizeof(Buffer)); UtAssert_UINT32_EQ(Stats.NumBlocksRequested, 0); UtAssert_UINT32_EQ(Stats.CheckErrCtr, 0); - UtAssert_UINT32_EQ(Stats.NumFreeBytes, sizeof(Buffer)); + UtAssert_EQ(size_t, CFE_ES_MEMOFFSET_TO_SIZET(Stats.NumFreeBytes), sizeof(Buffer)); UtAssert_INT32_EQ(CFE_ES_GetMemPoolStats(NULL, PoolID), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetMemPoolStats(&Stats, CFE_ES_MEMHANDLE_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID); diff --git a/modules/cfe_testcase/src/tbl_content_mang_test.c b/modules/cfe_testcase/src/tbl_content_mang_test.c index 5609f2f4b..ec1135980 100644 --- a/modules/cfe_testcase/src/tbl_content_mang_test.c +++ b/modules/cfe_testcase/src/tbl_content_mang_test.c @@ -248,22 +248,23 @@ void TestModified(void) UtAssert_INT32_EQ(CFE_TBL_Modified(CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE); } -/* Helper function to set a CFE_ES_MemOffset_t value (must be big-endian) */ -void TblTest_UpdateOffset(CFE_ES_MemOffset_t *TgtVal, CFE_ES_MemOffset_t SetVal) +/* Helper function to set a 32-bit table offset value (must be big-endian) */ +void TblTest_UpdateOffset(uint32 *TgtVal, size_t SetVal) { + size_t i; union { - CFE_ES_MemOffset_t offset; - uint8 bytes[sizeof(CFE_ES_MemOffset_t)]; + uint32 offset; + uint8 bytes[sizeof(uint32)]; } offsetbuf; - offsetbuf.bytes[3] = SetVal & 0xFF; - SetVal >>= 8; - offsetbuf.bytes[2] = SetVal & 0xFF; - SetVal >>= 8; - offsetbuf.bytes[1] = SetVal & 0xFF; - SetVal >>= 8; - offsetbuf.bytes[0] = SetVal & 0xFF; + i = sizeof(offsetbuf.bytes); + while (i > 0) + { + --i; + offsetbuf.bytes[i] = SetVal & 0xFF; + SetVal >>= 8; + } *TgtVal = offsetbuf.offset; } diff --git a/modules/core_api/eds/base_types.xml b/modules/core_api/eds/base_types.xml index 009375352..bbbe7b158 100644 --- a/modules/core_api/eds/base_types.xml +++ b/modules/core_api/eds/base_types.xml @@ -102,6 +102,34 @@ + + + + For backward compatibility with existing CFS code this should be uint32, + but all telemetry information will be limited to 4GB in size as a result. + + On 64-bit platforms this can be expanded to 64 bits which will allow larger + memory objects, but this will break compatibility with existing control + systems, and may also change the alignment/padding of some messages. + + In either case this must be an unsigned type, and should be large enough + to represent the largest memory address/size in use in the CFS system. + + + + + + + diff --git a/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h b/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h index 638e6cc88..f30f381e8 100644 --- a/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h @@ -381,11 +381,21 @@ typedef uint16 CFE_ES_TaskPriority_Atom_t; */ typedef uint32 CFE_ES_MemOffset_t; -/* +/** + * @brief Memory Offset initializer wrapper + * * A converter macro to use when initializing a CFE_ES_MemOffset_t * from an integer value of a different type. */ -#define CFE_ES_MEMOFFSET_C(x) ((CFE_ES_MemOffset_t)(x)) +#define CFE_ES_MEMOFFSET_C(x) ((CFE_ES_MemOffset_t)(x)) + +/** + * @brief Memory Offset to integer value (size_t) wrapper + * + * A converter macro to use when interpreting a CFE_ES_MemOffset_t + * value as a "size_t" type + */ +#define CFE_ES_MEMOFFSET_TO_SIZET(x) ((size_t)(x)) /** * @brief Type used for memory addresses in command and telemetry messages @@ -408,15 +418,21 @@ typedef uint32 CFE_ES_MemOffset_t; */ typedef uint32 CFE_ES_MemAddress_t; -/* +/** + * @brief Memory Address initializer wrapper + * * A converter macro to use when initializing a CFE_ES_MemAddress_t * from a pointer value of a different type. + */ +#define CFE_ES_MEMADDRESS_C(x) ((CFE_ES_MemAddress_t)((cpuaddr)(x)&0xFFFFFFFF)) + +/** + * @brief Memory Address to pointer wrapper * - * @note on a 64 bit platform, this macro will truncate the address such - * that it will fit into a 32-bit telemetry field. Obviously, the resulting - * value is no longer usable as a memory address after this. + * A converter macro to use when interpreting a CFE_ES_MemAddress_t + * as a pointer value. */ -#define CFE_ES_MEMADDRESS_C(x) ((CFE_ES_MemAddress_t)((cpuaddr)(x)&0xFFFFFFFF)) +#define CFE_ES_MEMADDRESS_TO_PTR(x) ((void *)(cpuaddr)(x)) /* * Data Structures shared between API and Message (CMD/TLM) interfaces diff --git a/modules/core_api/fsw/inc/cfe_tbl_extern_typedefs.h b/modules/core_api/fsw/inc/cfe_tbl_extern_typedefs.h index 60a813dff..f8fcbcfc5 100644 --- a/modules/core_api/fsw/inc/cfe_tbl_extern_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_tbl_extern_typedefs.h @@ -66,13 +66,17 @@ typedef uint16 CFE_TBL_BufferSelect_Enum_t; * @brief The definition of the header fields that are included in CFE Table Data files. * * This header follows the CFE_FS header and precedes the actual table data. + * + * @note The Offset and NumBytes fields in the table header are to 32 bits for + * backward compatibility with existing CFE versions. This means that even on + * 64-bit CPUs, individual table files will be limited to 4GiB in size. */ typedef struct CFE_TBL_File_Hdr { - uint32 Reserved; /**< Future Use: NumTblSegments in File? */ - CFE_ES_MemOffset_t Offset; /**< Byte Offset at which load should commence */ - CFE_ES_MemOffset_t NumBytes; /**< Number of bytes to load into table */ - char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< Fully qualified name of table to load */ + uint32 Reserved; /**< Future Use: NumTblSegments in File? */ + uint32 Offset; /**< Byte Offset at which load should commence */ + uint32 NumBytes; /**< Number of bytes to load into table */ + char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< Fully qualified name of table to load */ } CFE_TBL_File_Hdr_t; #endif /* CFE_EDS_ENABLED_BUILD */ diff --git a/modules/core_private/ut-stubs/inc/ut_support.h b/modules/core_private/ut-stubs/inc/ut_support.h index 32caf1d63..4bd7d9a86 100644 --- a/modules/core_private/ut-stubs/inc/ut_support.h +++ b/modules/core_private/ut-stubs/inc/ut_support.h @@ -753,21 +753,6 @@ bool CFE_UtAssert_MessageCheck_Impl(bool Status, const char *File, uint32 Line, UtAssert_GenericUnsignedCompare(CFE_RESOURCEID_TO_ULONG(id1), UtAssert_Compare_EQ, CFE_RESOURCEID_TO_ULONG(id2), \ UtAssert_Radix_HEX, __FILE__, __LINE__, "Resource ID Check: ", #id1, #id2) -/*****************************************************************************/ -/** -** \brief Macro to check CFE memory size/offset for equality -** -** \par Description -** A macro that checks two memory offset/size values for equality. -** -** \par Assumptions, External Events, and Notes: -** This is a simple unsigned comparison which logs the values as hexadecimal -** -******************************************************************************/ -#define CFE_UtAssert_MEMOFFSET_EQ(off1, off2) \ - UtAssert_GenericUnsignedCompare(off1, UtAssert_Compare_EQ, off2, UtAssert_Radix_HEX, __FILE__, __LINE__, \ - "Offset Check: ", #off1, #off2) - /*****************************************************************************/ /** ** \brief Macro to check CFE message ID for equality diff --git a/modules/es/eds/cfe_es.xml b/modules/es/eds/cfe_es.xml index 0832cb034..8548c4f3c 100644 --- a/modules/es/eds/cfe_es.xml +++ b/modules/es/eds/cfe_es.xml @@ -165,7 +165,7 @@ - + For backward compatibility with existing CFE code this should be uint32, but all telemetry information will be limited to 4GB in size as a result. @@ -176,13 +176,12 @@ In either case this must be an unsigned type. - - - - - + + + + - + For backward compatibility with existing CFE code this should be uint32, but if running on a 64-bit platform, addresses in telemetry will be @@ -200,11 +199,10 @@ provides independence between the message representation and local representation of a memory address. - - - - - + + + + @@ -246,7 +244,7 @@ \cfetlmmnemonic \ES_APPFILENAME - + \cfetlmmnemonic \ES_STACKSIZE @@ -353,7 +351,7 @@ - + @@ -432,7 +430,7 @@ - + \brief #CFE_ES_ExceptionAction_RESTART_APP=On exception, restart Application, @@ -632,12 +630,12 @@ \cfetlmmnemonic \ES_PSPMISSIONREV - + \cfetlmmnemonic \ES_SYSLOGBYTEUSED - + \cfetlmmnemonic \ES_SYSLOGSIZE @@ -752,17 +750,17 @@ \cfetlmmnemonic \ES_PERFDATA2WRITE - + \cfetlmmnemonic \ES_HEAPBYTESFREE - + \cfetlmmnemonic \ES_HEAPBLKSFREE - + \cfetlmmnemonic \ES_HEAPMAXBLK diff --git a/modules/es/fsw/src/cfe_es_api.c b/modules/es/fsw/src/cfe_es_api.c index 2a9c2b8a1..2992581f9 100644 --- a/modules/es/fsw/src/cfe_es_api.c +++ b/modules/es/fsw/src/cfe_es_api.c @@ -1044,7 +1044,7 @@ CFE_Status_t CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_AppId_t AppId) strncpy(AppInfo->MainTaskName, TaskRecPtr->TaskName, sizeof(AppInfo->MainTaskName) - 1); AppInfo->MainTaskName[sizeof(AppInfo->MainTaskName) - 1] = '\0'; - AppInfo->StackSize = TaskRecPtr->StartParams.StackSize; + AppInfo->StackSize = CFE_ES_MEMOFFSET_C(TaskRecPtr->StartParams.StackSize); AppInfo->Priority = TaskRecPtr->StartParams.Priority; } else @@ -1213,7 +1213,7 @@ CFE_Status_t CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t Tas ** Get the other stats for the task */ TaskInfo->ExecutionCounter = TaskRecPtr->ExecutionCounter; - TaskInfo->StackSize = TaskRecPtr->StartParams.StackSize; + TaskInfo->StackSize = CFE_ES_MEMOFFSET_C(TaskRecPtr->StartParams.StackSize); TaskInfo->Priority = TaskRecPtr->StartParams.Priority; /* diff --git a/modules/es/fsw/src/cfe_es_mempool.c b/modules/es/fsw/src/cfe_es_mempool.c index 6d75ff86f..c3856eed6 100644 --- a/modules/es/fsw/src/cfe_es_mempool.c +++ b/modules/es/fsw/src/cfe_es_mempool.c @@ -697,7 +697,8 @@ bool CFE_ES_ValidateHandle(CFE_ES_MemHandle_t Handle) /* Test #3) Check memory address in PSP (allows both RAM and EEPROM) */ CFE_ES_GenPoolGetUsage(&PoolRecPtr->Pool, NULL, &TotalSize); - if (CFE_PSP_MemValidateRange(PoolRecPtr->BaseAddr, TotalSize, CFE_PSP_MEM_ANY) != CFE_PSP_SUCCESS) + if (CFE_PSP_MemValidateRange(PoolRecPtr->BaseAddr, CFE_ES_MEMOFFSET_TO_SIZET(TotalSize), CFE_PSP_MEM_ANY) != + CFE_PSP_SUCCESS) { return false; } diff --git a/modules/es/fsw/src/cfe_es_task.c b/modules/es/fsw/src/cfe_es_task.c index d31700d59..0219f7c25 100644 --- a/modules/es/fsw/src/cfe_es_task.c +++ b/modules/es/fsw/src/cfe_es_task.c @@ -744,9 +744,9 @@ int32 CFE_ES_HousekeepingCmd(const CFE_ES_SendHkCmd_t *data) } else { - CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree = 0; - CFE_ES_Global.TaskData.HkPacket.Payload.HeapBlocksFree = 0; - CFE_ES_Global.TaskData.HkPacket.Payload.HeapMaxBlockSize = 0; + CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree = CFE_ES_MEMOFFSET_C(0); + CFE_ES_Global.TaskData.HkPacket.Payload.HeapBlocksFree = CFE_ES_MEMOFFSET_C(0); + CFE_ES_Global.TaskData.HkPacket.Payload.HeapMaxBlockSize = CFE_ES_MEMOFFSET_C(0); } /* @@ -900,14 +900,11 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_t *data) else { /* If stack size was provided, use it, otherwise use default. */ - if (cmd->StackSize == 0) + StartParams.MainTaskInfo.StackSize = CFE_ES_MEMOFFSET_TO_SIZET(cmd->StackSize); + if (StartParams.MainTaskInfo.StackSize == 0) { StartParams.MainTaskInfo.StackSize = CFE_PLATFORM_ES_DEFAULT_STACK_SIZE; } - else - { - StartParams.MainTaskInfo.StackSize = cmd->StackSize; - } StartParams.MainTaskInfo.Priority = cmd->Priority; StartParams.ExceptionAction = cmd->ExceptionAction; diff --git a/modules/es/ut-coverage/es_UT.c b/modules/es/ut-coverage/es_UT.c index f59480b46..68ae5b4e4 100644 --- a/modules/es/ut-coverage/es_UT.c +++ b/modules/es/ut-coverage/es_UT.c @@ -2109,7 +2109,7 @@ void TestERLog(void) UT_SetDeferredRetcode(UT_KEY(CFE_PSP_Exception_CopyContext), 1, 128); UtAssert_BOOL_FALSE(CFE_ES_BackgroundERLogFileDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); - CFE_UtAssert_MEMOFFSET_EQ(State.EntryBuffer.ContextSize, 128); + UtAssert_UINT32_EQ(State.EntryBuffer.ContextSize, 128); UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); @@ -2208,7 +2208,7 @@ void TestGenericPool(void) /* Free a buffer and attempt to reallocate */ CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2)); - CFE_UtAssert_MEMOFFSET_EQ(BlockSize, 72); + UtAssert_EQ(size_t, BlockSize, 72); /* Should not be able to free more than once */ /* This should increment the validation error count */ @@ -2217,7 +2217,7 @@ void TestGenericPool(void) UtAssert_NONZERO(Pool1.ValidationErrorCount); CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset4, 100)); - CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset2); + UtAssert_EQ(size_t, Offset4, Offset2); /* Attempt Bigger than the largest bucket */ UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 1000), CFE_ES_ERR_MEM_BLOCK_SIZE); @@ -2235,9 +2235,9 @@ void TestGenericPool(void) UtAssert_VOIDCALL(CFE_ES_GenPoolGetBucketUsage(&Pool1, Pool1.NumBuckets + 1, &BlockStats)); /* Check various outputs to ensure correctness */ - CFE_UtAssert_MEMOFFSET_EQ(TotalSize, OffsetEnd); + UtAssert_EQ(size_t, CFE_ES_MEMOFFSET_TO_SIZET(TotalSize), OffsetEnd); UtAssert_UINT32_EQ(CountBuf, 3); - UtAssert_NONZERO(FreeSize); + UtAssert_NONZERO(CFE_ES_MEMOFFSET_TO_SIZET(FreeSize)); /* put blocks so the pool has a mixture of allocated and deallocated blocks */ CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset1)); @@ -2251,7 +2251,7 @@ void TestGenericPool(void) CFE_UtAssert_SUCCESS(CFE_ES_GenPoolRebuild(&Pool2)); /* After rebuilding, Pool2 should have similar state data to Pool1. */ - CFE_UtAssert_MEMOFFSET_EQ(Pool1.TailPosition, Pool2.TailPosition); + UtAssert_EQ(size_t, Pool1.TailPosition, Pool2.TailPosition); UtAssert_UINT32_EQ(Pool1.AllocationCount, Pool2.AllocationCount); for (i = 0; i < Pool1.NumBuckets; ++i) @@ -2270,10 +2270,10 @@ void TestGenericPool(void) /* Get blocks again, from the recovered pool, to demonstrate that * the pool is functional after recovery. */ CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 44)); - CFE_UtAssert_MEMOFFSET_EQ(Offset3, Offset1); + UtAssert_EQ(size_t, Offset3, Offset1); CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 72)); - CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset2); + UtAssert_EQ(size_t, Offset4, Offset2); /* Test successfully creating indirect memory pool, no alignment, with mutex */ memset(&UT_MemPoolIndirectBuffer, 0xee, sizeof(UT_MemPoolIndirectBuffer)); @@ -2287,19 +2287,19 @@ void TestGenericPool(void) CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 1)); /* With no alignment adjustments, the result offset should be exactly matching */ - CFE_UtAssert_MEMOFFSET_EQ(Offset1, 2 + sizeof(CFE_ES_GenPoolBD_t)); + UtAssert_EQ(size_t, Offset1, 2 + sizeof(CFE_ES_GenPoolBD_t)); CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset2, 55)); /* the previous block should be 4 in size (smallest block) */ - CFE_UtAssert_MEMOFFSET_EQ(Offset2, Offset1 + 4 + sizeof(CFE_ES_GenPoolBD_t)); + UtAssert_EQ(size_t, Offset2, Offset1 + 4 + sizeof(CFE_ES_GenPoolBD_t)); CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 15)); /* the previous block should be 56 in size */ - CFE_UtAssert_MEMOFFSET_EQ(Offset3, Offset2 + 56 + sizeof(CFE_ES_GenPoolBD_t)); + UtAssert_EQ(size_t, Offset3, Offset2 + 56 + sizeof(CFE_ES_GenPoolBD_t)); CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 54)); /* the previous block should be 16 in size */ - CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset3 + 16 + sizeof(CFE_ES_GenPoolBD_t)); + UtAssert_EQ(size_t, Offset4, Offset3 + 16 + sizeof(CFE_ES_GenPoolBD_t)); CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset1)); CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset2)); @@ -2308,12 +2308,12 @@ void TestGenericPool(void) CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 56)); /* should re-issue previous block */ - CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset1); + UtAssert_EQ(size_t, Offset4, Offset1); CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 56)); /* should re-issue previous block */ - CFE_UtAssert_MEMOFFSET_EQ(Offset3, Offset2); + UtAssert_EQ(size_t, Offset3, Offset2); /* Getting another will fail, despite being enough space, * because its now fragmented. */ @@ -2346,8 +2346,8 @@ void TestGenericPool(void) CFE_ES_GenPoolGetCounts(&Pool1, &NumBlocks, &CountBuf, &ErrBuf); /* Check various outputs to ensure correctness */ - CFE_UtAssert_MEMOFFSET_EQ(TotalSize, OffsetEnd); - CFE_UtAssert_MEMOFFSET_EQ(FreeSize, 0); + UtAssert_EQ(size_t, CFE_ES_MEMOFFSET_TO_SIZET(TotalSize), OffsetEnd); + UtAssert_ZERO(CFE_ES_MEMOFFSET_TO_SIZET(FreeSize)); UtAssert_UINT32_EQ(CountBuf, 2); /* @@ -2590,13 +2590,13 @@ void TestTask(void) /* Test a successful HK request */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.SendHkCmd), UT_TPID_CFE_ES_SEND_HK); - UtAssert_NONZERO(CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree); + UtAssert_NONZERO(CFE_ES_MEMOFFSET_TO_SIZET(CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree)); /* Test the HK request with a get heap failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_HeapGetInfo), 1, -1); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.SendHkCmd), UT_TPID_CFE_ES_SEND_HK); - UtAssert_ZERO(CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree); + UtAssert_ZERO(CFE_ES_MEMOFFSET_TO_SIZET(CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree)); /* Test successful no-op command */ ES_ResetUnitTest(); @@ -5533,8 +5533,8 @@ void TestSysLog(void) CFE_ES_SysLogReadStart_Unsync(&SysLogBuffer); - CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.EndIdx, sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1); - CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.LastOffset, sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1); + UtAssert_EQ(size_t, SysLogBuffer.EndIdx, sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1); + UtAssert_EQ(size_t, SysLogBuffer.LastOffset, sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1); UtAssert_ZERO(SysLogBuffer.BlockSize); UtAssert_ZERO(SysLogBuffer.SizeLeft); @@ -5561,8 +5561,8 @@ void TestSysLog(void) CFE_ES_SysLogReadData(&SysLogBuffer); UtAssert_UINT32_EQ(SysLogBuffer.EndIdx, 3); - CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.LastOffset, 1); - CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.BlockSize, 1); + UtAssert_EQ(size_t, SysLogBuffer.LastOffset, 1); + UtAssert_EQ(size_t, SysLogBuffer.BlockSize, 1); UtAssert_ZERO(SysLogBuffer.SizeLeft); /* Test case where calculated blocksize results in 0 */ @@ -5573,8 +5573,8 @@ void TestSysLog(void) CFE_ES_SysLogReadData(&SysLogBuffer); UtAssert_UINT32_EQ(SysLogBuffer.EndIdx, 0); - CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.LastOffset, 0); - CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.BlockSize, 0); + UtAssert_EQ(size_t, SysLogBuffer.LastOffset, 0); + UtAssert_EQ(size_t, SysLogBuffer.BlockSize, 0); UtAssert_INT32_EQ(SysLogBuffer.SizeLeft, 1); /* Test nominal flow through CFE_ES_SysLogDump diff --git a/modules/msg/ut-coverage/test_cfe_msg_init.c b/modules/msg/ut-coverage/test_cfe_msg_init.c index 6e8f4a7dc..a072566ae 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_init.c +++ b/modules/msg/ut-coverage/test_cfe_msg_init.c @@ -67,7 +67,7 @@ void Test_MSG_Init(void) CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(CFE_MSG_PTR(cmd), &msgid_act)); UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); CFE_UtAssert_SUCCESS(CFE_MSG_GetSize(CFE_MSG_PTR(cmd), &size)); - CFE_UtAssert_MEMOFFSET_EQ(size, sizeof(cmd)); + UtAssert_EQ(size_t, size, sizeof(cmd)); CFE_UtAssert_SUCCESS(CFE_MSG_GetSegmentationFlag(CFE_MSG_PTR(cmd), &segflag)); UtAssert_INT32_EQ(segflag, CFE_MSG_SegFlag_Unsegmented); diff --git a/modules/sb/ut-coverage/sb_UT.c b/modules/sb/ut-coverage/sb_UT.c index 272974836..ba6a3dded 100644 --- a/modules/sb/ut-coverage/sb_UT.c +++ b/modules/sb/ut-coverage/sb_UT.c @@ -3911,26 +3911,26 @@ void Test_CFE_SB_MsgHdrSize(void) type = CFE_MSG_Type_Invalid; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - CFE_UtAssert_MEMOFFSET_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_Message_t)); + UtAssert_EQ(size_t, CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_Message_t)); /* Has secondary, tlm type */ hassec = true; type = CFE_MSG_Type_Tlm; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - CFE_UtAssert_MEMOFFSET_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_TelemetryHeader_t)); + UtAssert_EQ(size_t, CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_TelemetryHeader_t)); /* Has secondary, cmd type */ type = CFE_MSG_Type_Cmd; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - CFE_UtAssert_MEMOFFSET_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_CommandHeader_t)); + UtAssert_EQ(size_t, CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_CommandHeader_t)); /* Has secondary, invalid type */ type = CFE_MSG_Type_Invalid; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - CFE_UtAssert_MEMOFFSET_EQ(CFE_SB_MsgHdrSize(&msg), 0); + UtAssert_ZERO(CFE_SB_MsgHdrSize(&msg)); /* * Note, this function currently has a type mismatch - it attempts to diff --git a/modules/tbl/eds/cfe_tbl.xml b/modules/tbl/eds/cfe_tbl.xml index cce7acfe2..344884e9e 100644 --- a/modules/tbl/eds/cfe_tbl.xml +++ b/modules/tbl/eds/cfe_tbl.xml @@ -46,15 +46,15 @@ - + - - + + diff --git a/modules/tbl/fsw/src/cfe_tbl_internal.c b/modules/tbl/fsw/src/cfe_tbl_internal.c index 72a6f5216..bb72f3477 100644 --- a/modules/tbl/fsw/src/cfe_tbl_internal.c +++ b/modules/tbl/fsw/src/cfe_tbl_internal.c @@ -852,7 +852,7 @@ int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBuffe OS_read(FileDescriptor, ((uint8 *)WorkingBufferPtr->BufferPtr) + TblFileHeader.Offset, TblFileHeader.NumBytes); if (OsStatus >= OS_SUCCESS) { - NumBytes = (long)OsStatus; /* status code conversion (size) */ + NumBytes = OsStatus; /* status code conversion (size) */ } else { @@ -873,7 +873,7 @@ int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBuffe OsStatus = OS_read(FileDescriptor, &ExtraByte, 1); if (OsStatus >= OS_SUCCESS) { - NumBytes = (long)OsStatus; /* status code conversion (size) */ + NumBytes = OsStatus; /* status code conversion (size) */ } else { diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c index c76db44a5..5af3f9da6 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c @@ -715,8 +715,8 @@ CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile(const char *DumpFilename, const char *Ta /* Initialize the Table Image Header for the Dump File */ strncpy(TblFileHeader.TableName, TableName, sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = 0; - TblFileHeader.Offset = CFE_ES_MEMOFFSET_C(0); - TblFileHeader.NumBytes = CFE_ES_MEMOFFSET_C(TblSizeInBytes); + TblFileHeader.Offset = 0; + TblFileHeader.NumBytes = TblSizeInBytes; TblFileHeader.Reserved = 0; /* Determine if this is a little endian processor */ diff --git a/modules/tbl/ut-coverage/tbl_UT.c b/modules/tbl/ut-coverage/tbl_UT.c index 102584a51..77db831f9 100644 --- a/modules/tbl/ut-coverage/tbl_UT.c +++ b/modules/tbl/ut-coverage/tbl_UT.c @@ -88,8 +88,8 @@ CFE_TBL_RegistryRec_t Original[CFE_PLATFORM_TBL_MAX_NUM_TABLES]; */ void UT_TBL_SetupHeader(CFE_TBL_File_Hdr_t *TblFileHeader, size_t Offset, size_t NumBytes) { - TblFileHeader->Offset = CFE_ES_MEMOFFSET_C(Offset); - TblFileHeader->NumBytes = CFE_ES_MEMOFFSET_C(NumBytes); + TblFileHeader->Offset = Offset; + TblFileHeader->NumBytes = NumBytes; if (UT_Endianess == UT_LITTLE_ENDIAN) { @@ -780,7 +780,7 @@ void Test_CFE_TBL_GetTblRegData(void) CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].DoubleBuffered = true; CFE_TBL_GetTblRegData(); - UtAssert_NONZERO(CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr); + UtAssert_NOT_NULL(CFE_ES_MEMADDRESS_TO_PTR(CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr)); /* Test using a single buffered table and the buffer is inactive */ UT_InitData(); @@ -788,14 +788,14 @@ void Test_CFE_TBL_GetTblRegData(void) CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].DoubleBuffered = false; CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; CFE_TBL_GetTblRegData(); - UtAssert_NONZERO(CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr); + UtAssert_NOT_NULL(CFE_ES_MEMADDRESS_TO_PTR(CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr)); /* Test with no inactive buffer */ UT_InitData(); CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; CFE_TBL_GetTblRegData(); - UtAssert_ZERO(CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr); + UtAssert_NULL(CFE_ES_MEMADDRESS_TO_PTR(CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr)); } /*