From 8fe3022afcaf4e82b3d4323b675e28360a0a64ef Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Wed, 6 Mar 2024 10:22:11 -0800 Subject: [PATCH] Fix data product array record size (#2568) * Fix dp array record size Use FwStoreType to store the size * Remove todo comment * Revise requirements.txt --- FppTest/dp/test/ut/Tester.cpp | 12 ++++++------ Fw/Dp/docs/sdd.md | 6 +----- requirements.txt | 22 +++++++++++----------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/FppTest/dp/test/ut/Tester.cpp b/FppTest/dp/test/ut/Tester.cpp index 5cdeb609bf..9973b8ff02 100644 --- a/FppTest/dp/test/ut/Tester.cpp +++ b/FppTest/dp/test/ut/Tester.cpp @@ -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, @@ -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(); @@ -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, @@ -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(); @@ -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, @@ -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(); diff --git a/Fw/Dp/docs/sdd.md b/Fw/Dp/docs/sdd.md index 2ad6cdfdc7..cb596f0e56 100644 --- a/Fw/Dp/docs/sdd.md +++ b/Fw/Dp/docs/sdd.md @@ -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. diff --git a/requirements.txt b/requirements.txt index 7efca76fcd..371b0eddf8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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