Skip to content

Commit

Permalink
Fix #1300, Add CFE_ES_MemAddOff structure
Browse files Browse the repository at this point in the history
  • Loading branch information
pavll committed Oct 21, 2021
1 parent b66661c commit e91275e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 77 deletions.
6 changes: 0 additions & 6 deletions docs/src/mnem_maps/cfe_es_tlm_mnem_map
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ ES_APPFILENAME=$sc_$cpu_ES_AppFilename[OS_MAX_PATH_LEN] \
ES_STACKSIZE=$sc_$cpu_ES_StackSize \
ES_MODULEID=$sc_$cpu_ES_ModuleID \
ES_ADDRVALID=$sc_$cpu_ES_AddrsValid \
ES_CODEADDR=$sc_$cpu_ES_CodeAddress \
ES_CODESIZE=$sc_$cpu_ES_CodeSize \
ES_DATAADDR=$sc_$cpu_ES_DataAddress \
ES_DATASIZE=$sc_$cpu_ES_DataSize \
ES_BSSADDR=$sc_$cpu_ES_BSSAddress \
ES_BSSSIZE=$sc_$cpu_ES_BSSSize \
ES_STARTADDR=$sc_$cpu_ES_StartAddr \
ES_EXCEPTNACTN=$sc_$cpu_ES_ExceptnActn \
ES_PRIORITY=$sc_$cpu_ES_Priority \
Expand Down
37 changes: 19 additions & 18 deletions modules/cfe_testcase/src/es_info_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,20 @@ void TestAppInfo(void)

