Skip to content

TBL services using platform-scope values in table header definition #25

@jphickey

Description

@jphickey

Describe the bug
The CFE_TBL_MAX_FULL_NAME_LEN size definition, which is used as part of the CFE_TBL_FileDef_t structure, is partly based on the OS_MAX_API_NAME value.

The problem is that this value is platform scope and thereby configurable on a per-cpu basis. Therefore, the OS_MAX_API_NAME value can be (validly) different on each CPU in a multi-cpu deployment. This, in turn, means the table definition headers may be different on each CPU.

Tools like elf2cfetbl and tblCRCTool do not account for this possibility; when reading or writing the table header, they use a single definition. The definition that they use may or may not even match what the flight code uses at all, depending on how the mission is configured.

To Reproduce
Configure a mission with two CPUs, and specify a different osconfig.h for each one (i.e. set TGT2_PLATFORM to something other than default). Change the value of OS_MAX_API_NAME for the second CPU, and build all software.

Observe that the sizeof(CFE_TBL_FileDef_t) is now also different on CPU2 vs. CPU1. Tables generated by elf2cfetbl and the CRC computed by tblCRCTool only work in CPU1. CPU2 will not be able to load tables because of the incompatible header.

Expected behavior
The sizeof(CFE_TBL_FileDef_t) should remain consistent regardless of the platform-scope values used, because this is an external format shared between (at least) between ground systems and flight code.

The CFE_MISSION_MAX_API_LEN macro is a better choice here. It was introduced in a previous version of CFE for telemetry packets, but table files are effectively the same issue.

Code snips
The problem definition is:

#define CFE_TBL_MAX_FULL_NAME_LEN_COMP (CFE_MISSION_TBL_MAX_NAME_LENGTH + OS_MAX_API_LEN + 2)

Furthermore, as this definition is only really for the header struct, it should be in cfe_tbl_filedef.h, not cfe_tbl.h. This allows external tools to include this definition without having to pull in the rest of CFE headers implicitly.

System observed on:
Ubuntu 18.04 (64-bit), kernel 5.0.0-23-generic

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions