nasa / nasa/EdsLib

Implicit array definition doesn't work right

Open
#104 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
43
Forks
19
Avg merge
3d 20h
Merged PRs (30d)
2

Description

Describe the bug
The SOIS spec allows for an Entry in an EntryList to have an arbitrary number of ArrayDimension components for inline array definitions. When adding an ArrayDimension component to an Entry, the structure generated by sedstool does not appear as I would expect. The structure created is a typedef of the Entry's type, instead of an array of the type

A similar problem is observed when trying to use a ListEntry field instead of an ArrayDimension component.

Using this Container as a basic example

      <ContainerDataType name="thing" baseType="CFE_HDR/TelemetryHeader">
        <EntryList>
          <Entry type="BASE_TYPES/uint8" name="nested_array">
            <ArrayDimensions>
              <Dimension size="100" indexTypeRef="BASE_TYPES/uint16"/>
            </ArrayDimensions>
          </Entry>
          <Entry type="BASE_TYPES/uint16" name="i1"></Entry>
          <Entry type="BASE_TYPES/uint16" name="i2"></Entry>
        </EntryList>
      </ContainerDataType>

yields the below set of structures (note the first typedef):

/**
 * @brief Implicitly created type based on INTEGER_DATATYPE name=uint8
 */
typedef EdsDataType_BASE_TYPES_uint8_t                     EdsImplicit_ARRAY_MyEDS_thing_nested_array_t;

/**
 * @brief Structure definition for CONTAINER_DATATYPE 'MyEDS/thing'
 *
 * Data definition signature 9127b9d403aec1d8
 */
struct EdsContainer_MyEDS_thing /* checksum=9127b9d403aec1d8 */
{
   EdsDataType_CFE_HDR_TelemetryHeader_t              TelemetryHeader;               /* 96  bits/20  bytes */
   EdsImplicit_ARRAY_MyEDS_thing_nested_array_t         nested_array;                  /* 800 bits/100 bytes */
   EdsDataType_BASE_TYPES_uint16_t                    i1;                            /* 16  bits/2   bytes */
   EdsDataType_BASE_TYPES_uint16_t                    i2;                            /* 16  bits/2   bytes */
};

/**
 *
 */
typedef struct EdsContainer_MyEDS_thing                      EdsDataType_MyEDS_thing_t;
  /* bits= 928  bytes= 124/124   align=0x3  checksum=9127b9d403aec1d8 */

typedef uint8_t                                            EdsPackedBuffer_MyEDS_thing_t[116];

To Reproduce
Steps to reproduce the behavior:

  1. Add the previous ContainerDataType to any EDS XML
  2. Run sedstool to generate the structures

Expected behavior
Generated implicit array structures should appear as follows

/**
 * @brief Implicitly created type based on INTEGER_DATATYPE name=uint8
 */
typedef EdsDataType_BASE_TYPES_uint8_t                     EdsImplicit_ARRAY_MyEDS_thing_nested_array_t[100];

System observed on:

  • OS: Ubuntu 22.04
  • Versions v7.0.0

Additional context
The obvious workaround to this problem is to define an ArrayDataType and use that newly defined object inside the container. However, the SOIS spec specifically makes mention of allowing anonymous subdeclarations here:

3.11 Fields
...

2. The concept of ‘field’ permits the definition of parameter, arguments, or container entries that are a subrange, encoding, or array of the referenced type; this definition of an anonymous type avoids the need to define artificial explicit named types.

Reporter Info
Chris Fallon | ispace-US

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by creating the ContainerDataType example from the issue in an EDS XML file and run sedstool on Ubuntu 22.04 or the relevant project setup. Inspect the generated implicit typedef and compare it with the expected array declaration, including the similar ListEntry case. Done means anonymous array entries generate a typedef with the declared array dimensions.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.