if (TestAppInfo.AddressesAreValid)
{
UtAssert_True(TestAppInfo.AddressesAreValid > 0, "Test App Info -> AddrsValid? = %d",
UtAssert_True(TestAppInfo.AddressesAreValid > 0, "Test App Info -> Addrs.Valid? = %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_True(TestAppInfo.Code.Address > 0, "Test App Info -> Code.Address = %ld",
(unsigned long)TestAppInfo.Code.Address);
UtAssert_True(TestAppInfo.Code.Size > 0, "Test App Info -> Code.Size = %ld",
(unsigned long)TestAppInfo.Code.Size);
UtAssert_True(TestAppInfo.Data.Address > 0, "Test App Info -> Data.Address = %ld",
(unsigned long)TestAppInfo.Data.Address);
UtAssert_True(TestAppInfo.Data.Size > 0, "Test App Info -> Data.Size = %ld",
(unsigned long)TestAppInfo.Data.Size);
UtAssert_True(TestAppInfo.BSS.Address > 0, "Test App Info -> BSS.Address = %ld",
(unsigned long)TestAppInfo.BSS.Address);
UtAssert_True(TestAppInfo.BSS.Size > 0, "Test App Info -> BSS.Size = %ld",
(unsigned long)TestAppInfo.BSS.Size);
}
else
{
Expand Down Expand Up @@ -190,12 +191,12 @@ void TestLibInfo(void)
{
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_True(LibInfo.Code.Address > 0, "Lib Info -> CodeAddress = %ld", (unsigned long)LibInfo.Code.Address);
UtAssert_True(LibInfo.Code.Size > 0, "Lib Info -> Code.Size = %ld", (unsigned long)LibInfo.Code.Size);
UtAssert_True(LibInfo.Data.Address > 0, "Lib Info -> Data.Address = %ld", (unsigned long)LibInfo.Data.Address);
UtAssert_True(LibInfo.Data.Size > 0, "Lib Info -> Data.Size = %ld", (unsigned long)LibInfo.Data.Size);
UtAssert_True(LibInfo.BSS.Address > 0, "Lib Info -> BSS.Address = %ld", (unsigned long)LibInfo.BSS.Address);
UtAssert_True(LibInfo.BSS.Size > 0, "Lib Info -> BSS.Size = %ld", (unsigned long)LibInfo.BSS.Size);
}
else
{
Expand Down
39 changes: 23 additions & 16 deletions modules/core_api/fsw/inc/cfe_es_extern_typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,19 @@ typedef uint32 CFE_ES_MemAddress_t;
*/
#define CFE_ES_MEMADDRESS_C(x) ((CFE_ES_MemAddress_t)((cpuaddr)(x)&0xFFFFFFFF))

/**
* Memory Address and Memory Offset combination
*
* A combination of #CFE_ES_MemAddress_t and #CFE_ES_MemOffset_t, since they are often used together.
*/
typedef struct CFE_ES_MemAddOff
{
CFE_ES_MemAddress_t Address;

CFE_ES_MemOffset_t Size;

} CFE_ES_MemAddOff_t;

/*
* Data Structures shared between API and Message (CMD/TLM) interfaces
*/
Expand Down Expand Up @@ -455,22 +468,16 @@ typedef struct CFE_ES_AppInfo
char FileName[CFE_MISSION_MAX_PATH_LEN]; /**< \cfetlmmnemonic \ES_APPFILENAME
\brief The Filename of the file containing the Application */

CFE_ES_MemOffset_t StackSize; /**< \cfetlmmnemonic \ES_STACKSIZE
\brief The Stack Size of the Application */
uint32 AddressesAreValid; /**< \cfetlmmnemonic \ES_ADDRVALID
\brief Indicates that the Code, Data, and BSS addresses/sizes are valid */
CFE_ES_MemAddress_t CodeAddress; /**< \cfetlmmnemonic \ES_CODEADDR
\brief The Address of the Application Code Segment*/
CFE_ES_MemOffset_t CodeSize; /**< \cfetlmmnemonic \ES_CODESIZE
\brief The Code Size of the Application */
CFE_ES_MemAddress_t DataAddress; /**< \cfetlmmnemonic \ES_DATAADDR
\brief The Address of the Application Data Segment*/
CFE_ES_MemOffset_t DataSize; /**< \cfetlmmnemonic \ES_DATASIZE
\brief The Data Size of the Application */
CFE_ES_MemAddress_t BSSAddress; /**< \cfetlmmnemonic \ES_BSSADDR
\brief The Address of the Application BSS Segment*/
CFE_ES_MemOffset_t BSSSize; /**< \cfetlmmnemonic \ES_BSSSIZE
\brief The BSS Size of the Application */
CFE_ES_MemOffset_t StackSize; /**< \cfetlmmnemonic \ES_STACKSIZE
\brief The Stack Size of the Application */
uint32 AddressesAreValid; /**< \cfetlmmnemonic \ES_ADDRVALID
\brief Indicates that the Code, Data, and BSS addresses/sizes are valid */
CFE_ES_MemAddOff_t Code;

CFE_ES_MemAddOff_t Data;

CFE_ES_MemAddOff_t BSS;

CFE_ES_MemAddress_t StartAddress; /**< \cfetlmmnemonic \ES_STARTADDR
\brief The Start Address of the Application */
CFE_ES_ExceptionAction_Enum_t ExceptionAction; /**< \cfetlmmnemonic \ES_EXCEPTNACTN
Expand Down
30 changes: 0 additions & 30 deletions modules/es/eds/cfe_es.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,36 +173,6 @@
\cfetlmmnemonic \ES_ADDRVALID
</LongDescription>
</Entry>
<Entry name="CodeAddress" type="BASE_TYPES/CpuAddress" shortDescription="The Address of the Application Code Segment">
<LongDescription>
\cfetlmmnemonic \ES_CODEADDR
</LongDescription>
</Entry>
<Entry name="CodeSize" type="BASE_TYPES/CpuAddress" shortDescription="The Code Size of the Application">
<LongDescription>
\cfetlmmnemonic \ES_CODESIZE
</LongDescription>
</Entry>
<Entry name="DataAddress" type="BASE_TYPES/CpuAddress" shortDescription="The Address of the Application Data Segment">
<LongDescription>
\cfetlmmnemonic \ES_DATAADDR
</LongDescription>
</Entry>
<Entry name="DataSize" type="BASE_TYPES/CpuAddress" shortDescription="The Data Size of the Application">
<LongDescription>
\cfetlmmnemonic \ES_DATASIZE
</LongDescription>
</Entry>
<Entry name="BSSAddress" type="BASE_TYPES/CpuAddress" shortDescription="The Address of the Application BSS Segment">
<LongDescription>
\cfetlmmnemonic \ES_BSSADDR
</LongDescription>
</Entry>
<Entry name="BSSSize" type="BASE_TYPES/CpuAddress" shortDescription="The BSS Size of the Application">
<LongDescription>
\cfetlmmnemonic \ES_BSSSIZE
</LongDescription>
</Entry>
<Entry name="StartAddress" type="BASE_TYPES/CpuAddress" shortDescription="The Start Address of the Application">
<LongDescription>
\cfetlmmnemonic \ES_STARTADDR
Expand Down
14 changes: 7 additions & 7 deletions modules/es/fsw/src/cfe_es_apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ void CFE_ES_CopyModuleAddressInfo(osal_id_t ModuleId, CFE_ES_AppInfo_t *AppInfoP
if (OsStatus == OS_SUCCESS)
{
AppInfoPtr->AddressesAreValid =
(sizeof(ModuleInfo.addr.code_address) <= sizeof(AppInfoPtr->CodeAddress)) && ModuleInfo.addr.valid;
(sizeof(ModuleInfo.addr.code_address) <= sizeof(AppInfoPtr->Code.Address)) && ModuleInfo.addr.valid;
}
else
{
Expand All @@ -1803,10 +1803,10 @@ void CFE_ES_CopyModuleAddressInfo(osal_id_t ModuleId, CFE_ES_AppInfo_t *AppInfoP
* Convert the internal size and address to the telemetry format.
* (The telemetry format may be a different bitwidth than the native processor)
*/
AppInfoPtr->CodeAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.code_address);
AppInfoPtr->CodeSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.code_size);
AppInfoPtr->DataAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.data_address);
AppInfoPtr->DataSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.data_size);
AppInfoPtr->BSSAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.bss_address);
AppInfoPtr->BSSSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.bss_size);
AppInfoPtr->Code.Address = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.code_address);
AppInfoPtr->Code.Size = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.code_size);
AppInfoPtr->Data.Address = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.data_address);
AppInfoPtr->Data.Size = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.data_size);
AppInfoPtr->BSS.Address = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.bss_address);
AppInfoPtr->BSS.Size = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.bss_size);
}

0 comments on commit e91275e

Please sign in to comment.