From 1dc5b0973f5563c492560a05cbe337f1ec957618 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 24 Aug 2025 17:14:44 -0500 Subject: [PATCH 1/5] Add pre-commit linting --- .pre-commit-config.yaml | 5 ++ CMakePresets.json | 35 ++++----- .../Components/FatalHandler/FatalHandler.cpp | 59 ++++++--------- .../Components/FatalHandler/FatalHandler.hpp | 71 +++++++++---------- FprimeZephyrReference/Components/Led/Led.cpp | 7 +- FprimeZephyrReference/Components/Led/Led.hpp | 60 ++++++++-------- .../ReferenceDeployment/Main.cpp | 12 ++-- .../Top/ReferenceDeploymentTopology.cpp | 17 +++-- .../Top/ReferenceDeploymentTopology.hpp | 8 +-- .../Top/ReferenceDeploymentTopologyDefs.hpp | 29 ++++---- .../config/CommandDispatcherImplCfg.hpp | 6 +- .../project/config/FpConfig.h | 8 +-- .../project/config/TlmPacketizerCfg.hpp | 5 +- Makefile | 9 +++ fprime-gds.yml => fprime-gds.yaml | 0 15 files changed, 159 insertions(+), 172 deletions(-) create mode 100644 .pre-commit-config.yaml rename fprime-gds.yml => fprime-gds.yaml (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..21e55e90 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: +- repo: https://github.com/pre-commit/mirrors-clang-format + rev: v20.1.8 + hooks: + - id: clang-format diff --git a/CMakePresets.json b/CMakePresets.json index a00304e1..28b29cdf 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,21 +1,22 @@ { "version": 4, "configurePresets": [ - { - "name": "fprime-zephyr-teensy41", - "displayName": "F´ Zephyr (teensy41)", - "description": "F´ release build using local fprime-venv", - "binaryDir": "${sourceDir}/build-fprime-automatic-zephyr", - "environment": { - "VIRTUAL_ENV": "${fileDir}/fprime-venv", - "PATH": "$env{VIRTUAL_ENV}/bin:$penv{PATH}" - }, - "cacheVariables": { - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", - "CMAKE_BUILD_TYPE": "Release", - "BOARD": "teensy41" - }, - "toolchainFile": "${fileDir}/lib/fprime-zephyr/cmake/toolchain/zephyr.cmake", - "generator": "Ninja" - }] + { + "name": "fprime-zephyr-teensy41", + "displayName": "F´ Zephyr (teensy41)", + "description": "F´ release build using local fprime-venv", + "binaryDir": "${sourceDir}/build-fprime-automatic-zephyr", + "environment": { + "VIRTUAL_ENV": "${fileDir}/fprime-venv", + "PATH": "$env{VIRTUAL_ENV}/bin:$penv{PATH}" + }, + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_BUILD_TYPE": "Release", + "BOARD": "teensy41" + }, + "toolchainFile": "${fileDir}/lib/fprime-zephyr/cmake/toolchain/zephyr.cmake", + "generator": "Ninja" + } + ] } diff --git a/FprimeZephyrReference/Components/FatalHandler/FatalHandler.cpp b/FprimeZephyrReference/Components/FatalHandler/FatalHandler.cpp index 21e72039..b57d4d49 100644 --- a/FprimeZephyrReference/Components/FatalHandler/FatalHandler.cpp +++ b/FprimeZephyrReference/Components/FatalHandler/FatalHandler.cpp @@ -10,52 +10,39 @@ // // ====================================================================== -#include +#include #include #include -#include +#include namespace Components { - // ---------------------------------------------------------------------- - // Construction, initialization, and destruction - // ---------------------------------------------------------------------- +// ---------------------------------------------------------------------- +// Construction, initialization, and destruction +// ---------------------------------------------------------------------- - FatalHandler :: - FatalHandler( - const char *const compName - ) : FatalHandlerComponentBase(compName) - { +FatalHandler ::FatalHandler(const char* const compName) : FatalHandlerComponentBase(compName) {} - } +FatalHandler ::~FatalHandler() {} - FatalHandler :: - ~FatalHandler() - { - - } - - void FatalHandler::reboot() { - // When running in CI failsafe mode and the board is a teensy, - // then we should invoke bkpt #251 to trigger the soft reboot enabling a - // flash of new software - #if defined(FPRIME_CI_FAILSAFE_CYCLE_COUNT) - // Magic bootloader breakpoint, provided by PRJC - if (strncmp(CONFIG_BOARD, "teensy", 6) == 0) { +void FatalHandler::reboot() { +// When running in CI failsafe mode and the board is a teensy, +// then we should invoke bkpt #251 to trigger the soft reboot enabling a +// flash of new software +#if defined(FPRIME_CI_FAILSAFE_CYCLE_COUNT) + // Magic bootloader breakpoint, provided by PRJC + if (strncmp(CONFIG_BOARD, "teensy", 6) == 0) { asm("bkpt #251"); - } - #endif + } +#endif // Otherwise, use Zephyr to reboot the system sys_reboot(SYS_REBOOT_COLD); - } - - void FatalHandler::FatalReceive_handler( - const FwIndexType portNum, - FwEventIdType Id) { - Fw::Logger::log("FATAL %" PRI_FwEventIdType "handled.\n",Id); - Os::Task::delay(Fw::TimeInterval(0, 1000)); // Delay to allow log to be processed - this->reboot(); // Reboot the system - } +} +void FatalHandler::FatalReceive_handler(const FwIndexType portNum, FwEventIdType Id) { + Fw::Logger::log("FATAL %" PRI_FwEventIdType "handled.\n", Id); + Os::Task::delay(Fw::TimeInterval(0, 1000)); // Delay to allow log to be processed + this->reboot(); // Reboot the system +} -} // end namespace Svc +} // namespace Components diff --git a/FprimeZephyrReference/Components/FatalHandler/FatalHandler.hpp b/FprimeZephyrReference/Components/FatalHandler/FatalHandler.hpp index ccf9ed8b..b014fcdf 100644 --- a/FprimeZephyrReference/Components/FatalHandler/FatalHandler.hpp +++ b/FprimeZephyrReference/Components/FatalHandler/FatalHandler.hpp @@ -17,44 +17,37 @@ namespace Components { - class FatalHandler final : - public FatalHandlerComponentBase - { - - public: - - // ---------------------------------------------------------------------- - // Construction, initialization, and destruction - // ---------------------------------------------------------------------- - - //! Construct object FatalHandler - //! - FatalHandler( - const char *const compName /*!< The component name*/ - ); - - //! Destroy object FatalHandler - //! - ~FatalHandler(); - - //! Reboot the device - //! - void reboot(); - - private: - - // ---------------------------------------------------------------------- - // Handler implementations for user-defined typed input ports - // ---------------------------------------------------------------------- - - //! Handler implementation for FatalReceive - //! - void FatalReceive_handler( - const FwIndexType portNum, /*!< The port number*/ - FwEventIdType Id /*!< The ID of the FATAL event*/ - ); - }; - -} // end namespace Svc +class FatalHandler final : public FatalHandlerComponentBase { + public: + // ---------------------------------------------------------------------- + // Construction, initialization, and destruction + // ---------------------------------------------------------------------- + + //! Construct object FatalHandler + //! + FatalHandler(const char* const compName /*!< The component name*/ + ); + + //! Destroy object FatalHandler + //! + ~FatalHandler(); + + //! Reboot the device + //! + void reboot(); + + private: + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for FatalReceive + //! + void FatalReceive_handler(const FwIndexType portNum, /*!< The port number*/ + FwEventIdType Id /*!< The ID of the FATAL event*/ + ); +}; + +} // namespace Components #endif diff --git a/FprimeZephyrReference/Components/Led/Led.cpp b/FprimeZephyrReference/Components/Led/Led.cpp index 005ae53d..4acc13ff 100644 --- a/FprimeZephyrReference/Components/Led/Led.cpp +++ b/FprimeZephyrReference/Components/Led/Led.cpp @@ -22,8 +22,7 @@ Led ::~Led() {} // ---------------------------------------------------------------------- void Led ::run_handler(FwIndexType portNum, U32 context) { - - U32 interval = this->m_blinkInterval; // Get the blink interval from the member variable + U32 interval = this->m_blinkInterval; // Get the blink interval from the member variable // Only perform actions when set to blinking if (this->m_blinking && (interval != 0)) { @@ -77,10 +76,10 @@ void Led ::BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::On on void Led ::SET_BLINK_INTERVAL_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 interval) { // Update the member variable this->m_blinkInterval = interval; - + // Log the event this->log_ACTIVITY_HI_BlinkIntervalSet(interval); - + // Provide command response this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } diff --git a/FprimeZephyrReference/Components/Led/Led.hpp b/FprimeZephyrReference/Components/Led/Led.hpp index 0be4df17..9053c61b 100644 --- a/FprimeZephyrReference/Components/Led/Led.hpp +++ b/FprimeZephyrReference/Components/Led/Led.hpp @@ -24,42 +24,38 @@ class Led : public LedComponentBase { //! Destroy Led object ~Led(); - private : + private: + // ---------------------------------------------------------------------- + // Handler implementations for user-defined typed input ports + // ---------------------------------------------------------------------- - // ---------------------------------------------------------------------- - // Handler implementations for user-defined typed input ports - // ---------------------------------------------------------------------- + //! Handler implementation for run + //! + //! Port receiving calls from the rate group + void run_handler(FwIndexType portNum, //!< The port number + U32 context //!< The call order + ) override; - //! Handler implementation for run - //! - //! Port receiving calls from the rate group - void - run_handler(FwIndexType portNum, //!< The port number - U32 context //!< The call order - ) override; + private: + // ---------------------------------------------------------------------- + // Handler implementations for commands + // ---------------------------------------------------------------------- - private : - // ---------------------------------------------------------------------- - // Handler implementations for commands - // ---------------------------------------------------------------------- + //! Handler implementation for command BLINKING_ON_OFF + //! + //! Command to turn on or off the blinking LED + void BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, //!< The opcode + U32 cmdSeq, //!< The command sequence number + Fw::On onOff //!< Indicates whether the blinking should be on or off + ) override; - //! Handler implementation for command BLINKING_ON_OFF - //! - //! Command to turn on or off the blinking LED - void - BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, //!< The opcode - U32 cmdSeq, //!< The command sequence number - Fw::On onOff //!< Indicates whether the blinking should be on or off - ) override; - - //! Handler implementation for command SET_BLINK_INTERVAL - //! - //! Command to set the LED blink interval - void - SET_BLINK_INTERVAL_cmdHandler(FwOpcodeType opCode, //!< The opcode - U32 cmdSeq, //!< The command sequence number - U32 interval //!< Blink interval in rate group ticks - ) override; + //! Handler implementation for command SET_BLINK_INTERVAL + //! + //! Command to set the LED blink interval + void SET_BLINK_INTERVAL_cmdHandler(FwOpcodeType opCode, //!< The opcode + U32 cmdSeq, //!< The command sequence number + U32 interval //!< Blink interval in rate group ticks + ) override; Fw::On m_state = Fw::On::OFF; //! Keeps track if LED is on or off U64 m_transitions = 0; //! The number of on/off transitions that have occurred diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index a1eb8db5..249c32bc 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -4,11 +4,11 @@ // // ====================================================================== // Used to access topology functions -#include -#include #include +#include +#include -const struct device *serial = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart0)); +const struct device* serial = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart0)); int main(int argc, char* argv[]) { // ** DO NOT REMOVE **// @@ -16,16 +16,16 @@ int main(int argc, char* argv[]) { // This sleep is necessary to allow the USB CDC ACM interface to initialize before // the application starts writing to it. k_sleep(K_MSEC(3000)); - + Os::init(); // Object for communicating state to the topology ReferenceDeployment::TopologyState inputs; inputs.uartDevice = serial; inputs.baudRate = 115200; - + // Setup, cycle, and teardown topology ReferenceDeployment::setupTopology(inputs); - ReferenceDeployment::startRateGroups(); // Program loop + ReferenceDeployment::startRateGroups(); // Program loop ReferenceDeployment::teardownTopology(inputs); return 0; } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 83442107..e9bfd734 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -6,7 +6,7 @@ // Provides access to autocoded functions #include // Note: Uncomment when using Svc:TlmPacketizer -//#include +// #include // Necessary project-specified types #include @@ -21,7 +21,7 @@ using namespace ReferenceDeployment; // Instantiate a malloc allocator for cmdSeq buffer allocation Fw::MallocAllocator mallocator; -constexpr FwSizeType BASE_RATEGROUP_PERIOD_MS = 1; // 1Khz +constexpr FwSizeType BASE_RATEGROUP_PERIOD_MS = 1; // 1Khz // Helper function to calculate the period for a given rate group frequency constexpr FwSizeType getRateGroupPeriod(const FwSizeType hz) { @@ -29,12 +29,11 @@ constexpr FwSizeType getRateGroupPeriod(const FwSizeType hz) { } // The reference topology divides the incoming clock signal (1Hz) into sub-signals: 1Hz, 1/2Hz, and 1/4Hz with 0 offset -Svc::RateGroupDriver::DividerSet rateGroupDivisorsSet{ - { // Array of divider objects - {getRateGroupPeriod(10), 0}, // 10Hz - {getRateGroupPeriod(1), 0}, // 1Hz - } -}; +Svc::RateGroupDriver::DividerSet rateGroupDivisorsSet{{ + // Array of divider objects + {getRateGroupPeriod(10), 0}, // 10Hz + {getRateGroupPeriod(1), 0}, // 1Hz +}}; // Rate groups may supply a context token to each of the attached children whose purpose is set by the project. The // reference topology sets each token to zero as these contexts are unused in this project. @@ -77,7 +76,7 @@ void setupTopology(const TopologyState& state) { loadParameters(); // Autocoded task kick-off (active components). Function provided by autocoder. startTasks(state); - + // Uplink is configured for receive so a socket task is started comDriver.configure(state.uartDevice, state.baudRate); } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.hpp index 82f4af80..0ffdcf17 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.hpp @@ -5,8 +5,8 @@ // ====================================================================== #ifndef REFERENCEDEPLOYMENT_REFERENCEDEPLOYMENTTOPOLOGY_HPP #define REFERENCEDEPLOYMENT_REFERENCEDEPLOYMENTTOPOLOGY_HPP -// Included for access to ReferenceDeployment::TopologyState and ReferenceDeployment::ConfigObjects::pingEntries. These definitions are required by the -// autocoder, but are also used in this hand-coded topology. +// Included for access to ReferenceDeployment::TopologyState and ReferenceDeployment::ConfigObjects::pingEntries. These +// definitions are required by the autocoder, but are also used in this hand-coded topology. #include // Remove unnecessary ReferenceDeployment:: qualifications @@ -68,11 +68,11 @@ void teardownTopology(const TopologyState& state); void startRateGroups(); /** - * \brief stop the rate groups + * \brief stop the rate groups * * This stops the cycle started by startRateGroups. */ void stopRateGroups(); -} // namespace ReferenceDeployment +} // namespace ReferenceDeployment #endif diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp index 567ce16d..b450324b 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp @@ -16,17 +16,16 @@ #include "Svc/Subtopologies/CdhCore/SubtopologyTopologyDefs.hpp" #include "Svc/Subtopologies/ComCcsds/SubtopologyTopologyDefs.hpp" -//ComCcsds Enum Includes -#include "Svc/Subtopologies/ComCcsds/Ports_ComPacketQueueEnumAc.hpp" +// ComCcsds Enum Includes #include "Svc/Subtopologies/ComCcsds/Ports_ComBufferQueueEnumAc.hpp" +#include "Svc/Subtopologies/ComCcsds/Ports_ComPacketQueueEnumAc.hpp" // Include autocoded FPP constants #include "FprimeZephyrReference/ReferenceDeployment/Top/FppConstantsAc.hpp" -#include #include #include - +#include /** * \brief required ping constants @@ -48,8 +47,12 @@ * ``` */ namespace PingEntries { - namespace ReferenceDeployment_rateGroup10Hz {enum { WARN = 3, FATAL = 5 };} - namespace ReferenceDeployment_rateGroup1Hz {enum { WARN = 3, FATAL = 5 };} +namespace ReferenceDeployment_rateGroup10Hz { +enum { WARN = 3, FATAL = 5 }; +} +namespace ReferenceDeployment_rateGroup1Hz { +enum { WARN = 3, FATAL = 5 }; +} } // namespace PingEntries // Definitions are placed within a namespace named after the deployment @@ -58,15 +61,15 @@ namespace ReferenceDeployment { /** * \brief required type definition to carry state * - * The topology autocoder requires an object that carries state with the name `ReferenceDeployment::TopologyState`. Only the type - * definition is required by the autocoder and the contents of this object are otherwise opaque to the autocoder. The - * contents are entirely up to the definition of the project. This deployment uses subtopologies. + * The topology autocoder requires an object that carries state with the name `ReferenceDeployment::TopologyState`. Only + * the type definition is required by the autocoder and the contents of this object are otherwise opaque to the + * autocoder. The contents are entirely up to the definition of the project. This deployment uses subtopologies. */ struct TopologyState { - const device* uartDevice; //!< UART device path for communication - U32 baudRate; //!< Baud rate for UART communication - CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore - ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds + const device* uartDevice; //!< UART device path for communication + U32 baudRate; //!< Baud rate for UART communication + CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore + ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds }; namespace PingEntries = ::PingEntries; diff --git a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp index f171cffc..a0257cff 100644 --- a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp +++ b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp @@ -11,10 +11,8 @@ // Define configuration values for dispatcher enum { - CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 21, // !< The size of the table holding opcodes to dispatch - CMD_DISPATCHER_SEQUENCER_TABLE_SIZE = 10, // !< The size of the table holding commands in progress + CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 21, // !< The size of the table holding opcodes to dispatch + CMD_DISPATCHER_SEQUENCER_TABLE_SIZE = 10, // !< The size of the table holding commands in progress }; - - #endif /* CMDDISPATCHER_COMMANDDISPATCHERIMPLCFG_HPP_ */ diff --git a/FprimeZephyrReference/project/config/FpConfig.h b/FprimeZephyrReference/project/config/FpConfig.h index 7bb7d03d..3adfa68c 100644 --- a/FprimeZephyrReference/project/config/FpConfig.h +++ b/FprimeZephyrReference/project/config/FpConfig.h @@ -11,19 +11,17 @@ #ifndef FPCONFIG_H_ #define FPCONFIG_H_ -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif -#include #include - +#include // ---------------------------------------------------------------------- // Type aliases // ---------------------------------------------------------------------- #define FW_CONTEXT_DONT_CARE 0xFF //!< Don't care value for time contexts in sequences - // ---------------------------------------------------------------------- // Configuration switches // ---------------------------------------------------------------------- @@ -331,7 +329,7 @@ extern "C" { // *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have // the type definitions in Fw/Types/BasicTypes available. -#ifdef __cplusplus +#ifdef __cplusplus } #endif diff --git a/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp b/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp index 65a5a3d0..1a9daca1 100644 --- a/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp +++ b/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp @@ -24,9 +24,8 @@ static const FwChanIdType TLMPACKETIZER_HASH_MOD_VALUE = 999; // !< The modulo value of the hashing function. // Should be set to a little below the ID gaps to spread the entries around -static const FwChanIdType TLMPACKETIZER_HASH_BUCKETS = - 40; // !< Buckets assignable to a hash slot. - // Buckets must be >= number of telemetry channels in system +static const FwChanIdType TLMPACKETIZER_HASH_BUCKETS = 40; // !< Buckets assignable to a hash slot. + // Buckets must be >= number of telemetry channels in system static const FwChanIdType TLMPACKETIZER_MAX_MISSING_TLM_CHECK = 25; // !< Maximum number of missing telemetry channel checks diff --git a/Makefile b/Makefile index 87ea7e6d..2343252d 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,15 @@ zephyr-setup: uv ## Set up Zephyr environment ##@ Development +.PHONY: pre-commit-install +pre-commit-install: uv + @echo "Installing pre-commit hooks..." + @$(UVX) pre-commit install > /dev/null + +.PHONY: fmt +fmt: pre-commit-install ## Lint and format files + $(UVX) pre-commit run --all-files + .PHONY: generate generate: fprime-venv zephyr-setup ## Generate FPrime-Zephyr Proves Core Reference @echo "Generating FPrime-Zephyr Proves Core Reference..." diff --git a/fprime-gds.yml b/fprime-gds.yaml similarity index 100% rename from fprime-gds.yml rename to fprime-gds.yaml From 587efdf229348b516a0fd45adfc02f65d47bec70 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 24 Aug 2025 17:28:26 -0500 Subject: [PATCH 2/5] Add additional linters --- .clang-format | 2 +- .github/workflows/ci.yaml | 10 +++++-- .pre-commit-config.yaml | 14 ++++++++++ CMakeLists.txt | 4 +-- CMakePresets.json | 26 +++++++++---------- .../Components/Led/CMakeLists.txt | 1 - FprimeZephyrReference/Components/Led/Led.cpp | 2 +- FprimeZephyrReference/Components/Led/Led.fpp | 2 +- FprimeZephyrReference/Components/Led/Led.hpp | 2 +- .../ReferenceDeployment/CMakeLists.txt | 4 +-- .../ReferenceDeployment/README.md | 4 +-- .../ReferenceDeployment/Top/instances.fpp | 2 +- .../ReferenceDeployment/Top/topology.fpp | 10 +++---- .../project/config/CdhCoreConfig.fpp | 4 +-- .../project/config/CdhCoreTlmConfig.fpp | 4 +-- .../project/config/ComCcsdsConfig.fpp | 16 ++++++------ Kconfig | 2 +- Makefile | 2 +- README.md | 6 ++--- docs/additional-resources/board-list.md | 4 +-- .../specifying-board-configuration.md | 8 +++--- docs/additional-resources/troubleshooting.md | 2 +- docs/additional-resources/wsl-notes.md | 8 +++--- docs/main-content/build-flash-run.md | 8 +++--- docs/main-content/initial-setup.md | 2 +- .../Arduino-STM32CubeProgrammer-Arm-Issue.md | 4 +-- docs/uploading/stm32/stm32.md | 4 +-- docs/uploading/teensy.md | 2 +- fprime-gds.yaml | 1 - prj.conf | 16 ++++++------ 30 files changed, 97 insertions(+), 79 deletions(-) diff --git a/.clang-format b/.clang-format index 7ad9489e..65fb646f 100644 --- a/.clang-format +++ b/.clang-format @@ -2,4 +2,4 @@ BasedOnStyle: Chromium IndentWidth: 4 ColumnLimit: 120 -AccessModifierOffset: -2 \ No newline at end of file +AccessModifierOffset: -2 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8cbe837b..3f55757c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,13 +7,20 @@ on: - main jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Lint + run: | + make fmt build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build run: | - make + make build - name: Archive uses: actions/upload-artifact@v4 with: @@ -21,4 +28,3 @@ jobs: path: | build-artifacts/zephyr.uf2 build-artifacts/zephyr/fprime-zephyr-deployment/dict/ReferenceDeploymentTopologyDictionary.json - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 21e55e90..0ad6aaff 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,18 @@ repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-json + - id: check-added-large-files + +- repo: https://github.com/codespell-project/codespell + rev: v2.4.1 + hooks: + - id: codespell + - repo: https://github.com/pre-commit/mirrors-clang-format rev: v20.1.8 hooks: diff --git a/CMakeLists.txt b/CMakeLists.txt index 9745e670..6e48a7ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,8 @@ endif() find_package(Zephyr HINTS "${CMAKE_CURRENT_LIST_DIR}/lib/zephyr-workspace") project(fprime-zephyr-reference C CXX) -# Put in an option to force the device back into programable state for automated testing -option(FPRIME_CI_FAILSAFE_ENABLED "Cycle count before a forced reset to programable state" OFF) +# Put in an option to force the device back into programmable state for automated testing +option(FPRIME_CI_FAILSAFE_ENABLED "Cycle count before a forced reset to programmable state" OFF) if (FPRIME_CI_FAILSAFE_ENABLED) set(FPRIME_CI_FAILSAFE_CYCLE_COUNT 6000 CACHE STRING "Cycles before a forced reset") add_compile_definitions(FPRIME_CI_FAILSAFE_CYCLE_COUNT=${FPRIME_CI_FAILSAFE_CYCLE_COUNT}) diff --git a/CMakePresets.json b/CMakePresets.json index 28b29cdf..ba50b3ba 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,22 +1,22 @@ { - "version": 4, "configurePresets": [ { - "name": "fprime-zephyr-teensy41", - "displayName": "F´ Zephyr (teensy41)", - "description": "F´ release build using local fprime-venv", "binaryDir": "${sourceDir}/build-fprime-automatic-zephyr", - "environment": { - "VIRTUAL_ENV": "${fileDir}/fprime-venv", - "PATH": "$env{VIRTUAL_ENV}/bin:$penv{PATH}" - }, "cacheVariables": { - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "BOARD": "teensy41", "CMAKE_BUILD_TYPE": "Release", - "BOARD": "teensy41" + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" }, - "toolchainFile": "${fileDir}/lib/fprime-zephyr/cmake/toolchain/zephyr.cmake", - "generator": "Ninja" + "description": "F\u00b4 release build using local fprime-venv", + "displayName": "F\u00b4 Zephyr (teensy41)", + "environment": { + "PATH": "$env{VIRTUAL_ENV}/bin:$penv{PATH}", + "VIRTUAL_ENV": "${fileDir}/fprime-venv" + }, + "generator": "Ninja", + "name": "fprime-zephyr-teensy41", + "toolchainFile": "${fileDir}/lib/fprime-zephyr/cmake/toolchain/zephyr.cmake" } - ] + ], + "version": 4 } diff --git a/FprimeZephyrReference/Components/Led/CMakeLists.txt b/FprimeZephyrReference/Components/Led/CMakeLists.txt index e1d0aad6..9b5d865d 100644 --- a/FprimeZephyrReference/Components/Led/CMakeLists.txt +++ b/FprimeZephyrReference/Components/Led/CMakeLists.txt @@ -22,4 +22,3 @@ register_fprime_library( # DEPENDS # MyPackage_MyOtherModule ) - diff --git a/FprimeZephyrReference/Components/Led/Led.cpp b/FprimeZephyrReference/Components/Led/Led.cpp index 4acc13ff..7fbdde09 100644 --- a/FprimeZephyrReference/Components/Led/Led.cpp +++ b/FprimeZephyrReference/Components/Led/Led.cpp @@ -84,4 +84,4 @@ void Led ::SET_BLINK_INTERVAL_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 in this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } -} // namespace Components \ No newline at end of file +} // namespace Components diff --git a/FprimeZephyrReference/Components/Led/Led.fpp b/FprimeZephyrReference/Components/Led/Led.fpp index 5b82d11d..a190f6ef 100644 --- a/FprimeZephyrReference/Components/Led/Led.fpp +++ b/FprimeZephyrReference/Components/Led/Led.fpp @@ -64,4 +64,4 @@ module Components { telemetry port tlmOut } -} \ No newline at end of file +} diff --git a/FprimeZephyrReference/Components/Led/Led.hpp b/FprimeZephyrReference/Components/Led/Led.hpp index 9053c61b..f24cd3b2 100644 --- a/FprimeZephyrReference/Components/Led/Led.hpp +++ b/FprimeZephyrReference/Components/Led/Led.hpp @@ -68,4 +68,4 @@ class Led : public LedComponentBase { } // namespace Components -#endif \ No newline at end of file +#endif diff --git a/FprimeZephyrReference/ReferenceDeployment/CMakeLists.txt b/FprimeZephyrReference/ReferenceDeployment/CMakeLists.txt index 60303a1a..26438399 100644 --- a/FprimeZephyrReference/ReferenceDeployment/CMakeLists.txt +++ b/FprimeZephyrReference/ReferenceDeployment/CMakeLists.txt @@ -1,8 +1,8 @@ ##### # 'ReferenceDeployment' Deployment: # -# This registers the 'ReferenceDeployment' deployment to the build system. -# Custom components that have not been added at the project-level should be added to +# This registers the 'ReferenceDeployment' deployment to the build system. +# Custom components that have not been added at the project-level should be added to # the list below. # ##### diff --git a/FprimeZephyrReference/ReferenceDeployment/README.md b/FprimeZephyrReference/ReferenceDeployment/README.md index bc95ebdd..04a00079 100644 --- a/FprimeZephyrReference/ReferenceDeployment/README.md +++ b/FprimeZephyrReference/ReferenceDeployment/README.md @@ -31,7 +31,7 @@ fprime-gds - **CdhCore**: Command & Data Handling - Command dispatching and event management - - Event logging and telemetry collection + - Event logging and telemetry collection - Health monitoring system - Fatal error handling @@ -48,4 +48,4 @@ fprime-gds - **DataProducts**: Data Product Management - Data product cataloging - Storage and retrieval capabilities - - Product metadata management \ No newline at end of file + - Product metadata management diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index a0618010..8f3f7fb1 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -35,7 +35,7 @@ module ReferenceDeployment { queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 4 - + instance led: Components.Led base id 0x10003000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 2b93416d..02cba056 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -16,7 +16,7 @@ module ReferenceDeployment { # ---------------------------------------------------------------------- import CdhCore.Subtopology import ComCcsds.Subtopology - + # ---------------------------------------------------------------------- # Instances used in the topology # ---------------------------------------------------------------------- @@ -58,18 +58,18 @@ module ReferenceDeployment { # Router to Command Dispatcher ComCcsds.fprimeRouter.commandOut -> CdhCore.cmdDisp.seqCmdBuff CdhCore.cmdDisp.seqCmdStatus -> ComCcsds.fprimeRouter.cmdResponseIn - + } connections Communications { # ComDriver buffer allocations comDriver.allocate -> ComCcsds.commsBufferManager.bufferGetCallee comDriver.deallocate -> ComCcsds.commsBufferManager.bufferSendIn - + # ComDriver <-> ComStub (Uplink) comDriver.$recv -> ComCcsds.comStub.drvReceiveIn ComCcsds.comStub.drvReceiveReturnOut -> comDriver.recvReturnIn - + # ComStub <-> ComDriver (Downlink) ComCcsds.comStub.drvSendOut -> comDriver.$send comDriver.ready -> ComCcsds.comStub.drvConnected @@ -92,7 +92,7 @@ module ReferenceDeployment { } connections LedBlinker { - # Rate Group 1 (1Hz cycle) ouput is connected to led's run input + # Rate Group 1 (1Hz cycle) output is connected to led's run input rateGroup1Hz.RateGroupMemberOut[4] -> led.run # led's gpioSet output is connected to gpioDriver's gpioWrite input led.gpioSet -> gpioDriver.gpioWrite diff --git a/FprimeZephyrReference/project/config/CdhCoreConfig.fpp b/FprimeZephyrReference/project/config/CdhCoreConfig.fpp index f108f32e..40ad28a8 100644 --- a/FprimeZephyrReference/project/config/CdhCoreConfig.fpp +++ b/FprimeZephyrReference/project/config/CdhCoreConfig.fpp @@ -1,14 +1,14 @@ module CdhCoreConfig { #Base ID for the CdhCore Subtopology, all components are offsets from this base ID constant BASE_ID = 0x01000000 - + module QueueSizes { constant cmdDisp = 10 constant events = 25 constant tlmSend = 5 constant $health = 10 } - + module StackSizes { constant cmdDisp = 8 * 1024 # Must match prj.conf thread stack size diff --git a/FprimeZephyrReference/project/config/CdhCoreTlmConfig.fpp b/FprimeZephyrReference/project/config/CdhCoreTlmConfig.fpp index 04679e68..81c604fd 100644 --- a/FprimeZephyrReference/project/config/CdhCoreTlmConfig.fpp +++ b/FprimeZephyrReference/project/config/CdhCoreTlmConfig.fpp @@ -10,8 +10,8 @@ module CdhCore{ # This name will need to be updated if wishing to use this in a custom deployment phase Fpp.ToCpp.Phases.configComponents """ CdhCore::tlmSend.setPacketList( - ReferenceDeployment::ReferenceDeployment_ReferenceDeploymentPacketsTlmPackets::packetList, - ReferenceDeployment::ReferenceDeployment_ReferenceDeploymentPacketsTlmPackets::omittedChannels, + ReferenceDeployment::ReferenceDeployment_ReferenceDeploymentPacketsTlmPackets::packetList, + ReferenceDeployment::ReferenceDeployment_ReferenceDeploymentPacketsTlmPackets::omittedChannels, 1 ); """ diff --git a/FprimeZephyrReference/project/config/ComCcsdsConfig.fpp b/FprimeZephyrReference/project/config/ComCcsdsConfig.fpp index e6a7eb30..4f8bc6db 100644 --- a/FprimeZephyrReference/project/config/ComCcsdsConfig.fpp +++ b/FprimeZephyrReference/project/config/ComCcsdsConfig.fpp @@ -1,11 +1,11 @@ module ComCcsdsConfig { #Base ID for the ComCcsds Subtopology, all components are offsets from this base ID constant BASE_ID = 0x02000000 - + module QueueSizes { constant comQueue = 10 } - + module StackSizes { constant comQueue = 8 * 1024 # Must match prj.conf thread stack size } @@ -16,15 +16,15 @@ module ComCcsdsConfig { # Queue configuration constants module QueueDepths { - constant events = 20 - constant tlm = 20 - constant file = 1 + constant events = 20 + constant tlm = 20 + constant file = 1 } module QueuePriorities { - constant events = 0 - constant tlm = 2 - constant file = 1 + constant events = 0 + constant tlm = 2 + constant file = 1 } # Buffer management constants diff --git a/Kconfig b/Kconfig index fe12d8a0..2aff31aa 100644 --- a/Kconfig +++ b/Kconfig @@ -22,4 +22,4 @@ config FPRIME config APP_WIPE_STORAGE bool "Option to clear the flash area before mounting" help - Use this to force an existing file system to be created. \ No newline at end of file + Use this to force an existing file system to be created. diff --git a/Makefile b/Makefile index 2343252d..652cc7aa 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ help: ## Display this help. submodules: ## Initialize and update git submodules @echo "Initializing and updating git submodules..." git submodule update --init --recursive - + export VIRTUAL_ENV ?= $(shell pwd)/fprime-venv fprime-venv: uv ## Create a virtual environment @test -s $(VIRTUAL_ENV) || { \ diff --git a/README.md b/README.md index 0b6d9040..74d41fb3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Proves Core Reference Project -This is a reference software implementation for the [Proves Kit](https://docs.proveskit.space/en/latest/). +This is a reference software implementation for the [Proves Kit](https://docs.proveskit.space/en/latest/). ## System Requirements - F Prime System Requirements listed [here](https://fprime.jpl.nasa.gov/latest/docs/getting-started/installing-fprime/#system-requirements) @@ -28,7 +28,7 @@ Run generate from the `proves-core-reference` directory. This generates the buil make generate ``` -Then, and everytime you change code, run +Then, and every time you change code, run ```shell make build @@ -63,7 +63,7 @@ Now you want to install the firmware to the board. make install BOARD_DIR=[path-to-your-board] ``` -Finally, run the fprime-gds. +Finally, run the fprime-gds. ```shell make gds ``` diff --git a/docs/additional-resources/board-list.md b/docs/additional-resources/board-list.md index 339be0b4..3f1cb3c8 100644 --- a/docs/additional-resources/board-list.md +++ b/docs/additional-resources/board-list.md @@ -8,11 +8,11 @@ The following boards were able to successfully deploy this reference deployment. | Board Name | Chip | Toolchain | Date Tested | Board Config | Upload Guide | Notes | | ----------------- | ----------------- | ------------- | ------------- | ------------- | --------------------- | ---------------------------- | | teensy41 | ARM Cortex-M7 | teensy41 | 08/01/2025 | supported | [README][teensy] | | -| NUCLEO-H723ZG | ARM Cortex-M7 | nucleo_h723zg | 08/01/2025 | supported | [README][stm32] | Requires two USB Connecitons | +| NUCLEO-H723ZG | ARM Cortex-M7 | nucleo_h723zg | 08/01/2025 | supported | [README][stm32] | Requires two USB Connections | [stm32]: ../uploading/stm32/stm32.md -[teensy]: ../uploading/teensy.md \ No newline at end of file +[teensy]: ../uploading/teensy.md diff --git a/docs/additional-resources/specifying-board-configuration.md b/docs/additional-resources/specifying-board-configuration.md index e03a5fef..e0e5107a 100644 --- a/docs/additional-resources/specifying-board-configuration.md +++ b/docs/additional-resources/specifying-board-configuration.md @@ -1,5 +1,5 @@ # Specifying Zephyr Board Configuration -This reference deployent can be used for any board running zephyr so long as the correct zephyr board configuration is provided. +This reference deployent can be used for any board running zephyr so long as the correct zephyr board configuration is provided. ## Update the Zephyr West Configuration File @@ -25,7 +25,7 @@ More information on West Configuration files can be found [here](https://docs.ze ## Using Custom Board Configurations - [initial-setup]: ../main-content/initial-setup.md -[custom-board-config]: https://docs.zephyrproject.org/latest/hardware/porting/board_porting.html \ No newline at end of file +[custom-board-config]: https://docs.zephyrproject.org/latest/hardware/porting/board_porting.html diff --git a/docs/additional-resources/troubleshooting.md b/docs/additional-resources/troubleshooting.md index e3ff1e9d..6c2a3526 100644 --- a/docs/additional-resources/troubleshooting.md +++ b/docs/additional-resources/troubleshooting.md @@ -17,4 +17,4 @@ WSL does not natively install USB drivers. Refer to the guide [here][wsl-notes] -[wsl-notes]: ./wsl-notes.md \ No newline at end of file +[wsl-notes]: ./wsl-notes.md diff --git a/docs/additional-resources/wsl-notes.md b/docs/additional-resources/wsl-notes.md index 603eeb66..e63b18db 100644 --- a/docs/additional-resources/wsl-notes.md +++ b/docs/additional-resources/wsl-notes.md @@ -1,10 +1,10 @@ # WSL (Windows 11) Notes WSL natively does not have access to USB devices. To flash the board properly and allow the GDS to communicate with the deployment board via UART over USB, follow these one-time steps. -1. On Powershell as administrator, install and run **usbipd-win**: -Run Powershell as administrator +1. On Powershell as administrator, install and run **usbipd-win**: +Run Powershell as administrator ```sh -winget install dorssel.usbipd-win +winget install dorssel.usbipd-win ``` 2. On Powershell find your USB device: @@ -14,7 +14,7 @@ usbipd list > [!Note] > You should see two STM32 devices listed with different BUSID's. One corresponds to the USB PWR and the other to USER USB. -3. On Powershell bind both devices to USBIPD in two seperate commands (as administrator): +3. On Powershell bind both devices to USBIPD in two separate commands (as administrator): ```sh usbipd bind --busid --wsl ``` diff --git a/docs/main-content/build-flash-run.md b/docs/main-content/build-flash-run.md index 3c37a85b..de204ffd 100644 --- a/docs/main-content/build-flash-run.md +++ b/docs/main-content/build-flash-run.md @@ -30,11 +30,11 @@ Different boards will likely require different steps to flash software onto the sh ~/.arduino15/packages/STMicroelectronics/tools/STM32Tools/2.3.0/stm32CubeProg.sh -i swd -f build-fprime-automatic-zephyr/zephyr/zephyr.hex -c /dev/ttyACM0 # MacOS -sh ~/Library/Arduino15/packages/STMicroelectronics/tools/STM32Tools/2.3.0/stm32CubeProg.sh -i swd -f build-fprime-automatic-zephyr/zephyr/zephyr.hex -c /dev/cu.usbmodem142203 +sh ~/Library/Arduino15/packages/STMicroelectronics/tools/STM32Tools/2.3.0/stm32CubeProg.sh -i swd -f build-fprime-automatic-zephyr/zephyr/zephyr.hex -c /dev/cu.usbmodem142203 ``` > [!Note] -> Change `/dev/ttyACM0` (`/dev/cu.usbmodem141203` for MacOS) to the correct serial device connected to the device. To find the correct serial port, refer to thie documentation [here](https://github.com/ngcp-project/gcs-infrastructure/blob/d34eeba4eb547a5174d291a64b36eaa8c11369c8/Communication/XBee/docs/serial_port.md) +> Change `/dev/ttyACM0` (`/dev/cu.usbmodem141203` for MacOS) to the correct serial device connected to the device. To find the correct serial port, refer to this documentation [here](https://github.com/ngcp-project/gcs-infrastructure/blob/d34eeba4eb547a5174d291a64b36eaa8c11369c8/Communication/XBee/docs/serial_port.md) > [!Note] > Two USB connections may be required depending on the board configuration. USB PWR is used to power and flash the development board and access the debug terminal, USER USB is used to connect to the F Prime GDS @@ -48,7 +48,7 @@ The following command will spin up the F' GDS as well as run the application bin fprime-gds -n --dictionary ./build-artifacts/zephyr/fprime-zephyr-deployment/dict/ReferenceDeploymentTopologyDictionary.json --communication-selection uart --uart-baud 115200 --output-unframed-data # Or -fprime-gds -n --dictionary ./build-artifacts/zephyr/fprime-zephyr-deployment/dict/ReferenceDeploymentTopologyDictionary.json --communication-selection uart --uart-device /dev/cu.usbmodem142101 --uart-baud 115200 +fprime-gds -n --dictionary ./build-artifacts/zephyr/fprime-zephyr-deployment/dict/ReferenceDeploymentTopologyDictionary.json --communication-selection uart --uart-device /dev/cu.usbmodem142101 --uart-baud 115200 ``` @@ -61,4 +61,4 @@ Refer to the [additional resources][additional-resources] section in the main RE [board-list]: ../additional-resources/board-list.md -[additional-resources]: ../../README.md#additional-resources \ No newline at end of file +[additional-resources]: ../../README.md#additional-resources diff --git a/docs/main-content/initial-setup.md b/docs/main-content/initial-setup.md index e7b67b3b..b3eab344 100644 --- a/docs/main-content/initial-setup.md +++ b/docs/main-content/initial-setup.md @@ -72,4 +72,4 @@ west zephyr-export [build-flash-run]: ./build-flash-run.md -[specifying-board-configuration]: ../additional-resources/specifying-board-configuration.md \ No newline at end of file +[specifying-board-configuration]: ../additional-resources/specifying-board-configuration.md diff --git a/docs/uploading/stm32/Arduino-STM32CubeProgrammer-Arm-Issue.md b/docs/uploading/stm32/Arduino-STM32CubeProgrammer-Arm-Issue.md index 1b023264..a72a5702 100644 --- a/docs/uploading/stm32/Arduino-STM32CubeProgrammer-Arm-Issue.md +++ b/docs/uploading/stm32/Arduino-STM32CubeProgrammer-Arm-Issue.md @@ -1,6 +1,6 @@ # Using the ARM Installation of STM32CubeProgrammer -This guide fixes an issue with the ARM installation of the [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html). This installation uses a slightly different path for its bin folder and results in the `stm32CubeProg.sh` script, provided by Arduino Tools, outputing the following error: +This guide fixes an issue with the ARM installation of the [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html). This installation uses a slightly different path for its bin folder and results in the `stm32CubeProg.sh` script, provided by Arduino Tools, outputting the following error: ```shell STM32CubeProgrammer not found (STM32_Programmer_CLI). @@ -63,4 +63,4 @@ The script should look like this: # Return to the [STM32 Uploading Guide][stm32] -[stm32]: ../uploading/stm32.md \ No newline at end of file +[stm32]: ../uploading/stm32.md diff --git a/docs/uploading/stm32/stm32.md b/docs/uploading/stm32/stm32.md index 1751f9bf..de0ef060 100644 --- a/docs/uploading/stm32/stm32.md +++ b/docs/uploading/stm32/stm32.md @@ -22,8 +22,8 @@ These steps were tested for the following boards: sh ~/.arduino15/packages/STMicroelectronics/tools/STM32Tools/2.3.0/stm32CubeProg.sh -i swd -f build-fprime-automatic-zephyr/zephyr/zephyr.hex -c /dev/ttyACM0 # MacOS -sh ~/Library/Arduino15/packages/STMicroelectronics/tools/STM32Tools/2.3.0/stm32CubeProg.sh -i swd -f build-fprime-automatic-zephyr/zephyr/zephyr.hex -c /dev/cu.usbmodem142203 +sh ~/Library/Arduino15/packages/STMicroelectronics/tools/STM32Tools/2.3.0/stm32CubeProg.sh -i swd -f build-fprime-automatic-zephyr/zephyr/zephyr.hex -c /dev/cu.usbmodem142203 ``` > [!Note] -> Change `/dev/ttyACM0` (`/dev/cu.usbmodem141203` for MacOS) to the correct serial device connected to the device. To find the correct serial port, refer to this documentation [here](https://github.com/ngcp-project/gcs-infrastructure/blob/d34eeba4eb547a5174d291a64b36eaa8c11369c8/Communication/XBee/docs/serial_port.md) \ No newline at end of file +> Change `/dev/ttyACM0` (`/dev/cu.usbmodem141203` for MacOS) to the correct serial device connected to the device. To find the correct serial port, refer to this documentation [here](https://github.com/ngcp-project/gcs-infrastructure/blob/d34eeba4eb547a5174d291a64b36eaa8c11369c8/Communication/XBee/docs/serial_port.md) diff --git a/docs/uploading/teensy.md b/docs/uploading/teensy.md index 060361a8..1deb3734 100644 --- a/docs/uploading/teensy.md +++ b/docs/uploading/teensy.md @@ -26,4 +26,4 @@ teensy_loader_cli -v -mmcu=TEENSY41 -w build-fprime-automatic-zephyr/zephyr/zeph ``` [arduino-cli-guide]: https://github.com/fprime-community/fprime-arduino/blob/0d4f023dec007294d073bec64a44d6d8010dce04/docs/arduino-cli-install.md -[teensy-loader-cli-guide]: https://www.pjrc.com/teensy/loader_cli.html \ No newline at end of file +[teensy-loader-cli-guide]: https://www.pjrc.com/teensy/loader_cli.html diff --git a/fprime-gds.yaml b/fprime-gds.yaml index 803ab14a..0e1f0e23 100644 --- a/fprime-gds.yaml +++ b/fprime-gds.yaml @@ -2,4 +2,3 @@ command-line-options: communication-selection: uart uart-baud: 115200 no-app: - diff --git a/prj.conf b/prj.conf index b8b5ed8c..7bb63394 100644 --- a/prj.conf +++ b/prj.conf @@ -1,10 +1,10 @@ #### Configure Device VID and PID --> Uncomment the desired device definitions #### -#### From Teensy41 USB definitions #### +#### From Teensy41 USB definitions #### # CONFIG_USB_DEVICE_VID=0x16C0 # CONFIG_USB_DEVICE_PID=0x0483 -#### From Raspberry Pi Pico2 USB Definitions #### +#### From Raspberry Pi Pico2 USB Definitions #### CONFIG_USB_DEVICE_PID=0x000F CONFIG_USB_DEVICE_VID=0x2E8A @@ -26,7 +26,7 @@ CONFIG_REBOOT=y CONFIG_USB_DEVICE_STACK=y CONFIG_USB_CDC_ACM=y CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y -CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_UART_INTERRUPT_DRIVEN=y #### Serial and I/O #### CONFIG_CONSOLE=y @@ -38,16 +38,16 @@ CONFIG_PWM=n CONFIG_I2C=n CONFIG_SPI=n CONFIG_PINCTRL=y -CONFIG_ASSERT=y +CONFIG_ASSERT=y -CONFIG_DYNAMIC_THREAD=y +CONFIG_DYNAMIC_THREAD=y CONFIG_KERNEL_MEM_POOL=y -CONFIG_DYNAMIC_THREAD_ALLOC=n +CONFIG_DYNAMIC_THREAD_ALLOC=n CONFIG_DYNAMIC_THREAD_PREFER_POOL=y CONFIG_DYNAMIC_THREAD_POOL_SIZE=10 - # Num threads in the thread pool + # Num threads in the thread pool CONFIG_DYNAMIC_THREAD_STACK_SIZE=8192 - # Size of thread stack in thread pool, must be >= Thread Pool size in F' + # Size of thread stack in thread pool, must be >= Thread Pool size in F' CONFIG_THREAD_STACK_INFO=y CONFIG_RING_BUFFER=y From fc168ef1bbc4524c2b49339d1b9d7acc913cc6fb Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 24 Aug 2025 18:34:21 -0500 Subject: [PATCH 3/5] Add generate-if-needed to build target --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 652cc7aa..4ab3b1cd 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ generate-if-needed: @test -s $(BUILD_DIR) || $(MAKE) generate .PHONY: build -build: fprime-venv zephyr-setup $(UF2) ## Build FPrime-Zephyr Proves Core Reference +build: fprime-venv zephyr-setup generate-if-needed ## Build FPrime-Zephyr Proves Core Reference @echo "Building FPrime code..." @$(UV) run fprime-util build @@ -80,7 +80,7 @@ clean: ## Remove all gitignored files .PHONY: gds gds: ## Run FPrime GDS @echo "Running FPrime GDS..." - @$(UV) run fprime-gds -n --dictionary ./build-artifacts/zephyr/fprime-zephyr-deployment/dict/ReferenceDeploymentTopologyDictionary.json --communication-selection uart --uart-baud 115200 --output-unframed-data + @$(UV) run fprime-gds -n --dictionary $(BUILD_DIR)/zephyr/fprime-zephyr-deployment/dict/ReferenceDeploymentTopologyDictionary.json --communication-selection uart --uart-baud 115200 --output-unframed-data ##@ Build Tools BIN_DIR ?= $(shell pwd)/bin From 3c38f74380e907634f7b5ce1ea7bf4f39f1ee488 Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 24 Aug 2025 19:04:08 -0500 Subject: [PATCH 4/5] Fix clang auto-ordering issue --- FprimeZephyrReference/ReferenceDeployment/Main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Main.cpp b/FprimeZephyrReference/ReferenceDeployment/Main.cpp index 249c32bc..209a863b 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Main.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Main.cpp @@ -4,9 +4,12 @@ // // ====================================================================== // Used to access topology functions -#include -#include +// clang-format off +// Keep the includes in this order for Zephyr #include +#include +#include +// clang-format on const struct device* serial = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart0)); From 6e90c0391b67cf1ef2cad28c2195df850468765a Mon Sep 17 00:00:00 2001 From: Nate Gay Date: Sun, 24 Aug 2025 19:24:42 -0500 Subject: [PATCH 5/5] Ensure submodules are downloaded before build --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4ab3b1cd..30070c28 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ fmt: pre-commit-install ## Lint and format files $(UVX) pre-commit run --all-files .PHONY: generate -generate: fprime-venv zephyr-setup ## Generate FPrime-Zephyr Proves Core Reference +generate: submodules fprime-venv zephyr-setup ## Generate FPrime-Zephyr Proves Core Reference @echo "Generating FPrime-Zephyr Proves Core Reference..." $(UV) run fprime-util generate --force @@ -53,7 +53,7 @@ generate-if-needed: @test -s $(BUILD_DIR) || $(MAKE) generate .PHONY: build -build: fprime-venv zephyr-setup generate-if-needed ## Build FPrime-Zephyr Proves Core Reference +build: generate-if-needed ## Build FPrime-Zephyr Proves Core Reference @echo "Building FPrime code..." @$(UV) run fprime-util build