From 9e30785a983ca47867bfb6e7e4ee7bf12fb33358 Mon Sep 17 00:00:00 2001 From: Ali Mosallaei Date: Fri, 5 Jul 2024 10:16:42 -0700 Subject: [PATCH 1/6] Create github workflow for the subtopology autocoder --- .../workflows/ext-build-subtopology-ac.yml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .github/workflows/ext-build-subtopology-ac.yml diff --git a/.github/workflows/ext-build-subtopology-ac.yml b/.github/workflows/ext-build-subtopology-ac.yml new file mode 100644 index 0000000000..059c6b5f15 --- /dev/null +++ b/.github/workflows/ext-build-subtopology-ac.yml @@ -0,0 +1,87 @@ +# Runs the subtopology autocoder tool to test the subtopology tool (https://github.com/mosa11aei/fprime-subtopology-tool) + +name: "Subtopology Autocoder Tool Test" + +on: + push: + branches: [ devel, release/** ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ devel, release/** ] + paths-ignore: + - 'docs/**' + - '**.md' + - '.github/actions/spelling/**' + - '.github/ISSUE_TEMPLATE/**' + +jobs: + get-branch: + name: "Get target branch" + uses: ./.github/workflows/reusable-get-pr-branch.yml + with: + target_repository: mosa11aei/fprime-rngLibrary + + subtopology-test: + name: "Subtopology Test" + runs-on: ubuntu-latest + needs: get-branch + steps: + - name: "Checkout target repository" + uses: actions/checkout@v4 + with: + submodules: false + repository: mosa11aei/fprime-rngLibrary + ref: ${{ needs.get-branch.outputs.target-branch }} + - name: "Overlay current F´ revision" + uses: actions/checkout@v4 + with: + submodules: true + path: ./fprime + fetch-depth: 0 + - uses: ./fprime/.github/actions/setup + with: + location: ./fprime + - name: "Verify CMake is installed" + run: | + sudo apt-get update + sudo apt-get install -y cmake + - name: "Get FPP" + uses: actions/checkout@v4 + with: + submodules: false + repository: nasa/fpp + path: ./fpp + ref: main + - name: "[fpp] Install sbt" + run: | + sudo apt-get update + sudo apt-get install -y apt-transport-https curl gnupg -yqq + echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list + echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list + curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import + sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg + sudo apt-get update + sudo apt-get install -y sbt default-jre + - name: "Install unreleased fpp" + run: | + chmod +x ./fpp/compiler/install + ./fpp/compiler/install /usr/local/bin/ + - name: "Checkout subtopology tool" + uses: actions/checkout@v4 + with: + submodules: false + path: ./fprime-subtopology-tool + repository: mosa11aei/fprime-subtopology-tool + ref: main + - name: "Go to Deployment Directory" + run: | + cd ./MainDeployment + - name: "Generate Subtopology Example Build Cache" + run: | + fprime-util generate -DFPRIME_SKIP_TOOLS_VERSION_CHECK=ON -DCMAKE_DEBUG_OUTPUT=ON + - name: "Build Example" + run: | + fprime-util build -v + - name: "Exit Deployment Directory" + run: | + cd .. From b28070530d1a2d9eca7494655018754e3fc4e47c Mon Sep 17 00:00:00 2001 From: Ali Mosallaei Date: Mon, 8 Jul 2024 11:40:30 -0700 Subject: [PATCH 2/6] Address suggestions; sbt comes installed --- .github/workflows/ext-build-subtopology-ac.yml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ext-build-subtopology-ac.yml b/.github/workflows/ext-build-subtopology-ac.yml index 059c6b5f15..830f138755 100644 --- a/.github/workflows/ext-build-subtopology-ac.yml +++ b/.github/workflows/ext-build-subtopology-ac.yml @@ -52,14 +52,8 @@ jobs: repository: nasa/fpp path: ./fpp ref: main - - name: "[fpp] Install sbt" + - name: "Verify sbt is installed" run: | - sudo apt-get update - sudo apt-get install -y apt-transport-https curl gnupg -yqq - echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list - echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list - curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import - sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg sudo apt-get update sudo apt-get install -y sbt default-jre - name: "Install unreleased fpp" @@ -73,15 +67,11 @@ jobs: path: ./fprime-subtopology-tool repository: mosa11aei/fprime-subtopology-tool ref: main - - name: "Go to Deployment Directory" - run: | - cd ./MainDeployment - name: "Generate Subtopology Example Build Cache" + working-directory: ./MainDeployment run: | fprime-util generate -DFPRIME_SKIP_TOOLS_VERSION_CHECK=ON -DCMAKE_DEBUG_OUTPUT=ON - name: "Build Example" + working-directory: ./MainDeployment run: | - fprime-util build -v - - name: "Exit Deployment Directory" - run: | - cd .. + fprime-util build -v -j4 From 14d3722601a315ceeb92861d8ebd869834358e6f Mon Sep 17 00:00:00 2001 From: Ali Mosallaei Date: Mon, 8 Jul 2024 11:55:59 -0700 Subject: [PATCH 3/6] Make bin directory dynamic --- .github/workflows/ext-build-subtopology-ac.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ext-build-subtopology-ac.yml b/.github/workflows/ext-build-subtopology-ac.yml index 830f138755..51a6e76a6c 100644 --- a/.github/workflows/ext-build-subtopology-ac.yml +++ b/.github/workflows/ext-build-subtopology-ac.yml @@ -52,14 +52,24 @@ jobs: repository: nasa/fpp path: ./fpp ref: main - - name: "Verify sbt is installed" + - name: "[fpp] Install sbt" run: | + sudo apt-get update + sudo apt-get install -y apt-transport-https curl gnupg -yqq + echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list + echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list + curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import + sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg sudo apt-get update sudo apt-get install -y sbt default-jre + - name: "Get location of fpp bin" + id: fpp-bin + run: | + echo "BIN_DIR=$(dirname $(which fpp-depend))" >> $GITHUB_OUTPUT - name: "Install unreleased fpp" run: | chmod +x ./fpp/compiler/install - ./fpp/compiler/install /usr/local/bin/ + ./fpp/compiler/install ${{ steps.fpp-bin.outputs.BIN_DIR}} - name: "Checkout subtopology tool" uses: actions/checkout@v4 with: From f31fd94067865332f037df3dec6162a17815637b Mon Sep 17 00:00:00 2001 From: Ali Mosallaei Date: Mon, 8 Jul 2024 12:06:30 -0700 Subject: [PATCH 4/6] Fix some spelling mistakes --- .github/actions/spelling/expect.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 91993a98e1..0c29aeafd0 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -421,6 +421,7 @@ gnueabihf google googletest Gorang +gpg GPGGA GPINT gpio @@ -536,6 +537,7 @@ JSO jsonable kermit kevin +keyring kislyuk kitware Kooi @@ -905,6 +907,7 @@ sbb SBF SBINDIR sbt +scalasbt Scatterometer schem schematron @@ -1202,4 +1205,5 @@ xsh xsltproc xxxx yacgen +yqq zmq From 82e357889dd8f0f221c6a1e0a730774c421d6abe Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Tue, 16 Jul 2024 13:56:41 -0700 Subject: [PATCH 5/6] FPP v2.1.0a12 (#2795) * Update fpp version Revise framework code to match * Update fpp version * Update fpp version * Update fpp version --- FppTest/struct/PrimitiveStructTest.cpp | 7 +---- Fw/Buffer/Buffer.cpp | 12 ++----- Fw/Cfg/ConfigCheck.cpp | 8 ++++- .../test/TestSerializable/CMakeLists.txt | 4 +-- .../TestSerializable/TestSerializable.fpp | 10 ++++++ .../TestSerializable/TestSerializableAi.xml | 31 ------------------- config/FpConfig.h | 25 --------------- requirements.txt | 24 +++++++------- 8 files changed, 35 insertions(+), 86 deletions(-) create mode 100644 Fw/SerializableFile/test/TestSerializable/TestSerializable.fpp delete mode 100644 Fw/SerializableFile/test/TestSerializable/TestSerializableAi.xml diff --git a/FppTest/struct/PrimitiveStructTest.cpp b/FppTest/struct/PrimitiveStructTest.cpp index a8875c66d7..7332410588 100644 --- a/FppTest/struct/PrimitiveStructTest.cpp +++ b/FppTest/struct/PrimitiveStructTest.cpp @@ -207,10 +207,5 @@ TEST_F(PrimitiveStructTest, ToString) { << "mF64 = " << std::fixed << testF64 << " )"; - // Truncate string output - char buf2Str[FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE]; - Fw::StringUtils::string_copy(buf2Str, buf2.str().c_str(), - FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE); - - ASSERT_STREQ(buf1.str().c_str(), buf2Str); + ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str()); } diff --git a/Fw/Buffer/Buffer.cpp b/Fw/Buffer/Buffer.cpp index 65ff479bfb..00729b5baa 100644 --- a/Fw/Buffer/Buffer.cpp +++ b/Fw/Buffer/Buffer.cpp @@ -168,16 +168,10 @@ Fw::SerializeStatus Buffer::deserialize(Fw::SerializeBufferBase& buffer) { return stat; } -#if FW_SERIALIZABLE_TO_STRING || BUILD_UT +#if FW_SERIALIZABLE_TO_STRING void Buffer::toString(Fw::StringBase& text) const { - static const char * formatString = "(data = %p, size = %u,context = %u)"; - char outputString[FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE]; - - (void)snprintf(outputString, FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE, formatString, this->m_bufferData, this->m_size, - this->m_context); - // Force NULL termination - outputString[FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE-1] = 0; - text = outputString; + static const char * formatString = "(data = %p, size = %u, context = %u)"; + text.format(formatString, this->m_bufferData, this->m_size, this->m_context); } #endif diff --git a/Fw/Cfg/ConfigCheck.cpp b/Fw/Cfg/ConfigCheck.cpp index 4eb0a69efd..832221712b 100644 --- a/Fw/Cfg/ConfigCheck.cpp +++ b/Fw/Cfg/ConfigCheck.cpp @@ -38,9 +38,15 @@ static_assert(FW_PARAM_STRING_MAX_SIZE <= FW_PARAM_BUFFER_MAX_SIZE, // Text logging needs the code generator for serializables to generate a stringified version of the // value. -static_assert((FW_ENABLE_TEXT_LOGGING == 0) || (FW_SERIALIZABLE_TO_STRING == 1), +static_assert((FW_ENABLE_TEXT_LOGGING == 0) || (FW_SERIALIZABLE_TO_STRING != 0), "FW_SERIALIZABLE_TO_STRING must be enabled to enable FW_ENABLE_TEXT_LOGGING"); +// Unit testing needs serializable strings +#ifdef BUILD_UT +static_assert(FW_SERIALIZABLE_TO_STRING != 0, + "FW_SERIALIZABLE_TO_STRING must be enabled for unit testing"); +#endif + static_assert(std::numeric_limits::max() == std::numeric_limits::max() && std::numeric_limits::min() == std::numeric_limits::min(), "FwBuffSizeType must be equivalent to FwExternalSizeType"); diff --git a/Fw/SerializableFile/test/TestSerializable/CMakeLists.txt b/Fw/SerializableFile/test/TestSerializable/CMakeLists.txt index 681efdcf53..60410093f4 100644 --- a/Fw/SerializableFile/test/TestSerializable/CMakeLists.txt +++ b/Fw/SerializableFile/test/TestSerializable/CMakeLists.txt @@ -6,7 +6,7 @@ # #### set(SOURCE_FILES - "${CMAKE_CURRENT_LIST_DIR}/TestSerializableAi.xml" + "${CMAKE_CURRENT_LIST_DIR}/TestSerializable.fpp" ) set(MOD_DEPS Fw/Cfg @@ -25,4 +25,4 @@ set_target_properties( ${MODULE_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE -) \ No newline at end of file +) diff --git a/Fw/SerializableFile/test/TestSerializable/TestSerializable.fpp b/Fw/SerializableFile/test/TestSerializable/TestSerializable.fpp new file mode 100644 index 0000000000..62b0f211e7 --- /dev/null +++ b/Fw/SerializableFile/test/TestSerializable/TestSerializable.fpp @@ -0,0 +1,10 @@ +module Fw { + + @ Test struct + struct Test { + element1: U32 @< Element 1 + element2: I8 @< Element 2 + element3: F64 @< Element 3 + } + +} diff --git a/Fw/SerializableFile/test/TestSerializable/TestSerializableAi.xml b/Fw/SerializableFile/test/TestSerializable/TestSerializableAi.xml deleted file mode 100644 index 18bde2d741..0000000000 --- a/Fw/SerializableFile/test/TestSerializable/TestSerializableAi.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - Test struct - - - - - - - diff --git a/config/FpConfig.h b/config/FpConfig.h index a280264cd3..192c46a4f6 100644 --- a/config/FpConfig.h +++ b/config/FpConfig.h @@ -233,14 +233,6 @@ typedef FwIndexType FwQueueSizeType; #endif #endif -// When querying an object as to an object-specific description, this specifies the size of the buffer to store the -// description. -#if FW_OBJECT_TO_STRING -#ifndef FW_OBJ_TO_STRING_BUFFER_SIZE -#define FW_OBJ_TO_STRING_BUFFER_SIZE 255 //!< Size of string storing toString() text -#endif -#endif - #if FW_OBJECT_REGISTRATION // For the simple object registry provided with the framework, this specifies how many objects the registry will store. #ifndef FW_OBJ_SIMPLE_REG_ENTRIES @@ -352,23 +344,6 @@ typedef FwIndexType FwQueueSizeType; #define FW_SERIALIZABLE_TO_STRING 1 //!< Indicates if autocoded serializables have toString() methods #endif -#if FW_SERIALIZABLE_TO_STRING -#ifndef FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE -#define FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE 255 //!< Size of string to store toString() string output -#endif -#endif - -// Define if arrays have toString() method. -#ifndef FW_ARRAY_TO_STRING -#define FW_ARRAY_TO_STRING 1 //!< Indicates if autocoded arrays have toString() methods -#endif - -#if FW_ARRAY_TO_STRING -#ifndef FW_ARRAY_TO_STRING_BUFFER_SIZE -#define FW_ARRAY_TO_STRING_BUFFER_SIZE 256 //!< Size of string to store toString() string output -#endif -#endif - // Some settings to enable AMPCS compatibility. This breaks regular ISF GUI compatibility #ifndef FW_AMPCS_COMPATIBLE #define FW_AMPCS_COMPATIBLE 0 //!< Whether or not JPL AMPCS ground system support is enabled. diff --git a/requirements.txt b/requirements.txt index 43a2ccc506..c3893fb9ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,18 +18,18 @@ 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.0a11 -fprime-fpp-depend==2.1.0a11 -fprime-fpp-filenames==2.1.0a11 -fprime-fpp-format==2.1.0a11 -fprime-fpp-from-xml==2.1.0a11 -fprime-fpp-locate-defs==2.1.0a11 -fprime-fpp-locate-uses==2.1.0a11 -fprime-fpp-syntax==2.1.0a11 -fprime-fpp-to-cpp==2.1.0a11 -fprime-fpp-to-dict==2.1.0a11 -fprime-fpp-to-json==2.1.0a11 -fprime-fpp-to-xml==2.1.0a11 +fprime-fpp-check==2.1.0a12 +fprime-fpp-depend==2.1.0a12 +fprime-fpp-filenames==2.1.0a12 +fprime-fpp-format==2.1.0a12 +fprime-fpp-from-xml==2.1.0a12 +fprime-fpp-locate-defs==2.1.0a12 +fprime-fpp-locate-uses==2.1.0a12 +fprime-fpp-syntax==2.1.0a12 +fprime-fpp-to-cpp==2.1.0a12 +fprime-fpp-to-dict==2.1.0a12 +fprime-fpp-to-json==2.1.0a12 +fprime-fpp-to-xml==2.1.0a12 fprime-gds==3.4.3 fprime-tools==3.4.4 fprime-visual==1.0.2 From 58604e0df97072a7f5d167fdb5b25c2285980112 Mon Sep 17 00:00:00 2001 From: Ali Mosallaei Date: Thu, 18 Jul 2024 11:01:43 -0700 Subject: [PATCH 6/6] Update spelling --- .github/actions/spelling/expect.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 0c29aeafd0..f9a430040a 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -1010,6 +1010,10 @@ subhistory subpage subseconds subtargets +subtopology +subtopologies +Subtopology +Subtopologies suppr suseconds SVCLOGFILE @@ -1207,3 +1211,6 @@ xxxx yacgen yqq zmq + +mosa +aei \ No newline at end of file