Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix data product array record size #2568

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions FppTest/dp/test/ut/Tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void Tester::productRecvIn_Container2_FAILURE() {
void Tester::productRecvIn_Container3_SUCCESS() {
Fw::Buffer buffer;
FwSizeType expectedNumElts;
const FwSizeType dataEltSize = sizeof(FwSizeType) + this->u8ArrayRecordData.size();
const FwSizeType dataEltSize = sizeof(FwSizeStoreType) + this->u8ArrayRecordData.size();
// Invoke the port and check the header
this->productRecvIn_InvokeAndCheckHeader(DpTest::ContainerId::Container3, dataEltSize,
DpTest::ContainerPriority::Container3, this->container3Buffer, buffer,
Expand All @@ -145,7 +145,7 @@ void Tester::productRecvIn_Container3_SUCCESS() {
const FwDpIdType expectedId = this->component.getIdBase() + DpTest::RecordId::U8ArrayRecord;
ASSERT_EQ(id, expectedId);
FwSizeType size;
status = serialRepr.deserialize(size);
status = serialRepr.deserializeSize(size);
ASSERT_EQ(status, Fw::FW_SERIALIZE_OK);
ASSERT_EQ(size, this->u8ArrayRecordData.size());
const U8* const buffAddr = serialRepr.getBuffAddr();
Expand All @@ -165,7 +165,7 @@ void Tester::productRecvIn_Container3_FAILURE() {
void Tester::productRecvIn_Container4_SUCCESS() {
Fw::Buffer buffer;
FwSizeType expectedNumElts;
const FwSizeType dataEltSize = sizeof(FwSizeType) + this->u32ArrayRecordData.size() * sizeof(U32);
const FwSizeType dataEltSize = sizeof(FwSizeStoreType) + this->u32ArrayRecordData.size() * sizeof(U32);
// Invoke the port and check the header
this->productRecvIn_InvokeAndCheckHeader(DpTest::ContainerId::Container4, dataEltSize,
DpTest::ContainerPriority::Container4, this->container4Buffer, buffer,
Expand All @@ -181,7 +181,7 @@ void Tester::productRecvIn_Container4_SUCCESS() {
const FwDpIdType expectedId = this->component.getIdBase() + DpTest::RecordId::U32ArrayRecord;
ASSERT_EQ(id, expectedId);
FwSizeType size;
status = serialRepr.deserialize(size);
status = serialRepr.deserializeSize(size);
ASSERT_EQ(status, Fw::FW_SERIALIZE_OK);
ASSERT_EQ(size, this->u32ArrayRecordData.size());
const U8* const buffAddr = serialRepr.getBuffAddr();
Expand All @@ -201,7 +201,7 @@ void Tester::productRecvIn_Container4_FAILURE() {
void Tester::productRecvIn_Container5_SUCCESS() {
Fw::Buffer buffer;
FwSizeType expectedNumElts;
const FwSizeType dataEltSize = sizeof(FwSizeType) + this->dataArrayRecordData.size() * DpTest_Data::SERIALIZED_SIZE;
const FwSizeType dataEltSize = sizeof(FwSizeStoreType) + this->dataArrayRecordData.size() * DpTest_Data::SERIALIZED_SIZE;
// Invoke the port and check the header
this->productRecvIn_InvokeAndCheckHeader(DpTest::ContainerId::Container5, dataEltSize,
DpTest::ContainerPriority::Container5, this->container5Buffer, buffer,
Expand All @@ -217,7 +217,7 @@ void Tester::productRecvIn_Container5_SUCCESS() {
const FwDpIdType expectedId = this->component.getIdBase() + DpTest::RecordId::DataArrayRecord;
ASSERT_EQ(id, expectedId);
FwSizeType size;
status = serialRepr.deserialize(size);
status = serialRepr.deserializeSize(size);
ASSERT_EQ(status, Fw::FW_SERIALIZE_OK);
ASSERT_EQ(size, this->dataArrayRecordData.size());
const U8* const buffAddr = serialRepr.getBuffAddr();
Expand Down
6 changes: 1 addition & 5 deletions Fw/Dp/docs/sdd.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,9 @@ Array records with _type = T_ have the following format:
|Field Name|Data Type|Serialized Size|Description|
|----------|---------|---------------|-----------|
|`Id`|`FwDpIdType`|`sizeof(FwDpIdType)`|The record ID|
|`Size`|`FwSizeType`|`sizeof(FwSizeType)`|The number _n_ of elements in the record|
|`Size`|`FwSizeType`|`sizeof(FwSizeStoreType)`|The number _n_ of elements in the record|
|`Data`|Array of _n_ _T_|_n_ * [`sizeof(`_T_`)` if _T_ is a primitive type; otherwise _T_`::SERIALIZED_SIZE`]|_n_ elements, each of type _T_|

_TODO: The array size should be serialized as `FwSizeStoreType`.
This requires a change to the FPP code generation.
See https://github.com/fprime-community/fpp/issues/393._

#### 5.1.4. Data Hash

The data hash has the following format.
Expand Down
22 changes: 11 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ fprime-fpl-convert-xml==1.0.3
fprime-fpl-extract-xml==1.0.3
fprime-fpl-layout==1.0.3
fprime-fpl-write-pic==1.0.3
fprime-fpp-check==2.1.0a4
fprime-fpp-depend==2.1.0a4
fprime-fpp-filenames==2.1.0a4
fprime-fpp-format==2.1.0a4
fprime-fpp-from-xml==2.1.0a4
fprime-fpp-locate-defs==2.1.0a4
fprime-fpp-locate-uses==2.1.0a4
fprime-fpp-syntax==2.1.0a4
fprime-fpp-to-cpp==2.1.0a4
fprime-fpp-to-json==2.1.0a4
fprime-fpp-to-xml==2.1.0a4
fprime-fpp-check==2.1.0a5
fprime-fpp-depend==2.1.0a5
fprime-fpp-filenames==2.1.0a5
fprime-fpp-format==2.1.0a5
fprime-fpp-from-xml==2.1.0a5
fprime-fpp-locate-defs==2.1.0a5
fprime-fpp-locate-uses==2.1.0a5
fprime-fpp-syntax==2.1.0a5
fprime-fpp-to-cpp==2.1.0a5
fprime-fpp-to-json==2.1.0a5
fprime-fpp-to-xml==2.1.0a5
fprime-gds==3.4.3
fprime-tools==3.4.4
fprime-visual==1.0.2
Expand Down
Loading