From 2266819a7ca508b148fe60f8290d4ef91304b3bf Mon Sep 17 00:00:00 2001 From: Nathan Cheek Date: Fri, 2 Oct 2026 23:52:59 -0700 Subject: [PATCH 1/5] Sync LedBlinker deployment with the Arduino deployment cookiecutter * Regenerate LedBlinker from the cookiecutter and re-add the LED changes * Raise file and directory handle sizes to 48 for RP2040 SD card builds * Raise QueueSizes.comQueue to 10 so events are no longer dropped * Remove LedBlinkerPackets.xml and reference to LedBlinkerPacketsAc.hpp, left over from the F' v3 XML packets autocoder * Pass --framing-selection fprime in the GDS commands, since fprime-gds defaults to CCSDS framing --- LedBlinker/CMakeLists.txt | 11 ++-- LedBlinker/Main.cpp | 1 + LedBlinker/README.md | 40 ++++++++++--- LedBlinker/Top/CMakeLists.txt | 33 +++++----- LedBlinker/Top/LedBlinkerPackets.xml | 60 ------------------- LedBlinker/Top/LedBlinkerTopology.cpp | 6 +- LedBlinker/Top/LedBlinkerTopologyDefs.hpp | 48 ++++++++------- LedBlinker/Top/instances.fpp | 1 + LedBlinker/Top/topology.fpp | 17 +++--- .../config/ComCcsdsConfig/ComCcsdsConfig.fpp | 12 ++-- .../ComFprimeConfig/ComFprimeConfig.fpp | 4 +- LedBlinker/config/FpConfig.h | 4 +- LedBlinker/config/TlmChanImplCfg.hpp | 1 - docs/arduino-led-blinker.md | 43 ++++++------- 14 files changed, 128 insertions(+), 153 deletions(-) delete mode 100644 LedBlinker/Top/LedBlinkerPackets.xml diff --git a/LedBlinker/CMakeLists.txt b/LedBlinker/CMakeLists.txt index c799203..bcffc8f 100644 --- a/LedBlinker/CMakeLists.txt +++ b/LedBlinker/CMakeLists.txt @@ -19,10 +19,11 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Top/") # Add custom components to this specific deployment here # add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/MyComponent/") - -set(SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Main.cpp") -set(MOD_DEPS ${FPRIME_CURRENT_MODULE}/Top) - -register_fprime_deployment() +register_fprime_deployment( + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/Main.cpp" + DEPENDS + ${FPRIME_CURRENT_MODULE}_Top +) finalize_arduino_executable("${FPRIME_CURRENT_MODULE}") diff --git a/LedBlinker/Main.cpp b/LedBlinker/Main.cpp index ac97e41..fbdd158 100644 --- a/LedBlinker/Main.cpp +++ b/LedBlinker/Main.cpp @@ -13,6 +13,7 @@ // Used for logging #include + /** * \brief setup the program * diff --git a/LedBlinker/README.md b/LedBlinker/README.md index faad4a0..a12037c 100644 --- a/LedBlinker/README.md +++ b/LedBlinker/README.md @@ -6,23 +6,49 @@ This deployment was auto-generated by the F' utility tool. In order to build the LedBlinker application, or any other F´ application, we first need to generate a build directory. This can be done with the following commands: -``` +```sh +cd LedBlinker fprime-util generate ``` -The next step is to build the LedBlinker application's code. -``` +The next step is to build the LedBlinker application's code. Build from the deployment's folder: building from the project root also builds every F´ framework module, and some of them don't build for Arduino boards. +```sh fprime-util build ``` ## Running the application and F' GDS -The following command will spin up the F' GDS as well as run the application binary and the components necessary for the GDS and application to communicate. +The following command will spin up the F' GDS. Examples are available for UART, TcpServer, and TcpClient: +### UART + +```sh +fprime-gds -n --dictionary ./build-artifacts//LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 ``` -fprime-gds -n --dictionary ./build-artifacts//LedBlinker/dict/LedBlinkerTopologyAppDictionary.xml --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 -``` -> Change `` to the build of your deployment (i.e. `teensy41`, `featherM0`, etc.). +> [!NOTE] +> Change `` to the build of your deployment (i.e. `teensy41`, `featherM0`, etc.). +> > `/dev/ttyACM0` may vary for your system/device. It may also be `/dev/ttyUSB0`. For MacOS, it will be along the lines of `/dev/tty.usbmodem12345`. Change accordingly. +> > To view the list of your connected devices, run: `ls /dev/tty*`. + +### TcpServer + +```sh +fprime-gds -n --dictionary ./build-artifacts//LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime --ip-client --ip-address +``` + +> [!NOTE] +> Change `` to the build of your deployment (i.e. `teensy41`, `featherM0`, etc.). +> +> Change `` to the IP address of your board. Your machine must be in the same network as the board. + +### TcpClient + +```sh +fprime-gds -n --dictionary ./build-artifacts//LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime +``` + +> [!NOTE] +> Change `` to the build of your deployment (i.e. `teensy41`, `featherM0`, etc.). diff --git a/LedBlinker/Top/CMakeLists.txt b/LedBlinker/Top/CMakeLists.txt index c7c51a6..51f538c 100644 --- a/LedBlinker/Top/CMakeLists.txt +++ b/LedBlinker/Top/CMakeLists.txt @@ -1,21 +1,22 @@ #### -# F prime CMakeLists.txt: +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ # -# SOURCE_FILES: combined list of source and autocoding files -# MOD_DEPS: (optional) module dependencies #### -set(SOURCE_FILES - "${CMAKE_CURRENT_LIST_DIR}/instances.fpp" - # Note: Uncomment when using Svc:TlmPacketizer - # "${CMAKE_CURRENT_LIST_DIR}/LedBlinkerPackets.xml" - "${CMAKE_CURRENT_LIST_DIR}/topology.fpp" - "${CMAKE_CURRENT_LIST_DIR}/LedBlinkerTopology.cpp" +register_fprime_module( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/instances.fpp" + "${CMAKE_CURRENT_LIST_DIR}/topology.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/LedBlinkerTopology.cpp" + DEPENDS + Arduino_Drv_StreamDriver + fprime-baremetal_Os_TaskRunner ) -set(MOD_DEPS - Fw/Logger - Arduino/Drv/StreamDriver - fprime-baremetal/Os/TaskRunner -) - -register_fprime_module() diff --git a/LedBlinker/Top/LedBlinkerPackets.xml b/LedBlinker/Top/LedBlinkerPackets.xml deleted file mode 100644 index cc32094..0000000 --- a/LedBlinker/Top/LedBlinkerPackets.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - LedBlinker/Top/LedBlinkerTopologyAppAi.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/LedBlinker/Top/LedBlinkerTopology.cpp b/LedBlinker/Top/LedBlinkerTopology.cpp index 8858f60..4853444 100644 --- a/LedBlinker/Top/LedBlinkerTopology.cpp +++ b/LedBlinker/Top/LedBlinkerTopology.cpp @@ -5,9 +5,8 @@ // ====================================================================== // Provides access to autocoded functions #include -// Note: Uncomment when using Svc:TlmPacketizer -// #include #include +#include // Necessary project-specified types #include @@ -59,9 +58,10 @@ void setupTopology(const TopologyState& state) { // loadParameters(); // Autocoded task kick-off (active components). Function provided by autocoder. startTasks(state); + + comDriver.configure(&Serial); rateDriver.configure(1); - comDriver.configure(&Serial); rateDriver.start(); } diff --git a/LedBlinker/Top/LedBlinkerTopologyDefs.hpp b/LedBlinker/Top/LedBlinkerTopologyDefs.hpp index bd8af80..2cd7f70 100644 --- a/LedBlinker/Top/LedBlinkerTopologyDefs.hpp +++ b/LedBlinker/Top/LedBlinkerTopologyDefs.hpp @@ -11,26 +11,9 @@ // SubtopologyTopologyDefs includes #include "Svc/Subtopologies/ComFprime/SubtopologyTopologyDefs.hpp" - // ComFprime Enum Includes -#include "Svc/Subtopologies/ComFprime/Ports_ComBufferQueueEnumAc.hpp" #include "Svc/Subtopologies/ComFprime/Ports_ComPacketQueueEnumAc.hpp" - -// Definitions are placed within a namespace named after the deployment -namespace LedBlinker { - /** - * \brief required type definition to carry state - * - * The topology autocoder requires an object that carries state with the name `LedBlinker::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 reference application specifies hostname and port - * fields, which are derived by command line inputs. - */ - struct TopologyState { - FwIndexType uartNumber; - PlatformIntType uartBaud; - }; -} // namespace LedBlinker +#include "Svc/Subtopologies/ComFprime/Ports_ComBufferQueueEnumAc.hpp" /** * \brief required ping constants @@ -52,9 +35,30 @@ namespace LedBlinker { * ``` */ namespace PingEntries { - namespace LedBlinker_tlmSend {enum { WARN = 3, FATAL = 5 };} - namespace LedBlinker_cmdDisp {enum { WARN = 3, FATAL = 5 };} - namespace LedBlinker_eventLogger {enum { WARN = 3, FATAL = 5 };} - namespace LedBlinker_rateGroup1 {enum { WARN = 3, FATAL = 5 };} + namespace LedBlinker_tlmSend {enum { WARN = 3, FATAL = 5 };} + namespace LedBlinker_cmdDisp {enum { WARN = 3, FATAL = 5 };} + namespace LedBlinker_eventLogger {enum { WARN = 3, FATAL = 5 };} + namespace LedBlinker_rateGroup1 {enum { WARN = 3, FATAL = 5 };} } // namespace PingEntries + +// Definitions are placed within a namespace named after the deployment +namespace LedBlinker { + + /** + * \brief required type definition to carry state + * + * The topology autocoder requires an object that carries state with the name `LedBlinker::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 reference application specifies hostname and port + * fields, which are derived by command line inputs. + */ + struct TopologyState { + FwIndexType uartNumber; + PlatformIntType uartBaud; + }; + +} // namespace LedBlinker + + + #endif diff --git a/LedBlinker/Top/instances.fpp b/LedBlinker/Top/instances.fpp index 8b09105..a5ab343 100644 --- a/LedBlinker/Top/instances.fpp +++ b/LedBlinker/Top/instances.fpp @@ -43,6 +43,7 @@ module LedBlinker { instance rateGroup1: Svc.PassiveRateGroup base id 0x1000 + @ Communications driver. May be swapped with other com drivers like Arduino.StreamDriver, Arduino.TcpServer, or Arduino.TcpClient. instance comDriver: Arduino.StreamDriver base id 0x4000 instance fatalHandler: Baremetal.FatalHandler base id 0x4300 diff --git a/LedBlinker/Top/topology.fpp b/LedBlinker/Top/topology.fpp index 5539cfc..c7c80fb 100644 --- a/LedBlinker/Top/topology.fpp +++ b/LedBlinker/Top/topology.fpp @@ -14,6 +14,7 @@ module LedBlinker { # Subtopology imports # ---------------------------------------------------------------------- + import ComFprime.Subtopology # ---------------------------------------------------------------------- @@ -58,15 +59,16 @@ module LedBlinker { # Rate group 1 rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1] -> rateGroup1.CycleIn - rateGroup1.RateGroupMemberOut[0] -> comDriver.schedIn - rateGroup1.RateGroupMemberOut[1] -> tlmSend.Run - rateGroup1.RateGroupMemberOut[2] -> systemResources.run + rateGroup1.RateGroupMemberOut[0] -> tlmSend.Run + rateGroup1.RateGroupMemberOut[1] -> systemResources.run + rateGroup1.RateGroupMemberOut[2] -> comDriver.schedIn } connections FaultProtection { eventLogger.FatalAnnounce -> fatalHandler.FatalReceive } + connections Communications { # Inputs to ComQueue (events, telemetry, file) eventLogger.PktSend -> ComFprime.comQueue.comPacketQueueIn[ComFprime.Ports_ComPacketQueue.EVENTS] @@ -89,17 +91,14 @@ module LedBlinker { cmdDisp.seqCmdStatus -> ComFprime.fprimeRouter.cmdResponseIn } - connections LedConnections { - # Rate Group 1 (1Hz cycle) ouput is connected to led's run input + connections LedBlinker { + # Add here connections to user-defined components + # Rate Group 1 (1Hz cycle) output is connected to led's run input rateGroup1.RateGroupMemberOut[3] -> led.run # led's gpioSet output is connected to gpioDriver's gpioWrite input led.gpioSet -> gpioDriver.gpioWrite } - connections LedBlinker { - # Add here connections to user-defined components - } - } } diff --git a/LedBlinker/config/ComCcsdsConfig/ComCcsdsConfig.fpp b/LedBlinker/config/ComCcsdsConfig/ComCcsdsConfig.fpp index 8e56d4e..9ce939a 100644 --- a/LedBlinker/config/ComCcsdsConfig/ComCcsdsConfig.fpp +++ b/LedBlinker/config/ComCcsdsConfig/ComCcsdsConfig.fpp @@ -3,7 +3,7 @@ module ComCcsdsConfig { constant BASE_ID = 0x02000000 module QueueSizes { - constant comQueue = 3 + constant comQueue = 10 } module StackSizes { @@ -29,11 +29,11 @@ module ComCcsdsConfig { # Buffer management constants module BuffMgr { - constant frameAccumulatorSize = 256 + constant frameAccumulatorSize = 2048 constant commsBuffSize = 140 - constant commsFileBuffSize = 0 - constant commsBuffCount = 3 - constant commsFileBuffCount = 0 - constant commsBuffMgrId = 200 + constant commsFileBuffSize = 140 + constant commsBuffCount = 3 + constant commsFileBuffCount = 3 + constant commsBuffMgrId = 200 } } diff --git a/LedBlinker/config/ComFprimeConfig/ComFprimeConfig.fpp b/LedBlinker/config/ComFprimeConfig/ComFprimeConfig.fpp index b83d464..ce4df6c 100644 --- a/LedBlinker/config/ComFprimeConfig/ComFprimeConfig.fpp +++ b/LedBlinker/config/ComFprimeConfig/ComFprimeConfig.fpp @@ -3,7 +3,7 @@ module ComFprimeConfig { constant BASE_ID = 0x03000000 module QueueSizes { - constant comQueue = 3 + constant comQueue = 10 } module StackSizes { @@ -33,7 +33,7 @@ module ComFprimeConfig { constant commsBuffSize = 140 constant commsFileBuffSize = 0 constant commsBuffCount = 3 - constant commsFileBuffCount = 0 + constant commsFileBuffCount = 0 constant commsBuffMgrId = 200 } } diff --git a/LedBlinker/config/FpConfig.h b/LedBlinker/config/FpConfig.h index a6ceacb..2998c94 100644 --- a/LedBlinker/config/FpConfig.h +++ b/LedBlinker/config/FpConfig.h @@ -279,7 +279,7 @@ extern "C" { #endif #ifndef FW_FILE_HANDLE_MAX_SIZE -#define FW_FILE_HANDLE_MAX_SIZE 32 //!< Maximum size of a handle for OS queues +#define FW_FILE_HANDLE_MAX_SIZE 48 //!< Maximum size of a handle for OS queues #endif #ifndef FW_MUTEX_HANDLE_MAX_SIZE @@ -291,7 +291,7 @@ extern "C" { #endif #ifndef FW_DIRECTORY_HANDLE_MAX_SIZE -#define FW_DIRECTORY_HANDLE_MAX_SIZE 32 //!< Maximum size of a handle for OS resources (files, queues, locks, etc.) +#define FW_DIRECTORY_HANDLE_MAX_SIZE 48 //!< Maximum size of a handle for OS resources (files, queues, locks, etc.) #endif #ifndef FW_FILESYSTEM_HANDLE_MAX_SIZE diff --git a/LedBlinker/config/TlmChanImplCfg.hpp b/LedBlinker/config/TlmChanImplCfg.hpp index e1ba2e3..a3738e3 100644 --- a/LedBlinker/config/TlmChanImplCfg.hpp +++ b/LedBlinker/config/TlmChanImplCfg.hpp @@ -46,7 +46,6 @@ namespace { // Works best when set to about twice the number of components producing telemetry TLMCHAN_HASH_MOD_VALUE = 99, // !< The modulo value of the hashing function. // Should be set to a little below the ID gaps to spread the entries around - TLMCHAN_HASH_BUCKETS = 18 // !< Buckets assignable to a hash slot. // Buckets must be >= number of telemetry channels in system }; diff --git a/docs/arduino-led-blinker.md b/docs/arduino-led-blinker.md index afb52db..4828bea 100644 --- a/docs/arduino-led-blinker.md +++ b/docs/arduino-led-blinker.md @@ -147,10 +147,9 @@ In this exercise, the `BLINKING_ON_OFF` command shall toggle the blinking state 1. `BLINKING_ON_OFF`: turn the LED blinking on/off **Events:** -1. `InvalidBlinkArgument`: emitted when an invalid argument was supplied to the `BLINKING_ON_OFF` command -2. `SetBlinkingState`: emitted when the component sets the blink state -3. `BlinkIntervalSet`: emitted when the component blink interval parameter is set -4. `LedState`: emitted when the LED is driven to a new state +1. `SetBlinkingState`: emitted when the component sets the blink state +2. `BlinkIntervalSet`: emitted when the component blink interval parameter is set +3. `LedState`: emitted when the LED is driven to a new state **Telemetry Channels:** 1. `BlinkingState`: state of the LED blinking @@ -203,7 +202,7 @@ Generate implementation files? (yes/no) [yes]: yes Refreshing cache and generating implementation files... [INFO] Created new component and generated initial implementations. ``` -Your new component is located in the directory `arduinio-led-blinker/Components/Led`. +Your new component is located in the directory `arduino-led-blinker/Components/Led`. #### Commands @@ -413,17 +412,21 @@ fprime-util new --deployment This will ask for some input, respond with the following answers: ```shell [INFO] Cookiecutter source: https://github.com/fprime-community/fprime-arduino-deployment-cookiecutter.git - [1/3] Deployment name (fprime-arduino-deployment): LedBlinker - [2/3] Select communication driver type + [1/4] Deployment name (fprime_arduino_deployment): LedBlinker + [2/4] Select communication driver type 1 - UART 2 - TcpServer 3 - TcpClient Choose from [1/2/3] (1): 1 - [3/3] Select file system type + [3/4] Select file system type 1 - None 2 - SD_Card 3 - MicroFS Choose from [1/2/3] (1): 1 + [4/4] Select framing protocol + 1 - CCSDS + 2 - Fprime + Choose from [1/2] (1): 2 [INFO] Found CMake file at 'arduino-led-blinker/project.cmake' Add LedBlinker to arduino-led-blinker/project.cmake at end of file? (yes/no) [yes]: yes [INFO] New deployment successfully created: /home/ethan/fprime-projects/arduino-led-blinker/LedBlinker @@ -496,7 +499,7 @@ First, you must upload the binary into your board. The binary is located in the Open the `fprime-gds` by running the following command: ```sh -fprime-gds -n --dictionary ../build-artifacts/teensy41/LedBlinker/dict/LedBlinkerTopologyDictionary.json --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 +fprime-gds -n --dictionary ../build-artifacts/teensy41/LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 ``` This will likely open up your browser and show the running flight software. If it does not open a browser, navigate to `http://localhost:5000`. @@ -521,7 +524,7 @@ Return to the `arduino-led-blinker/LedBlinker` and run the following commands to ```sh # In arduino-led-blinker/LedBlinker fprime-util build -fprime-gds -n --dictionary ../build-artifacts/teensy41/LedBlinker/dict/LedBlinkerTopologyDictionary.json --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 +fprime-gds -n --dictionary ../build-artifacts/teensy41/LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 # CTRL-C to exit ``` @@ -793,30 +796,30 @@ Now it is time to add a GPIO driver to our system and attach it to the `led` com `fprime-arduino` provides a GPIO driver for Arduino microcontrollers called `Arduino.GpioDriver`. This should be added to both the instance definition list and the topology instance list just like we did for the `led` component. Since the GPIO driver is a passive component, its definition is a bit more simple. -Add to "Passive Component" section of `led-blinker/LedBLinker/Top/instance.fpp`: +Add to "Passive Component" section of `arduino-led-blinker/LedBlinker/Top/instances.fpp`: ``` instance gpioDriver: Arduino.GpioDriver base id 0x5000 ``` -Add to the instance list of `led-blinker/LedBlinker/Top/topology.fpp`: +Add to the instance list of `arduino-led-blinker/LedBlinker/Top/topology.fpp`: ``` instance gpioDriver ``` > [!NOTE] -> In `led-blinker/LedBlinker` build the deployment and resolve any errors before continuing. +> In `arduino-led-blinker/LedBlinker` build the deployment and resolve any errors before continuing. ### Wiring The `led` Component Instance to the `gpioComponent` Component Instance and Rate Group The `Led` component defines the `gpioSet` output port and the `Arduino.GpioDriver` defines the `gpioWrite` input port. These two ports need to be connected from output to input. The `ActiveRateGroup` component defines an array of ports called `RateGroupMemberOut` and one of these needs to be connected to `run` port defined on the `Led` component. -We can create a named connections block in the topology and connect the two port pairs. Remember to use the component instances and not the component definitions for each connection. +We can connect the two port pairs in the topology's existing `LedBlinker` connections block. Remember to use the component instances and not the component definitions for each connection. -To do this, add the following lines to `led-blinker/LedBLinker/Top/topology.fpp`: +To do this, add the following lines to the `connections LedBlinker` block in `arduino-led-blinker/LedBlinker/Top/topology.fpp`: ``` - # Named connection group connections LedBlinker { - # Rate Group 1 (1Hz cycle) ouput is connected to led's run input + # Add here connections to user-defined components + # Rate Group 1 (1Hz cycle) output is connected to led's run input rateGroup1.RateGroupMemberOut[3] -> led.run # led's gpioSet output is connected to gpioDriver's gpioWrite input led.gpioSet -> gpioDriver.gpioWrite @@ -830,7 +833,7 @@ To do this, add the following lines to `led-blinker/LedBLinker/Top/topology.fpp` So far the GPIO driver has been instantiated and wired, but has not been told what GPIO pin to control. For this tutorial, the built-in LED will be used. To configure this, the `open` function needs to be called in the topology's C++ implementation and passed the pin's number and direction. -This is done by adding the following line to the end of the `configureTopology` function defined in `led-blinker/LedBLinker/Top/LedBLinkerTopology.cpp`. +This is done by adding the following line to the end of the `configureTopology` function defined in `arduino-led-blinker/LedBlinker/Top/LedBlinkerTopology.cpp`. ``` void configureTopology() { @@ -841,7 +844,7 @@ void configureTopology() { This code tells the GPIO driver to open pin `LED_BUILTIN` (usually pin 13) as an output pin. If your device does not have a built in LED, select a GPIO pin of your choice. > [!NOTE] -> In `led-blinker/LedBlinker` build the deployment and resolve any errors before continuing. +> In `arduino-led-blinker/LedBlinker` build the deployment and resolve any errors before continuing. ### LED Blinker Step 6 Conclusion @@ -859,7 +862,7 @@ Next run the F´ GDS without launching the native compilation (`-n`) and with th ```sh # In the project root -fprime-gds -n --dictionary ./build-artifacts/teensy41/LedBlinker/dict/LedBlinkerTopologyDictionary.json --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 +fprime-gds -n --dictionary ./build-artifacts/teensy41/LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 ``` > [!Note] From e0349887d95d1287d509476816140756dc7c36b6 Mon Sep 17 00:00:00 2001 From: Nathan Cheek Date: Fri, 2 Oct 2026 23:56:06 -0700 Subject: [PATCH 2/5] Upgrade to fprime 4.1.1 * Update fprime-arduino, including the ArduinoRawTime fix * Rebase config overrides onto the v4.1.1 defaults * Add the ComCcsds aggregator constants * Connect cmdDisp.run, which now writes the dispatcher's telemetry, to rate group port 3, and move the LED to port 4 --- LedBlinker/Top/topology.fpp | 3 +- LedBlinker/config/AcConstants.fpp | 9 - .../config/BufferManagerComponentImplCfg.hpp | 5 +- LedBlinker/config/CMakeLists.txt | 2 + .../config/ComCcsdsConfig/ComCcsdsConfig.fpp | 3 + .../config/CommandDispatcherImplCfg.hpp | 6 +- LedBlinker/config/FpConfig.h | 193 +----------------- LedBlinker/config/FpConstants.fpp | 86 ++++++++ LedBlinker/config/PlatformCfg.fpp | 45 ++++ LedBlinker/config/StaticMemoryConfig.hpp | 5 +- LedBlinker/config/TlmChanImplCfg.hpp | 17 +- docs/arduino-led-blinker.md | 4 +- lib/fprime | 2 +- lib/fprime-arduino | 2 +- 14 files changed, 165 insertions(+), 217 deletions(-) create mode 100644 LedBlinker/config/FpConstants.fpp create mode 100644 LedBlinker/config/PlatformCfg.fpp diff --git a/LedBlinker/Top/topology.fpp b/LedBlinker/Top/topology.fpp index c7c80fb..a659a84 100644 --- a/LedBlinker/Top/topology.fpp +++ b/LedBlinker/Top/topology.fpp @@ -62,6 +62,7 @@ module LedBlinker { rateGroup1.RateGroupMemberOut[0] -> tlmSend.Run rateGroup1.RateGroupMemberOut[1] -> systemResources.run rateGroup1.RateGroupMemberOut[2] -> comDriver.schedIn + rateGroup1.RateGroupMemberOut[3] -> cmdDisp.run } connections FaultProtection { @@ -94,7 +95,7 @@ module LedBlinker { connections LedBlinker { # Add here connections to user-defined components # Rate Group 1 (1Hz cycle) output is connected to led's run input - rateGroup1.RateGroupMemberOut[3] -> led.run + rateGroup1.RateGroupMemberOut[4] -> led.run # led's gpioSet output is connected to gpioDriver's gpioWrite input led.gpioSet -> gpioDriver.gpioWrite } diff --git a/LedBlinker/config/AcConstants.fpp b/LedBlinker/config/AcConstants.fpp index 89b8739..ea186d3 100644 --- a/LedBlinker/config/AcConstants.fpp +++ b/LedBlinker/config/AcConstants.fpp @@ -59,12 +59,3 @@ constant FwAssertTextSize = 256 @ the constants FW_ASSERT_TEXT_SIZE and FW_LOG_STRING_MAX_SIZE, set @ in FpConfig.h. constant AssertFatalAdapterEventFileSize = FileNameStringSize - -# ---------------------------------------------------------------------- -# Hub connections. Connections on all deployments should mirror these settings. -# ---------------------------------------------------------------------- - -constant GenericHubInputPorts = 10 -constant GenericHubOutputPorts = 10 -constant GenericHubInputBuffers = 10 -constant GenericHubOutputBuffers = 10 diff --git a/LedBlinker/config/BufferManagerComponentImplCfg.hpp b/LedBlinker/config/BufferManagerComponentImplCfg.hpp index 4456be9..7aa765f 100644 --- a/LedBlinker/config/BufferManagerComponentImplCfg.hpp +++ b/LedBlinker/config/BufferManagerComponentImplCfg.hpp @@ -4,8 +4,7 @@ #include namespace Svc { - static const U16 BUFFERMGR_MAX_NUM_BINS = 2; +static const U16 BUFFERMGR_MAX_NUM_BINS = 2; } - -#endif // __BUFFERMANAGERCOMPONENTIMPLCFG_HPP__ \ No newline at end of file +#endif // __BUFFERMANAGERCOMPONENTIMPLCFG_HPP__ diff --git a/LedBlinker/config/CMakeLists.txt b/LedBlinker/config/CMakeLists.txt index 4a9e66a..51e3f30 100644 --- a/LedBlinker/config/CMakeLists.txt +++ b/LedBlinker/config/CMakeLists.txt @@ -7,6 +7,8 @@ register_fprime_config( "${CMAKE_CURRENT_LIST_DIR}/BufferManagerComponentImplCfg.hpp" "${CMAKE_CURRENT_LIST_DIR}/CommandDispatcherImplCfg.hpp" "${CMAKE_CURRENT_LIST_DIR}/FpConfig.h" + "${CMAKE_CURRENT_LIST_DIR}/FpConstants.fpp" + "${CMAKE_CURRENT_LIST_DIR}/PlatformCfg.fpp" "${CMAKE_CURRENT_LIST_DIR}/StaticMemoryConfig.hpp" "${CMAKE_CURRENT_LIST_DIR}/TlmChanImplCfg.hpp" INTERFACE diff --git a/LedBlinker/config/ComCcsdsConfig/ComCcsdsConfig.fpp b/LedBlinker/config/ComCcsdsConfig/ComCcsdsConfig.fpp index 9ce939a..66a2d59 100644 --- a/LedBlinker/config/ComCcsdsConfig/ComCcsdsConfig.fpp +++ b/LedBlinker/config/ComCcsdsConfig/ComCcsdsConfig.fpp @@ -4,13 +4,16 @@ module ComCcsdsConfig { module QueueSizes { constant comQueue = 10 + constant aggregator = 3 } module StackSizes { constant comQueue = 64 * 1024 + constant aggregator = 64 * 1024 } module Priorities { + constant aggregator = 30 constant comQueue = 101 } diff --git a/LedBlinker/config/CommandDispatcherImplCfg.hpp b/LedBlinker/config/CommandDispatcherImplCfg.hpp index d388527..a665821 100644 --- a/LedBlinker/config/CommandDispatcherImplCfg.hpp +++ b/LedBlinker/config/CommandDispatcherImplCfg.hpp @@ -11,10 +11,8 @@ // Define configuration values for dispatcher enum { - CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 12, // !< The size of the table holding opcodes to dispatch - CMD_DISPATCHER_SEQUENCER_TABLE_SIZE = 4, // !< The size of the table holding commands in progress + CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 12, // !< The size of the table holding opcodes to dispatch + CMD_DISPATCHER_SEQUENCER_TABLE_SIZE = 4, // !< The size of the table holding commands in progress }; - - #endif /* CMDDISPATCHER_COMMANDDISPATCHERIMPLCFG_HPP_ */ diff --git a/LedBlinker/config/FpConfig.h b/LedBlinker/config/FpConfig.h index 2998c94..3b685f5 100644 --- a/LedBlinker/config/FpConfig.h +++ b/LedBlinker/config/FpConfig.h @@ -11,31 +11,16 @@ #ifndef FPCONFIG_H_ #define FPCONFIG_H_ -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif -#include #include - - -// ---------------------------------------------------------------------- -// Type aliases -// ---------------------------------------------------------------------- -#define FW_CONTEXT_DONT_CARE 0xFF //!< Don't care value for time contexts in sequences +#include // ---------------------------------------------------------------------- // Configuration switches // ---------------------------------------------------------------------- -// Boolean values for serialization -#ifndef FW_SERIALIZE_TRUE_VALUE -#define FW_SERIALIZE_TRUE_VALUE (0xFF) //!< Value encoded during serialization for boolean true -#endif - -#ifndef FW_SERIALIZE_FALSE_VALUE -#define FW_SERIALIZE_FALSE_VALUE (0x00) //!< Value encoded during serialization for boolean false -#endif - // Allow objects to have names. Allocates storage for each instance #ifndef FW_OBJECT_NAMES #define FW_OBJECT_NAMES \ @@ -90,8 +75,8 @@ extern "C" { // This generates code to connect to serialized ports #ifndef FW_PORT_SERIALIZATION #define FW_PORT_SERIALIZATION \ - 1 //!< Indicates whether there is code in ports to serialize the call (more code, but ability to serialize calls - //!< for multi-note systems) + 1 //!< Indicates whether there is code in ports to serialize the call (more code, but ability to serialize + //!< calls for multi-note systems) #endif // Component Facilities @@ -119,7 +104,7 @@ extern "C" { // 1. FW_NO_ASSERT: assertions are compiled out, side effects are kept // 2. FW_FILEID_ASSERT: asserts report a file CRC and line number // 3. FW_FILENAME_ASSERT: asserts report a file path (__FILE__) and line number -// 4. FW_RELATIVE_PATH_ASSERT: asserts report a relative path within F´ or F´ library and line number +// 4. FW_RELATIVE_PATH_ASSERT: asserts report a relative path within F' or F' library and line number // // Note: users who want alternate asserts should set assert level to FW_NO_ASSERT and define FW_ASSERT in this header #ifndef FW_ASSERT_LEVEL @@ -136,56 +121,6 @@ extern "C" { #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 -#define FW_OBJ_SIMPLE_REG_ENTRIES 128 //!< Number of objects stored in simple object registry -#endif -// When dumping the contents of the registry, this specifies the size of the buffer used to store object names. Should -// be >= FW_OBJ_NAME_BUFFER_SIZE. -#ifndef FW_OBJ_SIMPLE_REG_BUFF_SIZE -#define FW_OBJ_SIMPLE_REG_BUFF_SIZE 255 //!< Size of object registry dump string -#endif -#endif - -#if FW_QUEUE_REGISTRATION -// For the simple queue registry provided with the framework, this specifies how many queues the registry will store. -#ifndef FW_QUEUE_SIMPLE_QUEUE_ENTRIES -#define FW_QUEUE_SIMPLE_QUEUE_ENTRIES 100 //!< Number of queues stored in simple queue registry -#endif -#endif - -// Specifies the size of the string holding the queue name for queues -#ifndef FW_QUEUE_NAME_BUFFER_SIZE -#define FW_QUEUE_NAME_BUFFER_SIZE 1 //!< Max size of message queue name -#endif - -// Specifies the size of the string holding the task name for active components and tasks -#ifndef FW_TASK_NAME_BUFFER_SIZE -#define FW_TASK_NAME_BUFFER_SIZE 1 //!< Max size of task name -#endif - -// Specifies the size of the buffer that contains a communications packet. -#ifndef FW_COM_BUFFER_MAX_SIZE -#define FW_COM_BUFFER_MAX_SIZE 128 -#endif - -// Specifies the size of the buffer attached to state machine signals. -#ifndef FW_SM_SIGNAL_BUFFER_MAX_SIZE -#define FW_SM_SIGNAL_BUFFER_MAX_SIZE 128 // Not to exceed max value of FwSizeType -#endif - -// Specifies the size of the buffer that contains the serialized command arguments. - -#ifndef FW_CMD_ARG_BUFFER_MAX_SIZE -#define FW_CMD_ARG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwOpcodeType) - sizeof(FwPacketDescriptorType)) -#endif - -// Specifies the maximum size of a string in a command argument -#ifndef FW_CMD_STRING_MAX_SIZE -#define FW_CMD_STRING_MAX_SIZE 40 //!< Max character size of command string arguments -#endif - // Normally when a command is deserialized, the handler checks to see if there are any leftover // bytes in the buffer. If there are, it assumes that the command was corrupted somehow since // the serialized size should match the serialized size of the argument list. In some cases, @@ -196,63 +131,12 @@ extern "C" { #define FW_CMD_CHECK_RESIDUAL 0 //!< Check for leftover command bytes #endif -// Specifies the size of the buffer that contains the serialized log arguments. -#ifndef FW_LOG_BUFFER_MAX_SIZE -#define FW_LOG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwEventIdType) - sizeof(FwPacketDescriptorType)) -#endif - -// Specifies the maximum size of a string in a log event -// Note: This constant truncates file names in assertion failure event reports -#ifndef FW_LOG_STRING_MAX_SIZE -#define FW_LOG_STRING_MAX_SIZE 64 //!< Max size of log string parameter type -#endif - -// Specifies the size of the buffer that contains the serialized telemetry value. -#ifndef FW_TLM_BUFFER_MAX_SIZE -#define FW_TLM_BUFFER_MAX_SIZE 12 + sizeof(FwChanIdType) + sizeof(FwPacketDescriptorType) // (FW_COM_BUFFER_MAX_SIZE - sizeof(FwChanIdType) - sizeof(FwPacketDescriptorType)) -#endif - -// Specifies the size of the buffer that contains statement args for the FpySequencer -#ifndef FW_STATEMENT_ARG_BUFFER_MAX_SIZE -#define FW_STATEMENT_ARG_BUFFER_MAX_SIZE (FW_CMD_ARG_BUFFER_MAX_SIZE) -#endif - -// Specifies the maximum size of a string in a telemetry channel -#ifndef FW_TLM_STRING_MAX_SIZE -#define FW_TLM_STRING_MAX_SIZE 10 //!< Max size of channelized telemetry string type -#endif - -// Specifies the size of the buffer that contains the serialized parameter value. -#ifndef FW_PARAM_BUFFER_MAX_SIZE -#define FW_PARAM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwPrmIdType) - sizeof(FwPacketDescriptorType)) -#endif - -// Specifies the maximum size of a string in a parameter -#ifndef FW_PARAM_STRING_MAX_SIZE -#define FW_PARAM_STRING_MAX_SIZE 40 //!< Max size of parameter string type -#endif - -// Specifies the maximum size of a file downlink chunk -#ifndef FW_FILE_BUFFER_MAX_SIZE -#define FW_FILE_BUFFER_MAX_SIZE 255 //!< Max size of file buffer (i.e. chunk of file) -#endif - -// Specifies the maximum size of a string in an interface call -#ifndef FW_INTERNAL_INTERFACE_STRING_MAX_SIZE -#define FW_INTERNAL_INTERFACE_STRING_MAX_SIZE 64 //!< Max size of interface string parameter type -#endif - // Enables text logging of events as well as data logging. Adds a second logging port for text output. // In order to set this to 0, FPRIME_ENABLE_TEXT_LOGGERS must be set to OFF. #ifndef FW_ENABLE_TEXT_LOGGING #define FW_ENABLE_TEXT_LOGGING 1 //!< Indicates whether text logging is turned on #endif -// Define the size of the text log string buffer. Should be large enough for format string and arguments -#ifndef FW_LOG_TEXT_BUFFER_SIZE -#define FW_LOG_TEXT_BUFFER_SIZE 128 //!< Max size of string for text log message -#endif - // Define if serializables have toString() method. Turning off will save code space and // string constants. Must be enabled if text logging enabled #ifndef FW_SERIALIZABLE_TO_STRING @@ -264,72 +148,15 @@ extern "C" { #define FW_AMPCS_COMPATIBLE 0 //!< Whether or not JPL AMPCS ground system support is enabled. #endif -// Configuration for Fw::String -#ifndef FW_FIXED_LENGTH_STRING_SIZE -#define FW_FIXED_LENGTH_STRING_SIZE 128 //!< Character array size for Fw::String -#endif - -// OS configuration -#ifndef FW_CONSOLE_HANDLE_MAX_SIZE -#define FW_CONSOLE_HANDLE_MAX_SIZE 24 //!< Maximum size of a handle for OS queues -#endif - -#ifndef FW_TASK_HANDLE_MAX_SIZE -#define FW_TASK_HANDLE_MAX_SIZE 24 //!< Maximum size of a handle for OS queues -#endif - -#ifndef FW_FILE_HANDLE_MAX_SIZE -#define FW_FILE_HANDLE_MAX_SIZE 48 //!< Maximum size of a handle for OS queues -#endif - -#ifndef FW_MUTEX_HANDLE_MAX_SIZE -#define FW_MUTEX_HANDLE_MAX_SIZE 72 //!< Maximum size of a handle for OS queues -#endif - -#ifndef FW_QUEUE_HANDLE_MAX_SIZE -#define FW_QUEUE_HANDLE_MAX_SIZE 352 //!< Maximum size of a handle for OS queues -#endif - -#ifndef FW_DIRECTORY_HANDLE_MAX_SIZE -#define FW_DIRECTORY_HANDLE_MAX_SIZE 48 //!< Maximum size of a handle for OS resources (files, queues, locks, etc.) -#endif - -#ifndef FW_FILESYSTEM_HANDLE_MAX_SIZE -#define FW_FILESYSTEM_HANDLE_MAX_SIZE 16 //!< Maximum size of a handle for OS resources (files, queues, locks, etc.) -#endif - -#ifndef FW_RAW_TIME_HANDLE_MAX_SIZE -#define FW_RAW_TIME_HANDLE_MAX_SIZE 56 //!< Maximum size of a handle for OS::RawTime objects -#endif - -#ifndef FW_RAW_TIME_SERIALIZATION_MAX_SIZE -#define FW_RAW_TIME_SERIALIZATION_MAX_SIZE 8 //!< Maximum allowed serialization size for Os::RawTime objects -#endif - -#ifndef FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE -#define FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE 56 //!< Maximum size of a handle for OS condition variables -#endif - -#ifndef FW_CPU_HANDLE_MAX_SIZE -#define FW_CPU_HANDLE_MAX_SIZE 16 //!< Maximum size of a handle for OS cpu -#endif - -#ifndef FW_MEMORY_HANDLE_MAX_SIZE -#define FW_MEMORY_HANDLE_MAX_SIZE 16 //!< Maximum size of a handle for OS memory -#endif - -#ifndef FW_HANDLE_ALIGNMENT -#define FW_HANDLE_ALIGNMENT 8 //!< Alignment of handle storage -#endif - -// Note: One buffer of this size will be stack-allocated during certain OSAL operations e.g. when copying a file -#ifndef FW_FILE_CHUNK_SIZE -#define FW_FILE_CHUNK_SIZE 512 //!< Chunk size for working with files in the OSAL layer +// Posix thread names are limited to 16 characters, this can lead to collisions. In the event of a +// collision, set this to 0. +#ifndef POSIX_THREADS_ENABLE_NAMES +#define POSIX_THREADS_ENABLE_NAMES 1 //!< Enable/Disable assigning names to threads #endif // *** 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/LedBlinker/config/FpConstants.fpp b/LedBlinker/config/FpConstants.fpp new file mode 100644 index 0000000..1c68d50 --- /dev/null +++ b/LedBlinker/config/FpConstants.fpp @@ -0,0 +1,86 @@ +# ====================================================================== +# FPP file for configuration of various F Prime framework constants +# ====================================================================== + +# --------------------------------------------------------------------- +# Buffer sizes +# --------------------------------------------------------------------- + +@ When dumping the contents of the registry, this specifies the size of the buffer used to store object names. +@ Should be >= FW_OBJ_NAME_BUFFER_SIZE. +constant FW_OBJ_SIMPLE_REG_BUFF_SIZE = 255 + +@ Specifies the size of the string holding the queue name for queues +constant FW_QUEUE_NAME_BUFFER_SIZE = 1 + +@ Specifies the size of the string holding the task name for active components and tasks +constant FW_TASK_NAME_BUFFER_SIZE = 1 + +@ Specifies the size of the buffer that contains a communications packet +constant FW_COM_BUFFER_MAX_SIZE = 128 + +@ Specifies the size of the buffer attached to state machine signals +constant FW_SM_SIGNAL_BUFFER_MAX_SIZE = 128 + +@ Specifies the size of the buffer that contains the serialized command arguments +constant FW_CMD_ARG_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - SIZE_OF_FwOpcodeType - SIZE_OF_FwPacketDescriptorType + +@ Specifies the maximum size of a string in a command argument +constant FW_CMD_STRING_MAX_SIZE = 40 + +@ Specifies the size of the buffer that contains the serialized log arguments +constant FW_LOG_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - SIZE_OF_FwEventIdType - SIZE_OF_FwPacketDescriptorType + +@ Specifies the maximum size of a string in a log event +@ Note: This constant truncates file names in assertion failure event reports +constant FW_LOG_STRING_MAX_SIZE = 64 + +@ Specifies the size of the buffer that contains the serialized telemetry value +constant FW_TLM_BUFFER_MAX_SIZE = 12 + SIZE_OF_FwChanIdType + SIZE_OF_FwPacketDescriptorType + +@ Specifies the size of the buffer that contains the serialized telemetry value +constant FW_STATEMENT_ARG_BUFFER_MAX_SIZE = FW_CMD_ARG_BUFFER_MAX_SIZE + +@ Specifies the maximum size of a string in a telemetry channel +constant FW_TLM_STRING_MAX_SIZE = 10 + +@ Specifies the size of the buffer that contains the serialized parameter value +constant FW_PARAM_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - SIZE_OF_FwPrmIdType - SIZE_OF_FwPacketDescriptorType + +@ Specifies the maximum size of a string in a parameter +constant FW_PARAM_STRING_MAX_SIZE = 40 + +@ Specifies the maximum size of a file downlink chunk +constant FW_FILE_BUFFER_MAX_SIZE = 255 + +@ Specifies the maximum size of a string in an interface call +constant FW_INTERNAL_INTERFACE_STRING_MAX_SIZE = 64 + +@ Defines the size of the text log string buffer. Should be large enough for format string and arguments +constant FW_LOG_TEXT_BUFFER_SIZE = 128 + +@ Configuration for Fw::String +@ Note: FPrimeBasicTypes.hpp needs to be updated to sync enum +constant FW_FIXED_LENGTH_STRING_SIZE = 128 + +# --------------------------------------------------------------------- +# Other constants +# --------------------------------------------------------------------- + +@ For the simple object registry provided with the framework, this specifies how many objects the registry will store. +constant FW_OBJ_SIMPLE_REG_ENTRIES = 128 + +@ For the simple queue registry provided with the framework, this specifies how many queues the registry will store. +constant FW_QUEUE_SIMPLE_QUEUE_ENTRIES = 100 + +@ Maximum number of cascading FW_ASSERT check failures before forcing a system assert +constant FW_ASSERT_COUNT_MAX = 10 + +@ Don't care value for time contexts in sequences +constant FW_CONTEXT_DONT_CARE = 0xFF + +@ Value encoded during serialization for boolean true +dictionary constant FW_SERIALIZE_TRUE_VALUE = 0xFF + +@ Value encoded during serialization for boolean false +dictionary constant FW_SERIALIZE_FALSE_VALUE = 0x00 diff --git a/LedBlinker/config/PlatformCfg.fpp b/LedBlinker/config/PlatformCfg.fpp new file mode 100644 index 0000000..ce8e582 --- /dev/null +++ b/LedBlinker/config/PlatformCfg.fpp @@ -0,0 +1,45 @@ +# ======================================================================= +# FPP file for configuration of various F Prime Platform and Os constants +# ======================================================================= + +@ Maximum size of a handle for Os::Console +constant FW_CONSOLE_HANDLE_MAX_SIZE = 24 + +@ Maximum size of a handle for Os::Task +constant FW_TASK_HANDLE_MAX_SIZE = 40 + +@ Maximum size of a handle for Os::File +constant FW_FILE_HANDLE_MAX_SIZE = 48 + +@ Maximum size of a handle for Os::Mutex +constant FW_MUTEX_HANDLE_MAX_SIZE = 72 + +@ Maximum size of a handle for Os::Queue +constant FW_QUEUE_HANDLE_MAX_SIZE = 368 + +@ Maximum size of a handle for Os::Directory +constant FW_DIRECTORY_HANDLE_MAX_SIZE = 48 + +@ Maximum size of a handle for Os::FileSystem +constant FW_FILESYSTEM_HANDLE_MAX_SIZE = 16 + +@ Maximum size of a handle for Os::RawTime +constant FW_RAW_TIME_HANDLE_MAX_SIZE = 56 + +@ Maximum allowed serialization size for Os::RawTime objects +constant FW_RAW_TIME_SERIALIZATION_MAX_SIZE = 8 + +@ Maximum size of a handle for Os::ConditionVariable +constant FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE = 56 + +@ Maximum size of a handle for Os::Cpu +constant FW_CPU_HANDLE_MAX_SIZE = 16 + +@ Maximum size of a handle for Os::Memory +constant FW_MEMORY_HANDLE_MAX_SIZE = 16 + +@ Alignment of handle storage +constant FW_HANDLE_ALIGNMENT = 8 + +@ Chunk size for working with files in the OSAL layer +constant FW_FILE_CHUNK_SIZE = 512 diff --git a/LedBlinker/config/StaticMemoryConfig.hpp b/LedBlinker/config/StaticMemoryConfig.hpp index cd5fafc..e553015 100644 --- a/LedBlinker/config/StaticMemoryConfig.hpp +++ b/LedBlinker/config/StaticMemoryConfig.hpp @@ -8,10 +8,7 @@ #define SVC_STATIC_MEMORY_CFG_HPP_ namespace Svc { - enum StaticMemoryConfig { - STATIC_MEMORY_ALLOCATION_SIZE = 140 - }; +enum StaticMemoryConfig { STATIC_MEMORY_ALLOCATION_SIZE = 140 }; } #endif - diff --git a/LedBlinker/config/TlmChanImplCfg.hpp b/LedBlinker/config/TlmChanImplCfg.hpp index a3738e3..f33d625 100644 --- a/LedBlinker/config/TlmChanImplCfg.hpp +++ b/LedBlinker/config/TlmChanImplCfg.hpp @@ -15,7 +15,6 @@ // Anonymous namespace for configuration parameters - // The parameters below provide for tuning of the hash function used to // write and read entries in the database. The has function is very simple; // It first takes the telemetry ID and does a modulo computation with @@ -41,15 +40,15 @@ namespace { - enum { - TLMCHAN_NUM_TLM_HASH_SLOTS = 5, // !< Number of slots in the hash table. - // Works best when set to about twice the number of components producing telemetry - TLMCHAN_HASH_MOD_VALUE = 99, // !< The modulo value of the hashing function. - // Should be set to a little below the ID gaps to spread the entries around - TLMCHAN_HASH_BUCKETS = 18 // !< Buckets assignable to a hash slot. - // Buckets must be >= number of telemetry channels in system - }; +enum { + TLMCHAN_NUM_TLM_HASH_SLOTS = 5, // !< Number of slots in the hash table. + // Works best when set to about twice the number of components producing telemetry + TLMCHAN_HASH_MOD_VALUE = 99, // !< The modulo value of the hashing function. + // Should be set to a little below the ID gaps to spread the entries around + TLMCHAN_HASH_BUCKETS = 18 // !< Buckets assignable to a hash slot. + // Buckets must be >= number of telemetry channels in system +}; } diff --git a/docs/arduino-led-blinker.md b/docs/arduino-led-blinker.md index 4828bea..77a2bd8 100644 --- a/docs/arduino-led-blinker.md +++ b/docs/arduino-led-blinker.md @@ -820,14 +820,14 @@ To do this, add the following lines to the `connections LedBlinker` block in `ar connections LedBlinker { # Add here connections to user-defined components # Rate Group 1 (1Hz cycle) output is connected to led's run input - rateGroup1.RateGroupMemberOut[3] -> led.run + rateGroup1.RateGroupMemberOut[4] -> led.run # led's gpioSet output is connected to gpioDriver's gpioWrite input led.gpioSet -> gpioDriver.gpioWrite } ``` > [!NOTE] -> `rateGroup1` is preconfigured to call all `RateGroupMemberOut` at a rate of 1 Hz. We use index `RateGroupMemberOut[3]` because `RateGroupMemberOut[0]` through `RateGroupMemberOut[2]` were used previously in the `RateGroups` connection block. +> `rateGroup1` is preconfigured to call all `RateGroupMemberOut` at a rate of 1 Hz. We use index `RateGroupMemberOut[4]` because `RateGroupMemberOut[0]` through `RateGroupMemberOut[3]` were used previously in the `RateGroups` connection block. ### Configuring The GPIO Driver diff --git a/lib/fprime b/lib/fprime index abb09e4..94b4457 160000 --- a/lib/fprime +++ b/lib/fprime @@ -1 +1 @@ -Subproject commit abb09e4a681cd586ac719a7517430637cdc46199 +Subproject commit 94b445715473b41484ea11a739f242478f02279e diff --git a/lib/fprime-arduino b/lib/fprime-arduino index a2285fb..e7ab740 160000 --- a/lib/fprime-arduino +++ b/lib/fprime-arduino @@ -1 +1 @@ -Subproject commit a2285fb931b009e972c0834b569be75749045c92 +Subproject commit e7ab740568c0af1b12a02d53acc7449df3941e80 From 5cf5cc557f0692bb3dbfa09c173777bc2b25d114 Mon Sep 17 00:00:00 2001 From: Nathan Cheek Date: Sun, 4 Oct 2026 01:47:45 -0700 Subject: [PATCH 3/5] Move to the fprime v4 project layout --- .gitignore | 2 +- CMakeLists.txt | 2 +- CMakePresets.json | 39 ++++++ LedBlinker/CMakeLists.txt | 32 +---- .../Components}/CMakeLists.txt | 0 .../Components}/Led/CMakeLists.txt | 0 .../Components}/Led/Led.cpp | 6 +- .../Components}/Led/Led.fpp | 4 +- .../Components}/Led/Led.hpp | 12 +- .../LedBlinkerDeployment/CMakeLists.txt | 29 ++++ .../{ => LedBlinkerDeployment}/Main.cpp | 4 +- .../{ => LedBlinkerDeployment}/README.md | 16 +-- .../Top/CMakeLists.txt | 2 +- .../Top/LedBlinkerDeploymentTopology.cpp} | 6 +- .../Top/LedBlinkerDeploymentTopology.hpp} | 12 +- .../Top/LedBlinkerDeploymentTopologyDefs.hpp} | 10 +- .../Top/instances.fpp | 2 +- .../Top/topology.fpp | 4 +- .../config/AcConstants.fpp | 0 .../config/BufferManagerComponentImplCfg.hpp | 0 .../config/CMakeLists.txt | 0 .../config/ComCcsdsConfig/CMakeLists.txt | 0 .../config/ComCcsdsConfig/ComCcsdsConfig.fpp | 0 .../config/ComFprimeConfig/CMakeLists.txt | 0 .../ComFprimeConfig/ComFprimeConfig.fpp | 0 .../config/CommandDispatcherImplCfg.hpp | 0 .../config/FpConfig.h | 0 .../config/FpConstants.fpp | 0 .../config/PlatformCfg.fpp | 0 .../config/StaticMemoryConfig.hpp | 0 .../config/TlmChanImplCfg.hpp | 0 docs/arduino-led-blinker.md | 126 +++++++++--------- project.cmake | 8 -- 33 files changed, 177 insertions(+), 139 deletions(-) create mode 100644 CMakePresets.json rename {Components => LedBlinker/Components}/CMakeLists.txt (100%) rename {Components => LedBlinker/Components}/Led/CMakeLists.txt (100%) rename {Components => LedBlinker/Components}/Led/Led.cpp (97%) rename {Components => LedBlinker/Components}/Led/Led.fpp (99%) rename {Components => LedBlinker/Components}/Led/Led.hpp (89%) create mode 100644 LedBlinker/LedBlinkerDeployment/CMakeLists.txt rename LedBlinker/{ => LedBlinkerDeployment}/Main.cpp (88%) rename LedBlinker/{ => LedBlinkerDeployment}/README.md (55%) rename LedBlinker/{ => LedBlinkerDeployment}/Top/CMakeLists.txt (89%) rename LedBlinker/{Top/LedBlinkerTopology.cpp => LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.cpp} (95%) rename LedBlinker/{Top/LedBlinkerTopology.hpp => LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.hpp} (89%) rename LedBlinker/{Top/LedBlinkerTopologyDefs.hpp => LedBlinkerDeployment/Top/LedBlinkerDeploymentTopologyDefs.hpp} (88%) rename LedBlinker/{ => LedBlinkerDeployment}/Top/instances.fpp (97%) rename LedBlinker/{ => LedBlinkerDeployment}/Top/topology.fpp (97%) rename LedBlinker/{ => LedBlinkerDeployment}/config/AcConstants.fpp (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/BufferManagerComponentImplCfg.hpp (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/CMakeLists.txt (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/ComCcsdsConfig/CMakeLists.txt (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/ComCcsdsConfig/ComCcsdsConfig.fpp (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/ComFprimeConfig/CMakeLists.txt (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/ComFprimeConfig/ComFprimeConfig.fpp (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/CommandDispatcherImplCfg.hpp (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/FpConfig.h (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/FpConstants.fpp (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/PlatformCfg.fpp (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/StaticMemoryConfig.hpp (100%) rename LedBlinker/{ => LedBlinkerDeployment}/config/TlmChanImplCfg.hpp (100%) delete mode 100644 project.cmake diff --git a/.gitignore b/.gitignore index 5eea420..08a0251 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ build-fprime-* /.idea/ /.vscode/ .DS_Store -*.gcov \ No newline at end of file +*.gcov diff --git a/CMakeLists.txt b/CMakeLists.txt index 80a0f62..0d0ab9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,4 +16,4 @@ fprime_setup_included_code() # This includes project-wide objects -include("${CMAKE_CURRENT_LIST_DIR}/project.cmake") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LedBlinker") diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..caa8c61 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,39 @@ +{ + "version": 4, + "configurePresets": [ + { + "name": "fprime", + "displayName": "F´ Release Preset", + "description": "F´ release build using local fprime-venv", + "binaryDir": "${sourceDir}/build-fprime-automatic-native", + "generator": "Ninja", + "environment": { + "VIRTUAL_ENV": "${fileDir}/fprime-venv", + "PATH": "$env{VIRTUAL_ENV}/bin:$penv{PATH}" + }, + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "fprime-debug", + "inherits": "fprime", + "displayName": "F´ Debug Preset", + "description": "F´ debug build using local fprime-venv", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "fprime-ut", + "inherits": "fprime-debug", + "displayName": "F´ Unit Test Preset", + "description": "F´ debug build including unit tests using local fprime-venv", + "binaryDir": "${sourceDir}/build-fprime-automatic-native-ut", + "cacheVariables": { + "BUILD_TESTING": "ON" + } + } + ] +} diff --git a/LedBlinker/CMakeLists.txt b/LedBlinker/CMakeLists.txt index bcffc8f..0d5c3f5 100644 --- a/LedBlinker/CMakeLists.txt +++ b/LedBlinker/CMakeLists.txt @@ -1,29 +1,5 @@ -##### -# 'LedBlinker' Deployment: -# -# This registers the 'LedBlinker' deployment to the build system. -# Custom components that have not been added at the project-level should be added to -# the list below. -# -##### +# This CMake file is intended to register project-wide objects. +# This allows for reuse between deployments, or other projects. -# Deployment is only compatible with the Arduino platform -restrict_platforms(ArduinoFw) - -### -# Topology and Components -### -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/config/") -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Top/") - -# Add custom components to this specific deployment here -# add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/MyComponent/") - -register_fprime_deployment( - SOURCES - "${CMAKE_CURRENT_LIST_DIR}/Main.cpp" - DEPENDS - ${FPRIME_CURRENT_MODULE}_Top -) - -finalize_arduino_executable("${FPRIME_CURRENT_MODULE}") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Components") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LedBlinkerDeployment/") diff --git a/Components/CMakeLists.txt b/LedBlinker/Components/CMakeLists.txt similarity index 100% rename from Components/CMakeLists.txt rename to LedBlinker/Components/CMakeLists.txt diff --git a/Components/Led/CMakeLists.txt b/LedBlinker/Components/Led/CMakeLists.txt similarity index 100% rename from Components/Led/CMakeLists.txt rename to LedBlinker/Components/Led/CMakeLists.txt diff --git a/Components/Led/Led.cpp b/LedBlinker/Components/Led/Led.cpp similarity index 97% rename from Components/Led/Led.cpp rename to LedBlinker/Components/Led/Led.cpp index a49b265..860a1a0 100644 --- a/Components/Led/Led.cpp +++ b/LedBlinker/Components/Led/Led.cpp @@ -4,9 +4,9 @@ // \brief cpp file for Led component implementation class // ====================================================================== -#include "Components/Led/Led.hpp" +#include "LedBlinker/Components/Led/Led.hpp" -namespace Components { +namespace LedBlinker { // ---------------------------------------------------------------------- // Component construction and destruction @@ -96,4 +96,4 @@ void Led ::BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::On on this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } -} // namespace Components +} // namespace LedBlinker diff --git a/Components/Led/Led.fpp b/LedBlinker/Components/Led/Led.fpp similarity index 99% rename from Components/Led/Led.fpp rename to LedBlinker/Components/Led/Led.fpp index 7c21fe7..e63cdd1 100644 --- a/Components/Led/Led.fpp +++ b/LedBlinker/Components/Led/Led.fpp @@ -1,4 +1,4 @@ -module Components { +module LedBlinker { @ Component to blink an LED driven by a rate group active component Led { @@ -68,4 +68,4 @@ module Components { param set port prmSetOut } -} \ No newline at end of file +} diff --git a/Components/Led/Led.hpp b/LedBlinker/Components/Led/Led.hpp similarity index 89% rename from Components/Led/Led.hpp rename to LedBlinker/Components/Led/Led.hpp index 562b7de..743d256 100644 --- a/Components/Led/Led.hpp +++ b/LedBlinker/Components/Led/Led.hpp @@ -4,12 +4,12 @@ // \brief hpp file for Led component implementation class // ====================================================================== -#ifndef Components_Led_HPP -#define Components_Led_HPP +#ifndef LedBlinker_Led_HPP +#define LedBlinker_Led_HPP -#include "Components/Led/LedComponentAc.hpp" +#include "LedBlinker/Components/Led/LedComponentAc.hpp" -namespace Components { +namespace LedBlinker { class Led final : public LedComponentBase { public: @@ -57,9 +57,9 @@ class Led final : public LedComponentBase { 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 from FSW boot up U32 m_toggleCounter = 0; //! Keeps track of how many ticks the LED has been on for - bool m_blinking = true; //! Flag: if true then LED blinking will occur else no blinking will happen + bool m_blinking = true; //! Flag: if true then LED blinking will occur else no blinking will happen }; -} // namespace Components +} // namespace LedBlinker #endif diff --git a/LedBlinker/LedBlinkerDeployment/CMakeLists.txt b/LedBlinker/LedBlinkerDeployment/CMakeLists.txt new file mode 100644 index 0000000..30b2fcc --- /dev/null +++ b/LedBlinker/LedBlinkerDeployment/CMakeLists.txt @@ -0,0 +1,29 @@ +##### +# 'LedBlinkerDeployment' Deployment: +# +# This registers the 'LedBlinkerDeployment' deployment to the build system. +# Custom components that have not been added at the project-level should be added to +# the list below. +# +##### + +# Deployment is only compatible with the Arduino platform +restrict_platforms(ArduinoFw) + +### +# Topology and Components +### +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/config/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Top/") + +# Add custom components to this specific deployment here +# add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/MyComponent/") + +register_fprime_deployment( + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/Main.cpp" + DEPENDS + ${FPRIME_CURRENT_MODULE}_Top +) + +finalize_arduino_executable("${FPRIME_CURRENT_MODULE}") diff --git a/LedBlinker/Main.cpp b/LedBlinker/LedBlinkerDeployment/Main.cpp similarity index 88% rename from LedBlinker/Main.cpp rename to LedBlinker/LedBlinkerDeployment/Main.cpp index fbdd158..e9628b9 100644 --- a/LedBlinker/Main.cpp +++ b/LedBlinker/LedBlinkerDeployment/Main.cpp @@ -4,8 +4,8 @@ // // ====================================================================== // Used to access topology functions -#include -#include +#include +#include // Used for Baremetal TaskRunner #include diff --git a/LedBlinker/README.md b/LedBlinker/LedBlinkerDeployment/README.md similarity index 55% rename from LedBlinker/README.md rename to LedBlinker/LedBlinkerDeployment/README.md index a12037c..d44195a 100644 --- a/LedBlinker/README.md +++ b/LedBlinker/LedBlinkerDeployment/README.md @@ -1,17 +1,17 @@ -# LedBlinker Application +# LedBlinkerDeployment Application This deployment was auto-generated by the F' utility tool. -## Building and Running the LedBlinker Application +## Building and Running the LedBlinkerDeployment Application -In order to build the LedBlinker application, or any other F´ application, we first need to generate a build directory. This can be done with the following commands: +In order to build the LedBlinkerDeployment application, or any other F´ application, we first need to generate a build directory. This can be done with the following commands: ```sh -cd LedBlinker +cd LedBlinker/LedBlinkerDeployment fprime-util generate ``` -The next step is to build the LedBlinker application's code. Build from the deployment's folder: building from the project root also builds every F´ framework module, and some of them don't build for Arduino boards. +The next step is to build the LedBlinkerDeployment application's code. Build from the deployment's folder: building from the project root also builds every F´ framework module, and some of them don't build for Arduino boards. ```sh fprime-util build ``` @@ -23,7 +23,7 @@ The following command will spin up the F' GDS. Examples are available for UART, ### UART ```sh -fprime-gds -n --dictionary ./build-artifacts//LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 +fprime-gds -n --dictionary ./build-artifacts//LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 ``` > [!NOTE] @@ -36,7 +36,7 @@ fprime-gds -n --dictionary ./build-artifacts//LedBlinker/dict/LedBli ### TcpServer ```sh -fprime-gds -n --dictionary ./build-artifacts//LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime --ip-client --ip-address +fprime-gds -n --dictionary ./build-artifacts//LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime --ip-client --ip-address ``` > [!NOTE] @@ -47,7 +47,7 @@ fprime-gds -n --dictionary ./build-artifacts//LedBlinker/dict/LedBli ### TcpClient ```sh -fprime-gds -n --dictionary ./build-artifacts//LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime +fprime-gds -n --dictionary ./build-artifacts//LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime ``` > [!NOTE] diff --git a/LedBlinker/Top/CMakeLists.txt b/LedBlinker/LedBlinkerDeployment/Top/CMakeLists.txt similarity index 89% rename from LedBlinker/Top/CMakeLists.txt rename to LedBlinker/LedBlinkerDeployment/Top/CMakeLists.txt index 51f538c..3328c57 100644 --- a/LedBlinker/Top/CMakeLists.txt +++ b/LedBlinker/LedBlinkerDeployment/Top/CMakeLists.txt @@ -15,7 +15,7 @@ register_fprime_module( "${CMAKE_CURRENT_LIST_DIR}/instances.fpp" "${CMAKE_CURRENT_LIST_DIR}/topology.fpp" SOURCES - "${CMAKE_CURRENT_LIST_DIR}/LedBlinkerTopology.cpp" + "${CMAKE_CURRENT_LIST_DIR}/LedBlinkerDeploymentTopology.cpp" DEPENDS Arduino_Drv_StreamDriver fprime-baremetal_Os_TaskRunner diff --git a/LedBlinker/Top/LedBlinkerTopology.cpp b/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.cpp similarity index 95% rename from LedBlinker/Top/LedBlinkerTopology.cpp rename to LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.cpp index 4853444..c0705c6 100644 --- a/LedBlinker/Top/LedBlinkerTopology.cpp +++ b/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.cpp @@ -1,10 +1,10 @@ // ====================================================================== -// \title LedBlinkerTopology.cpp +// \title LedBlinkerDeploymentTopology.cpp // \brief cpp file containing the topology instantiation code // // ====================================================================== // Provides access to autocoded functions -#include +#include #include #include @@ -38,7 +38,7 @@ void configureTopology() { gpioDriver.open(Arduino::DEF_LED_BUILTIN, Arduino::GpioDriver::GpioDirection::OUT); } -// Public functions for use in main program are namespaced with deployment name LedBlinker +// Public functions for use in main program are namespaced with deployment namespace LedBlinker namespace LedBlinker { void setupTopology(const TopologyState& state) { // Autocoded initialization. Function provided by autocoder. diff --git a/LedBlinker/Top/LedBlinkerTopology.hpp b/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.hpp similarity index 89% rename from LedBlinker/Top/LedBlinkerTopology.hpp rename to LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.hpp index f99f84d..3aab5bc 100644 --- a/LedBlinker/Top/LedBlinkerTopology.hpp +++ b/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.hpp @@ -1,13 +1,13 @@ // ====================================================================== -// \title LedBlinkerTopology.hpp +// \title LedBlinkerDeploymentTopology.hpp // \brief header file containing the topology instantiation definitions // // ====================================================================== -#ifndef LEDBLINKER_LEDBLINKERTOPOLOGY_HPP -#define LEDBLINKER_LEDBLINKERTOPOLOGY_HPP +#ifndef LEDBLINKERDEPLOYMENT_LEDBLINKERDEPLOYMENTTOPOLOGY_HPP +#define LEDBLINKERDEPLOYMENT_LEDBLINKERDEPLOYMENTTOPOLOGY_HPP // Included for access to LedBlinker::TopologyState and LedBlinker::ConfigObjects::pingEntries. These definitions are required by the // autocoder, but are also used in this hand-coded topology. -#include +#include // Remove unnecessary LedBlinker:: qualifications using namespace LedBlinker; @@ -32,7 +32,7 @@ namespace LedBlinker { * custom tasks often start radio communication it is convenient to start them last. * * The state argument carries command line inputs used to setup the topology. For an explanation of the required type - * LedBlinker::TopologyState see: LedBlinkerTopologyDefs.hpp. + * LedBlinker::TopologyState see: LedBlinkerDeploymentTopologyDefs.hpp. * * \param state: object shuttling CLI arguments (hostname, port) needed to construct the topology */ @@ -53,7 +53,7 @@ void setupTopology(const TopologyState& state); * Step 1, 2, 3, and 4 must occur in-order as the tasks must be stopped before being joined. These tasks must be stopped * and joined before any active resources may be deallocated. * - * For an explanation of the required type LedBlinker::TopologyState see: LedBlinkerTopologyDefs.hpp. + * For an explanation of the required type LedBlinker::TopologyState see: LedBlinkerDeploymentTopologyDefs.hpp. * * \param state: state object provided to setupTopology */ diff --git a/LedBlinker/Top/LedBlinkerTopologyDefs.hpp b/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopologyDefs.hpp similarity index 88% rename from LedBlinker/Top/LedBlinkerTopologyDefs.hpp rename to LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopologyDefs.hpp index 2cd7f70..dfb260c 100644 --- a/LedBlinker/Top/LedBlinkerTopologyDefs.hpp +++ b/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopologyDefs.hpp @@ -1,13 +1,13 @@ // ====================================================================== -// \title LedBlinkerTopologyDefs.hpp +// \title LedBlinkerDeploymentTopologyDefs.hpp // \brief required header file containing the required definitions for the topology autocoder // // ====================================================================== -#ifndef LEDBLINKER_LEDBLINKERTOPOLOGYDEFS_HPP -#define LEDBLINKER_LEDBLINKERTOPOLOGYDEFS_HPP +#ifndef LEDBLINKERDEPLOYMENT_LEDBLINKERDEPLOYMENTTOPOLOGYDEFS_HPP +#define LEDBLINKERDEPLOYMENT_LEDBLINKERDEPLOYMENTTOPOLOGYDEFS_HPP #include "Fw/Types/MallocAllocator.hpp" -#include "LedBlinker/Top/FppConstantsAc.hpp" +#include "LedBlinker/LedBlinkerDeployment/Top/FppConstantsAc.hpp" // SubtopologyTopologyDefs includes #include "Svc/Subtopologies/ComFprime/SubtopologyTopologyDefs.hpp" @@ -41,7 +41,7 @@ namespace PingEntries { namespace LedBlinker_rateGroup1 {enum { WARN = 3, FATAL = 5 };} } // namespace PingEntries -// Definitions are placed within a namespace named after the deployment +// Definitions are placed within the deployment namespace namespace LedBlinker { /** diff --git a/LedBlinker/Top/instances.fpp b/LedBlinker/LedBlinkerDeployment/Top/instances.fpp similarity index 97% rename from LedBlinker/Top/instances.fpp rename to LedBlinker/LedBlinkerDeployment/Top/instances.fpp index a5ab343..6911ee0 100644 --- a/LedBlinker/Top/instances.fpp +++ b/LedBlinker/LedBlinkerDeployment/Top/instances.fpp @@ -28,7 +28,7 @@ module LedBlinker { stack size Default.STACK_SIZE \ priority 97 - instance led: Components.Led base id 0x0E00 \ + instance led: LedBlinker.Led base id 0x0E00 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 95 diff --git a/LedBlinker/Top/topology.fpp b/LedBlinker/LedBlinkerDeployment/Top/topology.fpp similarity index 97% rename from LedBlinker/Top/topology.fpp rename to LedBlinker/LedBlinkerDeployment/Top/topology.fpp index a659a84..792d05a 100644 --- a/LedBlinker/Top/topology.fpp +++ b/LedBlinker/LedBlinkerDeployment/Top/topology.fpp @@ -8,7 +8,7 @@ module LedBlinker { rateGroup1 } - topology LedBlinker { + topology LedBlinkerDeployment { # ---------------------------------------------------------------------- # Subtopology imports @@ -92,7 +92,7 @@ module LedBlinker { cmdDisp.seqCmdStatus -> ComFprime.fprimeRouter.cmdResponseIn } - connections LedBlinker { + connections LedBlinkerDeployment { # Add here connections to user-defined components # Rate Group 1 (1Hz cycle) output is connected to led's run input rateGroup1.RateGroupMemberOut[4] -> led.run diff --git a/LedBlinker/config/AcConstants.fpp b/LedBlinker/LedBlinkerDeployment/config/AcConstants.fpp similarity index 100% rename from LedBlinker/config/AcConstants.fpp rename to LedBlinker/LedBlinkerDeployment/config/AcConstants.fpp diff --git a/LedBlinker/config/BufferManagerComponentImplCfg.hpp b/LedBlinker/LedBlinkerDeployment/config/BufferManagerComponentImplCfg.hpp similarity index 100% rename from LedBlinker/config/BufferManagerComponentImplCfg.hpp rename to LedBlinker/LedBlinkerDeployment/config/BufferManagerComponentImplCfg.hpp diff --git a/LedBlinker/config/CMakeLists.txt b/LedBlinker/LedBlinkerDeployment/config/CMakeLists.txt similarity index 100% rename from LedBlinker/config/CMakeLists.txt rename to LedBlinker/LedBlinkerDeployment/config/CMakeLists.txt diff --git a/LedBlinker/config/ComCcsdsConfig/CMakeLists.txt b/LedBlinker/LedBlinkerDeployment/config/ComCcsdsConfig/CMakeLists.txt similarity index 100% rename from LedBlinker/config/ComCcsdsConfig/CMakeLists.txt rename to LedBlinker/LedBlinkerDeployment/config/ComCcsdsConfig/CMakeLists.txt diff --git a/LedBlinker/config/ComCcsdsConfig/ComCcsdsConfig.fpp b/LedBlinker/LedBlinkerDeployment/config/ComCcsdsConfig/ComCcsdsConfig.fpp similarity index 100% rename from LedBlinker/config/ComCcsdsConfig/ComCcsdsConfig.fpp rename to LedBlinker/LedBlinkerDeployment/config/ComCcsdsConfig/ComCcsdsConfig.fpp diff --git a/LedBlinker/config/ComFprimeConfig/CMakeLists.txt b/LedBlinker/LedBlinkerDeployment/config/ComFprimeConfig/CMakeLists.txt similarity index 100% rename from LedBlinker/config/ComFprimeConfig/CMakeLists.txt rename to LedBlinker/LedBlinkerDeployment/config/ComFprimeConfig/CMakeLists.txt diff --git a/LedBlinker/config/ComFprimeConfig/ComFprimeConfig.fpp b/LedBlinker/LedBlinkerDeployment/config/ComFprimeConfig/ComFprimeConfig.fpp similarity index 100% rename from LedBlinker/config/ComFprimeConfig/ComFprimeConfig.fpp rename to LedBlinker/LedBlinkerDeployment/config/ComFprimeConfig/ComFprimeConfig.fpp diff --git a/LedBlinker/config/CommandDispatcherImplCfg.hpp b/LedBlinker/LedBlinkerDeployment/config/CommandDispatcherImplCfg.hpp similarity index 100% rename from LedBlinker/config/CommandDispatcherImplCfg.hpp rename to LedBlinker/LedBlinkerDeployment/config/CommandDispatcherImplCfg.hpp diff --git a/LedBlinker/config/FpConfig.h b/LedBlinker/LedBlinkerDeployment/config/FpConfig.h similarity index 100% rename from LedBlinker/config/FpConfig.h rename to LedBlinker/LedBlinkerDeployment/config/FpConfig.h diff --git a/LedBlinker/config/FpConstants.fpp b/LedBlinker/LedBlinkerDeployment/config/FpConstants.fpp similarity index 100% rename from LedBlinker/config/FpConstants.fpp rename to LedBlinker/LedBlinkerDeployment/config/FpConstants.fpp diff --git a/LedBlinker/config/PlatformCfg.fpp b/LedBlinker/LedBlinkerDeployment/config/PlatformCfg.fpp similarity index 100% rename from LedBlinker/config/PlatformCfg.fpp rename to LedBlinker/LedBlinkerDeployment/config/PlatformCfg.fpp diff --git a/LedBlinker/config/StaticMemoryConfig.hpp b/LedBlinker/LedBlinkerDeployment/config/StaticMemoryConfig.hpp similarity index 100% rename from LedBlinker/config/StaticMemoryConfig.hpp rename to LedBlinker/LedBlinkerDeployment/config/StaticMemoryConfig.hpp diff --git a/LedBlinker/config/TlmChanImplCfg.hpp b/LedBlinker/LedBlinkerDeployment/config/TlmChanImplCfg.hpp similarity index 100% rename from LedBlinker/config/TlmChanImplCfg.hpp rename to LedBlinker/LedBlinkerDeployment/config/TlmChanImplCfg.hpp diff --git a/docs/arduino-led-blinker.md b/docs/arduino-led-blinker.md index 77a2bd8..81c6175 100644 --- a/docs/arduino-led-blinker.md +++ b/docs/arduino-led-blinker.md @@ -42,7 +42,7 @@ An F´ Project ties to a specific version of tools to work with F´. In order to this project and install the correct version of tools, you should perform a bootstrap of F´: 1. Ensure you meet the [F´ System Requirements](https://github.com/nasa/fprime?tab=readme-ov-file#system-requirements) -2. [Bootstrap your F´ project](https://fprime.jpl.nasa.gov/latest/docs/getting-started/installing-fprime/#creating-a-new-f-project) with the name `arduino-led-blinker` +2. [Bootstrap your F´ project](https://fprime.jpl.nasa.gov/latest/docs/getting-started/installing-fprime/#creating-a-new-f-project) with the repository name `arduino-led-blinker` and the top-level namespace `LedBlinker` Bootstrapping your F´ project created a folder called `arduino-led-blinker` (or any name you chose) containing the standard F´ project structure as well as the virtual environment up containing the tools to work with F´. @@ -164,7 +164,7 @@ It is time to create the basic component. In a terminal, navigate to the project ```bash # In arduino-led-blinker -cd Components +cd LedBlinker/Components fprime-util new --component ``` @@ -174,7 +174,7 @@ You will be prompted for information regarding your component. Fill out the prom [INFO] Cookiecutter source: using builtin [1/8] Component name (MyComponent): Led [2/8] Component short description (Component for F Prime FSW framework.): Component to blink an LED driven by a rate group - [3/8] Component namespace (Components): Components + [3/8] Component namespace (LedBlinker): LedBlinker [4/8] Select component kind 1 - active 2 - passive @@ -196,20 +196,20 @@ You will be prompted for information regarding your component. Fill out the prom 1 - yes 2 - no Choose from [1/2] (1): 1 -[INFO] Found CMake file at 'arduino-led-blinker/Components/CMakeLists.txt' -Add Led to arduino-led-blinker/Components/CMakeLists.txt at end of file? (yes/no) [yes]: yes +[INFO] Found CMake file at 'arduino-led-blinker/LedBlinker/Components/CMakeLists.txt' +Add Led to arduino-led-blinker/LedBlinker/Components/CMakeLists.txt at end of file? (yes/no) [yes]: yes Generate implementation files? (yes/no) [yes]: yes Refreshing cache and generating implementation files... [INFO] Created new component and generated initial implementations. ``` -Your new component is located in the directory `arduino-led-blinker/Components/Led`. +Your new component is located in the directory `arduino-led-blinker/LedBlinker/Components/Led`. #### Commands Commands are used to command the component from the ground system or a command sequencer. We will add a command named `BLINKING_ON_OFF` to turn on or off the blinking LED. This command will take in an argument named `onOff` of type `Fw.On`. -Inside your `arduino-led-blinker/Components/Led` directory, open the file `Led.fpp` and search for the following: +Inside your `arduino-led-blinker/LedBlinker/Components/Led` directory, open the file `Led.fpp` and search for the following: ``` # One async command/port is required for active components @@ -231,7 +231,7 @@ Replace that block with the following: Events represent a log of system activities. Events are typically emitted any time the system takes an action. Events are also emitted to report off-nominal conditions. -Inside your `arduino-led-blinker/Components/Led` directory, open the `Led.fpp` file. After the command you added in the previous section, add this event: +Inside your `arduino-led-blinker/LedBlinker/Components/Led` directory, open the `Led.fpp` file. After the command you added in the previous section, add this event: ``` @ Reports the state we set to blinking. @@ -257,27 +257,27 @@ You have completed the Command and Event design phase. We'll move on to the Comm ### Component Implementation -In the `arduino-led-blinker/Components/Led` directory, run the following: +In the `arduino-led-blinker/LedBlinker/Components/Led` directory, run the following: ```bash -# In arduino-led-blinker/Components/Led +# In arduino-led-blinker/LedBlinker/Components/Led fprime-util impl ``` This command will auto generate two files: `Led.template.hpp` and `Led.template.cpp`. These files contain the stub implementation for the component's newly added command. -Since this is the start of the component's implementation, we can use the generated template files for our initial component implementation. Inside your `arduino-led-blinker/Components/Led` directory, rename `Led.template.hpp` to `Led.hpp` and rename `Led.template.cpp` to `Led.cpp`. You can rename the files through the terminal using the two commands below: +Since this is the start of the component's implementation, we can use the generated template files for our initial component implementation. Inside your `arduino-led-blinker/LedBlinker/Components/Led` directory, rename `Led.template.hpp` to `Led.hpp` and rename `Led.template.cpp` to `Led.cpp`. You can rename the files through the terminal using the two commands below: ```bash -# In arduino-led-blinker/Components/Led +# In arduino-led-blinker/LedBlinker/Components/Led mv Led.template.hpp Led.hpp mv Led.template.cpp Led.cpp ``` -Verify your component is building correctly by running the following command in the `arduino-led-blinker/Components/Led` directory. +Verify your component is building correctly by running the following command in the `arduino-led-blinker/LedBlinker/Components/Led` directory. ```bash -# In arduino-led-blinker/Components/Led +# In arduino-led-blinker/LedBlinker/Components/Led fprime-util build ``` @@ -291,7 +291,7 @@ fprime-util build Many of the behaviors of the component discussed in the [Component Design](#component-design) section require the tracking of some state. Before diving into the implementation of the behavior let us set up and initialize that state. -Open `Led.hpp` in `arduino-led-blinker/Components/Led`, and add the following private member variables to the end of the file. +Open `Led.hpp` in `arduino-led-blinker/LedBlinker/Components/Led`, and add the following private member variables to the end of the file. ```cpp Fw::On m_state = Fw::On::OFF; //! Keeps track if LED is on or off @@ -300,10 +300,10 @@ Open `Led.hpp` in `arduino-led-blinker/Components/Led`, and add the following pr bool m_blinking = false; //! Flag: if true then LED blinking will occur else no blinking will happen ``` -Run the following in the `arduino-led-blinker/Components/Led` directory to verify your component is building correctly. +Run the following in the `arduino-led-blinker/LedBlinker/Components/Led` directory to verify your component is building correctly. ```bash -# In arduino-led-blinker/Components/Led +# In arduino-led-blinker/LedBlinker/Components/Led fprime-util build ``` @@ -331,7 +331,7 @@ void Led ::BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::On on Run the following command in the terminal to verify your component is building correctly. ```bash -# In arduino-led-blinker/Components/Led +# In arduino-led-blinker/LedBlinker/Components/Led fprime-util build ``` @@ -340,7 +340,7 @@ fprime-util build #### Events -Open `Led.cpp` in your `arduino-led-blinker/Components/Led` directory and navigate to the `BLINKING_ON_OFF` command. Report, via an event, the blinking state has been set. +Open `Led.cpp` in your `arduino-led-blinker/LedBlinker/Components/Led` directory and navigate to the `BLINKING_ON_OFF` command. Report, via an event, the blinking state has been set. To do so, replace: ```cpp @@ -356,7 +356,7 @@ with: Run the following to verify your component is building correctly. ```bash -# In arduino-led-blinker/Components/Led +# In arduino-led-blinker/LedBlinker/Components/Led fprime-util build ``` @@ -399,10 +399,11 @@ In this section, users will create a deployment and perform the initial integrat In order to produce an executable to run the software, users need to create a deployment. A deployment is one software executable that contains the main entry point, and an F´ system topology. -Create a new deployment in the `arduino-led-blinker` directory with: +Create a new deployment in the `arduino-led-blinker/LedBlinker` directory with: ```shell # In arduino-led-blinker +cd LedBlinker fprime-util new --deployment ``` @@ -412,24 +413,25 @@ fprime-util new --deployment This will ask for some input, respond with the following answers: ```shell [INFO] Cookiecutter source: https://github.com/fprime-community/fprime-arduino-deployment-cookiecutter.git - [1/4] Deployment name (fprime_arduino_deployment): LedBlinker - [2/4] Select communication driver type + [1/5] Deployment name (fprime_arduino_deployment): LedBlinkerDeployment + [2/5] Deployment namespace (LedBlinker): LedBlinker + [3/5] Select communication driver type 1 - UART 2 - TcpServer 3 - TcpClient Choose from [1/2/3] (1): 1 - [3/4] Select file system type + [4/5] Select file system type 1 - None 2 - SD_Card 3 - MicroFS Choose from [1/2/3] (1): 1 - [4/4] Select framing protocol + [5/5] Select framing protocol 1 - CCSDS 2 - Fprime Choose from [1/2] (1): 2 -[INFO] Found CMake file at 'arduino-led-blinker/project.cmake' -Add LedBlinker to arduino-led-blinker/project.cmake at end of file? (yes/no) [yes]: yes -[INFO] New deployment successfully created: /home/ethan/fprime-projects/arduino-led-blinker/LedBlinker +[INFO] Found CMake file at 'arduino-led-blinker/LedBlinker/CMakeLists.txt' +Add LedBlinkerDeployment to arduino-led-blinker/LedBlinker/CMakeLists.txt at end of file? (yes/no) [yes]: yes +[INFO] New deployment successfully created: /home/ethan/fprime-projects/arduino-led-blinker/LedBlinker/LedBlinkerDeployment ``` > [!NOTE] > Use the default response for any other questions asked. @@ -437,8 +439,8 @@ Add LedBlinker to arduino-led-blinker/project.cmake at end of file? (yes/no) [ye In order to check that the deployment was created successfully, the user can build the deployment. This will build the code for the current host system, not the remote embedded hardware allowing local testing during development. ```shell -# In arduino-led-blinker -cd LedBlinker +# In arduino-led-blinker/LedBlinker +cd LedBlinkerDeployment fprime-util build ``` @@ -449,10 +451,10 @@ fprime-util build The component can now be added to the deployment's topology effectively adding this component to the running system. This is done by modifying `instances.fpp` and `topology.fpp` in the `Top` directory. -Add the following to `arduino-led-blinker/LedBlinker/Top/instances.fpp`. Typically, this is added to the "Active component instances" section of that document. +Add the following to `arduino-led-blinker/LedBlinker/LedBlinkerDeployment/Top/instances.fpp`. Typically, this is added to the "Active component instances" section of that document. ``` - instance led: Components.Led base id 0x0E00 \ + instance led: LedBlinker.Led base id 0x0E00 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 95 @@ -460,7 +462,7 @@ Add the following to `arduino-led-blinker/LedBlinker/Top/instances.fpp`. Typica This defines an instance of the `Led` component called `led`. Since the component is active it needs a queue size, stack size, and priority for the thread of the component and the queue that thread serves. We have chosen the topology specified defaults and a priority of 95. -Next, the topology needs to use the above definition. This is done by adding the `led` instance to the list of instances defined in `arduino-led-blinker/LedBlinker/Top/topology.fpp`: +Next, the topology needs to use the above definition. This is done by adding the `led` instance to the list of instances defined in `arduino-led-blinker/LedBlinker/LedBlinkerDeployment/Top/topology.fpp`: ``` # ---------------------------------------------------------------------- @@ -477,7 +479,7 @@ Build your deployment ```shell # In arduino-led-blinker -cd LedBlinker +cd LedBlinker/LedBlinkerDeployment fprime-util build ``` @@ -494,12 +496,12 @@ fprime-util build > > For Windows WSL1 users, it should be along the lines of `/dev/ttyS1`, where `S1` indicates `COM1`. Determine the COM port of your board by running `usbipd` on PowerShell or looking it up in Windows Device Manager. -First, you must upload the binary into your board. The binary is located in the `arduino-led-blinker/build-artifacts//LedBlinker/bin/`. Refer to the upload guides in the [`board list`](https://github.com/fprime-community/fprime-arduino/blob/upgrade-to-fprime-4/docs/board-list.md) to upload the correct binary to your board of choice. +First, you must upload the binary into your board. The binary is located in the `arduino-led-blinker/build-artifacts//LedBlinker_LedBlinkerDeployment/bin/`. Refer to the upload guides in the [`board list`](https://github.com/fprime-community/fprime-arduino/blob/upgrade-to-fprime-4/docs/board-list.md) to upload the correct binary to your board of choice. Open the `fprime-gds` by running the following command: ```sh -fprime-gds -n --dictionary ../build-artifacts/teensy41/LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 +fprime-gds -n --dictionary ../../build-artifacts/teensy41/LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 ``` This will likely open up your browser and show the running flight software. If it does not open a browser, navigate to `http://localhost:5000`. @@ -519,12 +521,12 @@ Test the component integration with the following steps: Congratulations! You have now integrated your component and tested that integration. -Return to the `arduino-led-blinker/LedBlinker` and run the following commands to test whenever you desire. +Return to the `arduino-led-blinker/LedBlinker/LedBlinkerDeployment` and run the following commands to test whenever you desire. ```sh -# In arduino-led-blinker/LedBlinker +# In arduino-led-blinker/LedBlinker/LedBlinkerDeployment fprime-util build -fprime-gds -n --dictionary ../build-artifacts/teensy41/LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 +fprime-gds -n --dictionary ../../build-artifacts/teensy41/LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 # CTRL-C to exit ``` @@ -544,7 +546,7 @@ In this section, we will complete the component design and implementation by add Telemetry channels represent the state of the system. Typically, telemetry channels are defined for any states that give crucial insight into the component's behavior. -Inside your `arduino-led-blinker/Components/Led` directory, open the `Led.fpp` file. After the events you added in the previous section, add a telemetry channel of type `Fw.On` to report the blinking state. +Inside your `arduino-led-blinker/LedBlinker/Components/Led` directory, open the `Led.fpp` file. After the events you added in the previous section, add a telemetry channel of type `Fw.On` to report the blinking state. ``` @ Telemetry channel to report blinking state. @@ -565,7 +567,7 @@ Parameters are ground-controllable settings for the system. Parameters are used For each parameter you define in your fpp, the F´ autocoder will autogenerate a SET and SAVE command. The SET command allows ground to update the parameter. The SAVE command tells your parameter database to stage this new parameter value for saving. To save the parameter for use on a FSW reboot, ground will need to send the `PRM_SAVE_FILE` command. -In your `arduino-led-blinker/Components/Led` directory, open the `Led.fpp` file. After the telemetry channels you added previously, add a parameter for the blinking interval. Give the parameter the name `BLINK_INTERVAL`, type `U32`, and a default value. It is good practice to assign parameters a valid default value. +In your `arduino-led-blinker/LedBlinker/Components/Led` directory, open the `Led.fpp` file. After the telemetry channels you added previously, add a parameter for the blinking interval. Give the parameter the name `BLINK_INTERVAL`, type `U32`, and a default value. It is good practice to assign parameters a valid default value. ``` @ Blinking interval in rate group ticks @@ -576,7 +578,7 @@ In your `arduino-led-blinker/Components/Led` directory, open the `Led.fpp` file. Any communication between components should be accomplished through F´ ports. Thus far we have been using a set of standard ports for handling Commands, Telemetry, Events, and Parameters. This section will add two specific ports to our component: input `run` to be called from the rate group, and output `gpioSet` to drive the GPIO driver. -In your `arduino-led-blinker/Components/Led` directory, open the `Led.fpp` file. After the parameters you added previously, add the following two ports: +In your `arduino-led-blinker/LedBlinker/Components/Led` directory, open the `Led.fpp` file. After the parameters you added previously, add the following two ports: ``` @ Port receiving calls from the rate group @@ -593,14 +595,14 @@ In your `arduino-led-blinker/Components/Led` directory, open the `Led.fpp` file. #### Input Port Implementation -In your `arduino-led-blinker/Components/Led` directory, run the following to autogenerate stub functions for the `run` input port we just added. +In your `arduino-led-blinker/LedBlinker/Components/Led` directory, run the following to autogenerate stub functions for the `run` input port we just added. ```bash -# In arduino-led-blinker/Components/Led +# In arduino-led-blinker/LedBlinker/Components/Led fprime-util impl ``` -In your `arduino-led-blinker/Components/Led` directory, open `Led.template.hpp` file and copy this block over to `Led.hpp`. +In your `arduino-led-blinker/LedBlinker/Components/Led` directory, open `Led.template.hpp` file and copy this block over to `Led.hpp`. ```cpp PRIVATE: @@ -616,7 +618,7 @@ In your `arduino-led-blinker/Components/Led` directory, open `Led.template.hpp` ) override; ``` -In your `arduino-led-blinker/Components/Led` directory, open `Led.template.cpp` file and copy this block over to `Led.cpp`. +In your `arduino-led-blinker/LedBlinker/Components/Led` directory, open `Led.template.cpp` file and copy this block over to `Led.cpp`. ```cpp // ---------------------------------------------------------------------- // Handler implementations for user-defined typed input ports @@ -684,7 +686,7 @@ void Led ::run_handler(FwIndexType portNum, U32 context) { In the terminal, run the following to verify your component is building correctly. ```bash -# In arduino-led-blinker/Components/Led +# In arduino-led-blinker/LedBlinker/Components/Led fprime-util build ``` @@ -693,7 +695,7 @@ fprime-util build #### Command Implementation Continued -Inside your `arduino-led-blinker/Components/Led` directory, open `Led.cpp`, and navigate to the `BLINKING_ON_OFF` command. Report the blinking state via the telemetry channel we just added. To do so, replace the following: +Inside your `arduino-led-blinker/LedBlinker/Components/Led` directory, open `Led.cpp`, and navigate to the `BLINKING_ON_OFF` command. Report the blinking state via the telemetry channel we just added. To do so, replace the following: ```cpp // TODO: Report the blinking state (onOff) on channel BlinkingState. @@ -709,7 +711,7 @@ with the function to send the telemetry channel: In the terminal, run the following to verify your component is building correctly. ```bash -# In arduino-led-blinker/Components/Led +# In arduino-led-blinker/LedBlinker/Components/Led fprime-util build ``` @@ -720,7 +722,7 @@ fprime-util build When ground updates a component's parameter, the user may want the component to react to the parameter update. F Prime provides a function called `parameterUpdated` where your component can react to each parameter update. Implementing `parameterUpdated` for a component is optional but we'll implement it for this tutorial. -In your `arduino-led-blinker/Components/Led` directory, open the file `Led.hpp` and add the following function signature in the `PRIVATE:` scope: +In your `arduino-led-blinker/LedBlinker/Components/Led` directory, open the file `Led.hpp` and add the following function signature in the `PRIVATE:` scope: ```cpp //! Emit parameter updated EVR @@ -731,7 +733,7 @@ In your `arduino-led-blinker/Components/Led` directory, open the file `Led.hpp` > This function is called when a parameter is updated via the auto generated SET command. Although the value is updated automatically, this function gives developers a chance to respond to changing parameters. This tutorial uses it to emit an event. -Save file and in your `arduino-led-blinker/Components/Led` directory, open `Led.cpp` and add the implementation for `parameterUpdated`: +Save file and in your `arduino-led-blinker/LedBlinker/Components/Led` directory, open `Led.cpp` and add the implementation for `parameterUpdated`: ```cpp void Led ::parameterUpdated(FwPrmIdType id) { @@ -758,7 +760,7 @@ void Led ::parameterUpdated(FwPrmIdType id) { In the terminal, run the following to verify your component is building correctly. ```bash -# In arduino-led-blinker/Components/Led +# In arduino-led-blinker/LedBlinker/Components/Led fprime-util build ``` > [!NOTE] @@ -796,28 +798,28 @@ Now it is time to add a GPIO driver to our system and attach it to the `led` com `fprime-arduino` provides a GPIO driver for Arduino microcontrollers called `Arduino.GpioDriver`. This should be added to both the instance definition list and the topology instance list just like we did for the `led` component. Since the GPIO driver is a passive component, its definition is a bit more simple. -Add to "Passive Component" section of `arduino-led-blinker/LedBlinker/Top/instances.fpp`: +Add to "Passive Component" section of `arduino-led-blinker/LedBlinker/LedBlinkerDeployment/Top/instances.fpp`: ``` instance gpioDriver: Arduino.GpioDriver base id 0x5000 ``` -Add to the instance list of `arduino-led-blinker/LedBlinker/Top/topology.fpp`: +Add to the instance list of `arduino-led-blinker/LedBlinker/LedBlinkerDeployment/Top/topology.fpp`: ``` instance gpioDriver ``` > [!NOTE] -> In `arduino-led-blinker/LedBlinker` build the deployment and resolve any errors before continuing. +> In `arduino-led-blinker/LedBlinker/LedBlinkerDeployment` build the deployment and resolve any errors before continuing. ### Wiring The `led` Component Instance to the `gpioComponent` Component Instance and Rate Group The `Led` component defines the `gpioSet` output port and the `Arduino.GpioDriver` defines the `gpioWrite` input port. These two ports need to be connected from output to input. The `ActiveRateGroup` component defines an array of ports called `RateGroupMemberOut` and one of these needs to be connected to `run` port defined on the `Led` component. -We can connect the two port pairs in the topology's existing `LedBlinker` connections block. Remember to use the component instances and not the component definitions for each connection. +We can connect the two port pairs in the topology's existing `LedBlinkerDeployment` connections block. Remember to use the component instances and not the component definitions for each connection. -To do this, add the following lines to the `connections LedBlinker` block in `arduino-led-blinker/LedBlinker/Top/topology.fpp`: +To do this, add the following lines to the `connections LedBlinkerDeployment` block in `arduino-led-blinker/LedBlinker/LedBlinkerDeployment/Top/topology.fpp`: ``` - connections LedBlinker { + connections LedBlinkerDeployment { # Add here connections to user-defined components # Rate Group 1 (1Hz cycle) output is connected to led's run input rateGroup1.RateGroupMemberOut[4] -> led.run @@ -833,7 +835,7 @@ To do this, add the following lines to the `connections LedBlinker` block in `ar So far the GPIO driver has been instantiated and wired, but has not been told what GPIO pin to control. For this tutorial, the built-in LED will be used. To configure this, the `open` function needs to be called in the topology's C++ implementation and passed the pin's number and direction. -This is done by adding the following line to the end of the `configureTopology` function defined in `arduino-led-blinker/LedBlinker/Top/LedBlinkerTopology.cpp`. +This is done by adding the following line to the end of the `configureTopology` function defined in `arduino-led-blinker/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.cpp`. ``` void configureTopology() { @@ -844,7 +846,7 @@ void configureTopology() { This code tells the GPIO driver to open pin `LED_BUILTIN` (usually pin 13) as an output pin. If your device does not have a built in LED, select a GPIO pin of your choice. > [!NOTE] -> In `arduino-led-blinker/LedBlinker` build the deployment and resolve any errors before continuing. +> In `arduino-led-blinker/LedBlinker/LedBlinkerDeployment` build the deployment and resolve any errors before continuing. ### LED Blinker Step 6 Conclusion @@ -858,11 +860,11 @@ Now it is time to run on hardware. Ensure the microcontroller is connected to th First, upload the binary file to the board after building. Reference the [board list](https://github.com/fprime-community/fprime-arduino/blob/main/docs/board-list.md) for guidance on uploading the binaries for your board. -Next run the F´ GDS without launching the native compilation (`-n`) and with the dictionary from the build above (`--dictionary ./build-artifacts/teensy41/LedBlinker/dict/LedBlinkerTopologyDictionary.json`). Connect it to the USB device by adding the `--communication-selection`, `--uart-device`, and `--uart-baud` flags +Next run the F´ GDS without launching the native compilation (`-n`) and with the dictionary from the build above (`--dictionary ./build-artifacts/teensy41/LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json`). Connect it to the USB device by adding the `--communication-selection`, `--uart-device`, and `--uart-baud` flags ```sh # In the project root -fprime-gds -n --dictionary ./build-artifacts/teensy41/LedBlinker/dict/LedBlinkerTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 +fprime-gds -n --dictionary ./build-artifacts/teensy41/LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 ``` > [!Note] diff --git a/project.cmake b/project.cmake deleted file mode 100644 index 67c0d45..0000000 --- a/project.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# This CMake file is intended to register project-wide objects so they can be -# reused easily between deployments, but also by other projects. - -# Components -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Components/") - -# Deployments -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LedBlinker/") From 7fc0de3ebde231ff120aec5146843c8e72df2c31 Mon Sep 17 00:00:00 2001 From: Nathan Cheek Date: Fri, 2 Oct 2026 23:56:06 -0700 Subject: [PATCH 4/5] Upgrade to fprime 4.4.0 * Update fprime-arduino and fprime-baremetal * Rebase config overrides onto the v4.4.0 defaults * Raise command limits to support new ComQueue and rate group commands * Raise telemetry limits to support per-port rate group cycle times * Update the topology, Led component and tutorial for v4.4 API changes * Include in TopologyDefs.hpp for the subtopologies' memset * Switch to CCSDS framing --- LedBlinker/Components/Led/Led.cpp | 2 +- LedBlinker/Components/Led/Led.hpp | 2 +- LedBlinker/LedBlinkerDeployment/README.md | 6 +- .../Top/LedBlinkerDeploymentTopology.cpp | 4 +- .../Top/LedBlinkerDeploymentTopologyDefs.hpp | 9 +- .../LedBlinkerDeployment/Top/topology.fpp | 28 +++--- .../config/AcConstants.fpp | 27 ++++-- .../config/ComCcsdsConfig/ComCcsdsConfig.fpp | 11 +++ .../ComFprimeConfig/ComFprimeConfig.fpp | 4 + .../config/CommandDispatcherImplCfg.hpp | 22 ++++- .../LedBlinkerDeployment/config/FpConfig.h | 95 ++++++++++--------- .../config/FpConstants.fpp | 14 ++- .../config/PlatformCfg.fpp | 3 + .../config/TlmChanImplCfg.hpp | 26 +++-- docs/arduino-led-blinker.md | 16 ++-- lib/fprime | 2 +- lib/fprime-arduino | 2 +- lib/fprime-baremetal | 2 +- 18 files changed, 176 insertions(+), 99 deletions(-) diff --git a/LedBlinker/Components/Led/Led.cpp b/LedBlinker/Components/Led/Led.cpp index 860a1a0..31f0e0f 100644 --- a/LedBlinker/Components/Led/Led.cpp +++ b/LedBlinker/Components/Led/Led.cpp @@ -84,7 +84,7 @@ void Led ::run_handler(FwIndexType portNum, U32 context) { // Handler implementations for commands // ---------------------------------------------------------------------- -void Led ::BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::On onOff) { +void Led ::BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::On& onOff) { this->m_toggleCounter = 0; // Reset count on any successful command this->m_blinking = Fw::On::ON == onOff; // Update blinking state diff --git a/LedBlinker/Components/Led/Led.hpp b/LedBlinker/Components/Led/Led.hpp index 743d256..89610e7 100644 --- a/LedBlinker/Components/Led/Led.hpp +++ b/LedBlinker/Components/Led/Led.hpp @@ -51,7 +51,7 @@ class Led final : public LedComponentBase { //! 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 + const Fw::On& onOff //!< Indicates whether the blinking should be on or off ) override; Fw::On m_state = Fw::On::OFF; //! Keeps track if LED is on or off diff --git a/LedBlinker/LedBlinkerDeployment/README.md b/LedBlinker/LedBlinkerDeployment/README.md index d44195a..ce384e7 100644 --- a/LedBlinker/LedBlinkerDeployment/README.md +++ b/LedBlinker/LedBlinkerDeployment/README.md @@ -23,7 +23,7 @@ The following command will spin up the F' GDS. Examples are available for UART, ### UART ```sh -fprime-gds -n --dictionary ./build-artifacts//LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 +fprime-gds -n --dictionary ./build-artifacts//LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 ``` > [!NOTE] @@ -36,7 +36,7 @@ fprime-gds -n --dictionary ./build-artifacts//LedBlinker_LedBlinkerD ### TcpServer ```sh -fprime-gds -n --dictionary ./build-artifacts//LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime --ip-client --ip-address +fprime-gds -n --dictionary ./build-artifacts//LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --ip-client --ip-address ``` > [!NOTE] @@ -47,7 +47,7 @@ fprime-gds -n --dictionary ./build-artifacts//LedBlinker_LedBlinkerD ### TcpClient ```sh -fprime-gds -n --dictionary ./build-artifacts//LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime +fprime-gds -n --dictionary ./build-artifacts//LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json ``` > [!NOTE] diff --git a/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.cpp b/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.cpp index c0705c6..5b842e8 100644 --- a/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.cpp +++ b/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopology.cpp @@ -19,7 +19,7 @@ Svc::RateGroupDriver::DividerSet rateGroupDivisors{{{100, 0}, {200, 0}, {1000, 0 // 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. -U32 rateGroup1Context[FppConstant_PassiveRateGroupOutputPorts::PassiveRateGroupOutputPorts] = {}; +Svc::PassiveRateGroup::ContextArray rateGroup1Context(0); /** * \brief configure/setup components in project-specific way @@ -33,7 +33,7 @@ void configureTopology() { rateGroupDriver.configure(rateGroupDivisors); // Rate groups require context arrays. - rateGroup1.configure(rateGroup1Context, FW_NUM_ARRAY_ELEMENTS(rateGroup1Context)); + rateGroup1.configure(rateGroup1Context); gpioDriver.open(Arduino::DEF_LED_BUILTIN, Arduino::GpioDriver::GpioDirection::OUT); } diff --git a/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopologyDefs.hpp b/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopologyDefs.hpp index dfb260c..992dca8 100644 --- a/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopologyDefs.hpp +++ b/LedBlinker/LedBlinkerDeployment/Top/LedBlinkerDeploymentTopologyDefs.hpp @@ -7,13 +7,14 @@ #define LEDBLINKERDEPLOYMENT_LEDBLINKERDEPLOYMENTTOPOLOGYDEFS_HPP #include "Fw/Types/MallocAllocator.hpp" +#include #include "LedBlinker/LedBlinkerDeployment/Top/FppConstantsAc.hpp" // SubtopologyTopologyDefs includes -#include "Svc/Subtopologies/ComFprime/SubtopologyTopologyDefs.hpp" -// ComFprime Enum Includes -#include "Svc/Subtopologies/ComFprime/Ports_ComPacketQueueEnumAc.hpp" -#include "Svc/Subtopologies/ComFprime/Ports_ComBufferQueueEnumAc.hpp" +#include "Svc/Subtopologies/ComCcsds/SubtopologyTopologyDefs.hpp" +// ComCcsds Enum Includes +#include "Svc/Subtopologies/ComCcsds/Ports_ComPacketQueueEnumAc.hpp" +#include "Svc/Subtopologies/ComCcsds/Ports_ComBufferQueueEnumAc.hpp" /** * \brief required ping constants diff --git a/LedBlinker/LedBlinkerDeployment/Top/topology.fpp b/LedBlinker/LedBlinkerDeployment/Top/topology.fpp index 792d05a..5bb3532 100644 --- a/LedBlinker/LedBlinkerDeployment/Top/topology.fpp +++ b/LedBlinker/LedBlinkerDeployment/Top/topology.fpp @@ -8,14 +8,14 @@ module LedBlinker { rateGroup1 } - topology LedBlinkerDeployment { + deployment topology LedBlinkerDeployment { # ---------------------------------------------------------------------- # Subtopology imports # ---------------------------------------------------------------------- - import ComFprime.Subtopology + import ComCcsds.Subtopology # ---------------------------------------------------------------------- # Instances used in the topology @@ -63,6 +63,8 @@ module LedBlinker { rateGroup1.RateGroupMemberOut[1] -> systemResources.run rateGroup1.RateGroupMemberOut[2] -> comDriver.schedIn rateGroup1.RateGroupMemberOut[3] -> cmdDisp.run + # Send partly filled TM frames instead of waiting for them to fill + rateGroup1.RateGroupMemberOut[4] -> ComCcsds.aggregator.timeout } connections FaultProtection { @@ -72,30 +74,30 @@ module LedBlinker { connections Communications { # Inputs to ComQueue (events, telemetry, file) - eventLogger.PktSend -> ComFprime.comQueue.comPacketQueueIn[ComFprime.Ports_ComPacketQueue.EVENTS] - tlmSend.PktSend -> ComFprime.comQueue.comPacketQueueIn[ComFprime.Ports_ComPacketQueue.TELEMETRY] + eventLogger.PktSend -> ComCcsds.comQueue.comPacketQueueIn[ComCcsds.Ports_ComPacketQueue.EVENTS] + tlmSend.PktSend -> ComCcsds.comQueue.comPacketQueueIn[ComCcsds.Ports_ComPacketQueue.TELEMETRY] # ComDriver buffer allocations - comDriver.allocate -> ComFprime.commsBufferManager.bufferGetCallee - comDriver.deallocate -> ComFprime.commsBufferManager.bufferSendIn + comDriver.allocate -> ComCcsds.commsBufferManager.bufferGetCallee + comDriver.deallocate -> ComCcsds.commsBufferManager.bufferSendIn # ComDriver <-> ComStub (Uplink) - comDriver.$recv -> ComFprime.comStub.drvReceiveIn - ComFprime.comStub.drvReceiveReturnOut -> comDriver.recvReturnIn + comDriver.$recv -> ComCcsds.comStub.drvReceiveIn + ComCcsds.comStub.drvReceiveReturnOut -> comDriver.recvReturnIn # ComStub <-> ComDriver (Downlink) - ComFprime.comStub.drvSendOut -> comDriver.$send - comDriver.ready -> ComFprime.comStub.drvConnected + ComCcsds.comStub.drvSendOut -> comDriver.$send + comDriver.ready -> ComCcsds.comStub.drvConnected # Router <-> CmdDispatcher - ComFprime.fprimeRouter.commandOut -> cmdDisp.seqCmdBuff - cmdDisp.seqCmdStatus -> ComFprime.fprimeRouter.cmdResponseIn + ComCcsds.fprimeRouter.commandOut -> cmdDisp.seqCmdBuff + cmdDisp.seqCmdStatus -> ComCcsds.fprimeRouter.cmdResponseIn } connections LedBlinkerDeployment { # Add here connections to user-defined components # Rate Group 1 (1Hz cycle) output is connected to led's run input - rateGroup1.RateGroupMemberOut[4] -> led.run + rateGroup1.RateGroupMemberOut[5] -> led.run # led's gpioSet output is connected to gpioDriver's gpioWrite input led.gpioSet -> gpioDriver.gpioWrite } diff --git a/LedBlinker/LedBlinkerDeployment/config/AcConstants.fpp b/LedBlinker/LedBlinkerDeployment/config/AcConstants.fpp index ea186d3..6968a74 100644 --- a/LedBlinker/LedBlinkerDeployment/config/AcConstants.fpp +++ b/LedBlinker/LedBlinkerDeployment/config/AcConstants.fpp @@ -13,7 +13,7 @@ constant PassiveRateGroupOutputPorts = 10 constant RateGroupDriverRateGroupPorts = 3 @ Used for command and registration ports -constant CmdDispatcherComponentCommandPorts = 5 +constant CmdDispatcherComponentCommandPorts = 7 @ Used for uplink/sequencer buffer/response ports constant CmdDispatcherSequencePorts = 1 @@ -45,17 +45,32 @@ constant BufferRepeaterOutputPorts = 10 @ Size of port array for DpManager constant DpManagerNumPorts = 5 +@ Size of data product routing port arrays for DpWriter +constant DpWriterNumPorts = 5 + @ Size of processing port array for DpWriter constant DpWriterNumProcPorts = 5 @ The size of a file name string -constant FileNameStringSize = 200 +constant FileNameStringSize = 240 @ The size of an assert text string constant FwAssertTextSize = 256 -@ The size of a file name in an AssertFatalAdapter event -@ Note: File names in assertion failures are also truncated by -@ the constants FW_ASSERT_TEXT_SIZE and FW_LOG_STRING_MAX_SIZE, set -@ in FpConfig.h. +@ The size of a file name in an AssertFatalAdapter event (leading-truncation: +@ the tail of the path is kept) +@ Note: Svc::AssertFatalAdapter truncates to the smaller of this constant and +@ FW_LOG_STRING_MAX_SIZE (set in FpConstants.fpp), so raising this alone has no +@ effect once it exceeds that bound. With the defaults (240 here, 200 there) +@ FW_LOG_STRING_MAX_SIZE is what governs. +@ FwAssertTextSize (in this file) is a separate bound on the console assert +@ text, which also carries the timestamp and assert arguments. constant AssertFatalAdapterEventFileSize = FileNameStringSize + +@ The maximum size in bytes of the argument blob carried in a Svc::SeqArgs buffer +@ (CmdSeqIn / RUN / INVOKE). +@ Deliberately kept small (rather than derived from FW_CMD_ARG_BUFFER_MAX_SIZE) to +@ keep SeqArgs easy to populate from fprime-gds. It must still fit within +@ FW_CMD_ARG_BUFFER_MAX_SIZE alongside the other command arguments it travels with +@ (filename length prefix + fileName + BlockState + the SeqArgs size field). +constant SequenceArgumentsMaxSize = 12 diff --git a/LedBlinker/LedBlinkerDeployment/config/ComCcsdsConfig/ComCcsdsConfig.fpp b/LedBlinker/LedBlinkerDeployment/config/ComCcsdsConfig/ComCcsdsConfig.fpp index 66a2d59..a9c57c1 100644 --- a/LedBlinker/LedBlinkerDeployment/config/ComCcsdsConfig/ComCcsdsConfig.fpp +++ b/LedBlinker/LedBlinkerDeployment/config/ComCcsdsConfig/ComCcsdsConfig.fpp @@ -17,6 +17,11 @@ module ComCcsdsConfig { constant comQueue = 101 } + module CpuAffinities { + constant aggregator = Os.TASK_DEFAULT + constant comQueue = Os.TASK_DEFAULT + } + # Queue configuration constants module QueueDepths { constant events = 10 @@ -30,6 +35,12 @@ module ComCcsdsConfig { constant file = 1 } + # Aggregator configuration constants + module Aggregator { + constant aggregationSize = Svc.Ccsds.TmDataFieldSize + constant enablePacketSpanning = false + } + # Buffer management constants module BuffMgr { constant frameAccumulatorSize = 2048 diff --git a/LedBlinker/LedBlinkerDeployment/config/ComFprimeConfig/ComFprimeConfig.fpp b/LedBlinker/LedBlinkerDeployment/config/ComFprimeConfig/ComFprimeConfig.fpp index ce4df6c..f27e878 100644 --- a/LedBlinker/LedBlinkerDeployment/config/ComFprimeConfig/ComFprimeConfig.fpp +++ b/LedBlinker/LedBlinkerDeployment/config/ComFprimeConfig/ComFprimeConfig.fpp @@ -14,6 +14,10 @@ module ComFprimeConfig { constant comQueue = 101 } + module CpuAffinities { + constant comQueue = Os.TASK_DEFAULT + } + # Queue configuration constants module QueueDepths { constant events = 10 diff --git a/LedBlinker/LedBlinkerDeployment/config/CommandDispatcherImplCfg.hpp b/LedBlinker/LedBlinkerDeployment/config/CommandDispatcherImplCfg.hpp index a665821..f03d4c8 100644 --- a/LedBlinker/LedBlinkerDeployment/config/CommandDispatcherImplCfg.hpp +++ b/LedBlinker/LedBlinkerDeployment/config/CommandDispatcherImplCfg.hpp @@ -8,11 +8,31 @@ #ifndef CMDDISPATCHER_COMMANDDISPATCHERIMPLCFG_HPP_ #define CMDDISPATCHER_COMMANDDISPATCHERIMPLCFG_HPP_ +#include + // Define configuration values for dispatcher enum { - CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 12, // !< The size of the table holding opcodes to dispatch + CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 16, // !< The size of the table holding opcodes to dispatch CMD_DISPATCHER_SEQUENCER_TABLE_SIZE = 4, // !< The size of the table holding commands in progress }; +namespace Svc { +namespace CmdDispatcherCfg { + +//! Include command opcodes in events when true. +//! When false, opcode fields are set to the maximum FwOpcodeType value. +constexpr bool IncludeCommandOpcodesInEvents = true; + +constexpr FwOpcodeType getEventOpcode(const FwOpcodeType opcode) { + return IncludeCommandOpcodesInEvents ? opcode : std::numeric_limits::max(); +} + +//! Default for whether a sequence command is dispatched when the sequence tracker table is full. +//! Per-instance override: CommandDispatcherImpl::configure(bool). +constexpr bool EXECUTE_WHEN_SEQUENCE_TABLE_FULL_DEFAULT = false; + +} // namespace CmdDispatcherCfg +} // namespace Svc + #endif /* CMDDISPATCHER_COMMANDDISPATCHERIMPLCFG_HPP_ */ diff --git a/LedBlinker/LedBlinkerDeployment/config/FpConfig.h b/LedBlinker/LedBlinkerDeployment/config/FpConfig.h index 3b685f5..472ea83 100644 --- a/LedBlinker/LedBlinkerDeployment/config/FpConfig.h +++ b/LedBlinker/LedBlinkerDeployment/config/FpConfig.h @@ -21,18 +21,32 @@ extern "C" { // Configuration switches // ---------------------------------------------------------------------- +// Enable strict assertions +#ifndef FW_STRICT_ASSERTIONS +#define FW_STRICT_ASSERTIONS (1) //!< Indicates whether strict assertions are used (more checking, more instructions) +#endif + +// Enable direct port calls +#ifndef FW_DIRECT_PORT_CALLS +#ifdef BUILD_UT +#define FW_DIRECT_PORT_CALLS (0) //!< Indirect port calls are required for unit tests +#else +#define FW_DIRECT_PORT_CALLS (1) //!< Indicates whether direct port calls are used (saves space and time) +#endif +#endif + // Allow objects to have names. Allocates storage for each instance #ifndef FW_OBJECT_NAMES #define FW_OBJECT_NAMES \ - 1 //!< Indicates whether or not object names are stored (more memory, can be used for tracking objects) + (1) //!< Indicates whether or not object names are stored (more memory, can be used for tracking objects) #endif // To reduce binary size, FW_OPTIONAL_NAME() can be used to substitute strings with an empty string // when running with FW_OBJECT_NAMES disabled #if FW_OBJECT_NAMES == 1 -#define FW_OPTIONAL_NAME(name) name +#define FW_OPTIONAL_NAME(name) name // NO_CODESONAR LANG.PREPROC.MACROSTART/END #else -#define FW_OPTIONAL_NAME(name) "" +#define FW_OPTIONAL_NAME(name) "" // NO_CODESONAR LANG.PREPROC.MACROSTART/END #endif // Add methods to query an object about its name. Can be overridden by derived classes @@ -40,66 +54,39 @@ extern "C" { #if FW_OBJECT_NAMES == 1 #ifndef FW_OBJECT_TO_STRING #define FW_OBJECT_TO_STRING \ - 1 //!< Indicates whether or not generated objects have toString() methods to dump internals (more code) + (1) //!< Indicates whether or not generated objects have toString() methods to dump internals (more code) #endif #else -#define FW_OBJECT_TO_STRING 0 +#define FW_OBJECT_TO_STRING (0) #endif // Adds the ability for all component related objects to register // centrally. #ifndef FW_OBJECT_REGISTRATION #define FW_OBJECT_REGISTRATION \ - 1 //!< Indicates whether or not objects can register themselves (more code, more object tracking) + (1) //!< Indicates whether or not objects can register themselves (more code, more object tracking) #endif #ifndef FW_QUEUE_REGISTRATION -#define FW_QUEUE_REGISTRATION 1 //!< Indicates whether or not queue registration is used -#endif - -// On some systems, use of *printf family functions (snprintf, printf, etc) require a prohibitive amount of program -// space. Setting this to `0` indicates that the Fw/String methods should stop using these functions to conserve -// program size. However, this comes at the expense of discarding format parameters. i.e. the format string is returned -// unchanged. -#ifndef FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING -#define FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING 1 +#define FW_QUEUE_REGISTRATION (1) //!< Indicates whether or not queue registration is used #endif // Port Facilities // This allows tracing calls through ports for debugging #ifndef FW_PORT_TRACING -#define FW_PORT_TRACING 1 //!< Indicates whether port calls are traced (more code, more visibility into execution) +#define FW_PORT_TRACING (1) //!< Indicates whether port calls are traced (more code, more visibility into execution) #endif // This generates code to connect to serialized ports #ifndef FW_PORT_SERIALIZATION #define FW_PORT_SERIALIZATION \ - 1 //!< Indicates whether there is code in ports to serialize the call (more code, but ability to serialize - //!< calls for multi-note systems) + (1) //!< Indicates whether there is code in ports to serialize the call (more code, but ability to serialize + //!< calls for multi-note systems) #endif // Component Facilities -// Serialization - -// Add a type id when serialization is done. More storage, -// but better detection of errors -// TODO: Not working yet - -#ifndef FW_SERIALIZATION_TYPE_ID -#define FW_SERIALIZATION_TYPE_ID \ - 0 //!< Indicates if type id is stored when type is serialized. (More storage, but more type safety) -#endif - -// Number of bytes to use for serialization IDs. More -// bytes is more storage, but greater number of IDs -#if FW_SERIALIZATION_TYPE_ID -#ifndef FW_SERIALIZATION_TYPE_ID_BYTES -#define FW_SERIALIZATION_TYPE_ID_BYTES 4 //!< Number of bytes used to represent type id - more bytes, more ids -#endif -#endif - // Set assertion form. Options: // 1. FW_NO_ASSERT: assertions are compiled out, side effects are kept // 2. FW_FILEID_ASSERT: asserts report a file CRC and line number @@ -108,7 +95,15 @@ extern "C" { // // Note: users who want alternate asserts should set assert level to FW_NO_ASSERT and define FW_ASSERT in this header #ifndef FW_ASSERT_LEVEL -#define FW_ASSERT_LEVEL FW_RELATIVE_PATH_ASSERT //!< Defines the type of assert used +#define FW_ASSERT_LEVEL (FW_RELATIVE_PATH_ASSERT) //!< Defines the type of assert used +#endif + +// Decide whether the framework should force assertions to always abort. +// If enabled, allows additional compiler optimizations and prevents code from running after an assertion trips. +// If disabled (default), allows the FATAL event handler to decide whether code should continue running after an +// assertion trips. +#ifndef FW_ASSERTIONS_ALWAYS_ABORT +#define FW_ASSERTIONS_ALWAYS_ABORT 0 #endif // Adjust various configuration parameters in the architecture. Some of the above enables may disable some of the values @@ -117,7 +112,7 @@ extern "C" { #if FW_OBJECT_NAMES #ifndef FW_OBJ_NAME_BUFFER_SIZE #define FW_OBJ_NAME_BUFFER_SIZE \ - 80 //!< Size of object name (if object names enabled). AC Limits to 80, truncation occurs above 80. + (80) //!< Size of object name (if object names enabled). AC Limits to 80, truncation occurs above 80. #endif #endif @@ -128,31 +123,41 @@ extern "C" { // Setting the below to zero will disable the check at the cost of not detecting commands that // are too large. #ifndef FW_CMD_CHECK_RESIDUAL -#define FW_CMD_CHECK_RESIDUAL 0 //!< Check for leftover command bytes +#define FW_CMD_CHECK_RESIDUAL (0) //!< Check for leftover command bytes #endif // Enables text logging of events as well as data logging. Adds a second logging port for text output. // In order to set this to 0, FPRIME_ENABLE_TEXT_LOGGERS must be set to OFF. #ifndef FW_ENABLE_TEXT_LOGGING -#define FW_ENABLE_TEXT_LOGGING 1 //!< Indicates whether text logging is turned on +#define FW_ENABLE_TEXT_LOGGING (1) //!< Indicates whether text logging is turned on #endif // Define if serializables have toString() method. Turning off will save code space and // string constants. Must be enabled if text logging enabled #ifndef FW_SERIALIZABLE_TO_STRING -#define FW_SERIALIZABLE_TO_STRING 1 //!< Indicates if autocoded serializables have toString() methods +#define FW_SERIALIZABLE_TO_STRING (1) //!< Indicates if autocoded serializables have toString() methods #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. +#define FW_AMPCS_COMPATIBLE (0) //!< Whether or not JPL AMPCS ground system support is enabled. #endif // Posix thread names are limited to 16 characters, this can lead to collisions. In the event of a // collision, set this to 0. #ifndef POSIX_THREADS_ENABLE_NAMES -#define POSIX_THREADS_ENABLE_NAMES 1 //!< Enable/Disable assigning names to threads -#endif +#define POSIX_THREADS_ENABLE_NAMES (1) //!< Enable/Disable assigning names to threads +#endif + +// Hint to the compiler to always inline LinearBufferBase serialization & +// deserialization methods +#define FW_SERIALIZE_FORCE_INLINE_LBB +// NOTE: To encourage inlining, uncomment below +// #if defined(__GNUC__) || defined(__clang__) +// #define FW_SERIALIZE_FORCE_INLINE_LBB __attribute__((always_inline)) inline +// #else +// #define FW_SERIALIZE_FORCE_INLINE_LBB +// #endif // *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have // the type definitions in Fw/Types/BasicTypes available. diff --git a/LedBlinker/LedBlinkerDeployment/config/FpConstants.fpp b/LedBlinker/LedBlinkerDeployment/config/FpConstants.fpp index 1c68d50..cc0e49f 100644 --- a/LedBlinker/LedBlinkerDeployment/config/FpConstants.fpp +++ b/LedBlinker/LedBlinkerDeployment/config/FpConstants.fpp @@ -23,29 +23,33 @@ constant FW_COM_BUFFER_MAX_SIZE = 128 constant FW_SM_SIGNAL_BUFFER_MAX_SIZE = 128 @ Specifies the size of the buffer that contains the serialized command arguments -constant FW_CMD_ARG_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - SIZE_OF_FwOpcodeType - SIZE_OF_FwPacketDescriptorType +constant FW_CMD_ARG_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - sizeof(FwOpcodeType) - sizeof(FwPacketDescriptorType) @ Specifies the maximum size of a string in a command argument constant FW_CMD_STRING_MAX_SIZE = 40 @ Specifies the size of the buffer that contains the serialized log arguments -constant FW_LOG_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - SIZE_OF_FwEventIdType - SIZE_OF_FwPacketDescriptorType +constant FW_LOG_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - sizeof(FwEventIdType) - sizeof(FwPacketDescriptorType) @ Specifies the maximum size of a string in a log event @ Note: This constant truncates file names in assertion failure event reports constant FW_LOG_STRING_MAX_SIZE = 64 @ Specifies the size of the buffer that contains the serialized telemetry value -constant FW_TLM_BUFFER_MAX_SIZE = 12 + SIZE_OF_FwChanIdType + SIZE_OF_FwPacketDescriptorType +@ Must fit the largest channel: PassiveRateGroup's PortCycleTime and PortCycleTimeHWM are +@ PassiveRateGroupOutputPorts (10) U32s, 40 bytes. Below the fprime default +@ (FW_COM_BUFFER_MAX_SIZE - sizeof(FwChanIdType) - sizeof(FwPacketDescriptorType), 122 bytes here) to save RAM +constant FW_TLM_BUFFER_MAX_SIZE = 64 -@ Specifies the size of the buffer that contains the serialized telemetry value +@ Specifies the size of the buffer that contains the serialized arguments of a +@ sequencer statement; sized to match a command argument buffer constant FW_STATEMENT_ARG_BUFFER_MAX_SIZE = FW_CMD_ARG_BUFFER_MAX_SIZE @ Specifies the maximum size of a string in a telemetry channel constant FW_TLM_STRING_MAX_SIZE = 10 @ Specifies the size of the buffer that contains the serialized parameter value -constant FW_PARAM_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - SIZE_OF_FwPrmIdType - SIZE_OF_FwPacketDescriptorType +constant FW_PARAM_BUFFER_MAX_SIZE = FW_COM_BUFFER_MAX_SIZE - sizeof(FwPrmIdType) - sizeof(FwPacketDescriptorType) @ Specifies the maximum size of a string in a parameter constant FW_PARAM_STRING_MAX_SIZE = 40 diff --git a/LedBlinker/LedBlinkerDeployment/config/PlatformCfg.fpp b/LedBlinker/LedBlinkerDeployment/config/PlatformCfg.fpp index ce8e582..8a70fab 100644 --- a/LedBlinker/LedBlinkerDeployment/config/PlatformCfg.fpp +++ b/LedBlinker/LedBlinkerDeployment/config/PlatformCfg.fpp @@ -29,6 +29,9 @@ constant FW_RAW_TIME_HANDLE_MAX_SIZE = 56 @ Maximum allowed serialization size for Os::RawTime objects constant FW_RAW_TIME_SERIALIZATION_MAX_SIZE = 8 +@ Maximum size of a handle for Os::CountingSemaphore +constant FW_COUNTING_SEMAPHORE_HANDLE_MAX_SIZE = 48 + @ Maximum size of a handle for Os::ConditionVariable constant FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE = 56 diff --git a/LedBlinker/LedBlinkerDeployment/config/TlmChanImplCfg.hpp b/LedBlinker/LedBlinkerDeployment/config/TlmChanImplCfg.hpp index f33d625..c9a14d2 100644 --- a/LedBlinker/LedBlinkerDeployment/config/TlmChanImplCfg.hpp +++ b/LedBlinker/LedBlinkerDeployment/config/TlmChanImplCfg.hpp @@ -15,11 +15,13 @@ // Anonymous namespace for configuration parameters -// The parameters below provide for tuning of the hash function used to -// write and read entries in the database. The has function is very simple; -// It first takes the telemetry ID and does a modulo computation with -// TLMCHAN_HASH_MOD_VALUE. It then does a second modulo with the number -// of slots to make sure the value lands in the provided slots. +// The parameters below tune the seeded hash function used to write and read +// entries in the database. The channel ID is XORed with a per-boot seed and +// then passed through a Murmur3 finalizer (>=32-bit FwChanIdType) or a Wang +// hash (16-bit FwChanIdType), and finally reduced modulo +// TLMCHAN_NUM_TLM_HASH_SLOTS. Only the 8-bit FwChanIdType path uses +// TLMCHAN_HASH_MOD_VALUE (modulo MOD_VALUE, then modulo the slot count); +// TLMCHAN_HASH_MOD_VALUE has no effect for wider channel-ID types. // The values can be experimented with to try and balance the number // of slots versus the number of buckets. // To test the set of telemetry ID in the system to see if the hash is @@ -46,8 +48,18 @@ enum { TLMCHAN_HASH_MOD_VALUE = 99, // !< The modulo value of the hashing function. // Should be set to a little below the ID gaps to spread the entries around - TLMCHAN_HASH_BUCKETS = 18 // !< Buckets assignable to a hash slot. - // Buckets must be >= number of telemetry channels in system + TLMCHAN_HASH_BUCKETS = 22, // !< Buckets assignable to a hash slot. + // Buckets must be >= number of telemetry channels in system + + // Maximum number of updated telemetry entries Run_handler will serialize + // per invocation. The default of TLMCHAN_HASH_BUCKETS makes the cap a + // no-op and preserves the original uncapped behavior (all updated entries + // are processed each cycle). Lowering this value bounds Run_handler's + // worst-case execution time, but it is an observable behavioral change: + // updated entries beyond the cap are dropped for the cycle and a + // WARNING_HI TlmChanEpochProcessingCapReached event is emitted. Reducing + // it therefore requires CCB approval for the affected deployment. + TLMCHAN_MAX_ENTRIES_PER_RUN = TLMCHAN_HASH_BUCKETS, }; } diff --git a/docs/arduino-led-blinker.md b/docs/arduino-led-blinker.md index 81c6175..08a680e 100644 --- a/docs/arduino-led-blinker.md +++ b/docs/arduino-led-blinker.md @@ -314,7 +314,7 @@ Now that the member variables are set up, we can continue into the component imp Now we will implement the behavior of the `BLINKING_ON_OFF` command. An initial implementation is shown below and may be copied into `Led.cpp` in-place of the BLINKING_ON_OFF command stub. ```cpp -void Led ::BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::On onOff) { +void Led ::BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::On& onOff) { this->m_toggleCounter = 0; // Reset count on any successful command this->m_blinking = Fw::On::ON == onOff; // Update blinking state @@ -367,7 +367,7 @@ fprime-util build Congratulations! You have now implemented some basic functionality in a new F´ component. Your command should look like this ```cpp -void Led ::BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::On onOff) { +void Led ::BLINKING_ON_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::On& onOff) { this->m_toggleCounter = 0; // Reset count on any successful command this->m_blinking = Fw::On::ON == onOff; // Update blinking state @@ -428,7 +428,7 @@ This will ask for some input, respond with the following answers: [5/5] Select framing protocol 1 - CCSDS 2 - Fprime - Choose from [1/2] (1): 2 + Choose from [1/2] (1): 1 [INFO] Found CMake file at 'arduino-led-blinker/LedBlinker/CMakeLists.txt' Add LedBlinkerDeployment to arduino-led-blinker/LedBlinker/CMakeLists.txt at end of file? (yes/no) [yes]: yes [INFO] New deployment successfully created: /home/ethan/fprime-projects/arduino-led-blinker/LedBlinker/LedBlinkerDeployment @@ -501,7 +501,7 @@ First, you must upload the binary into your board. The binary is located in the Open the `fprime-gds` by running the following command: ```sh -fprime-gds -n --dictionary ../../build-artifacts/teensy41/LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 +fprime-gds -n --dictionary ../../build-artifacts/teensy41/LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 ``` This will likely open up your browser and show the running flight software. If it does not open a browser, navigate to `http://localhost:5000`. @@ -526,7 +526,7 @@ Return to the `arduino-led-blinker/LedBlinker/LedBlinkerDeployment` and run the ```sh # In arduino-led-blinker/LedBlinker/LedBlinkerDeployment fprime-util build -fprime-gds -n --dictionary ../../build-artifacts/teensy41/LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 +fprime-gds -n --dictionary ../../build-artifacts/teensy41/LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 # CTRL-C to exit ``` @@ -822,14 +822,14 @@ To do this, add the following lines to the `connections LedBlinkerDeployment` bl connections LedBlinkerDeployment { # Add here connections to user-defined components # Rate Group 1 (1Hz cycle) output is connected to led's run input - rateGroup1.RateGroupMemberOut[4] -> led.run + rateGroup1.RateGroupMemberOut[5] -> led.run # led's gpioSet output is connected to gpioDriver's gpioWrite input led.gpioSet -> gpioDriver.gpioWrite } ``` > [!NOTE] -> `rateGroup1` is preconfigured to call all `RateGroupMemberOut` at a rate of 1 Hz. We use index `RateGroupMemberOut[4]` because `RateGroupMemberOut[0]` through `RateGroupMemberOut[3]` were used previously in the `RateGroups` connection block. +> `rateGroup1` is preconfigured to call all `RateGroupMemberOut` at a rate of 1 Hz. We use index `RateGroupMemberOut[5]` because `RateGroupMemberOut[0]` through `RateGroupMemberOut[4]` were used previously in the `RateGroups` connection block. ### Configuring The GPIO Driver @@ -864,7 +864,7 @@ Next run the F´ GDS without launching the native compilation (`-n`) and with th ```sh # In the project root -fprime-gds -n --dictionary ./build-artifacts/teensy41/LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --framing-selection fprime --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 +fprime-gds -n --dictionary ./build-artifacts/teensy41/LedBlinker_LedBlinkerDeployment/dict/LedBlinkerDeploymentTopologyDictionary.json --communication-selection uart --uart-device /dev/ttyACM0 --uart-baud 115200 ``` > [!Note] diff --git a/lib/fprime b/lib/fprime index 94b4457..1a83bb8 160000 --- a/lib/fprime +++ b/lib/fprime @@ -1 +1 @@ -Subproject commit 94b445715473b41484ea11a739f242478f02279e +Subproject commit 1a83bb878be673f405d5de3c0cc5ed37b5fc3596 diff --git a/lib/fprime-arduino b/lib/fprime-arduino index e7ab740..2c99e54 160000 --- a/lib/fprime-arduino +++ b/lib/fprime-arduino @@ -1 +1 @@ -Subproject commit e7ab740568c0af1b12a02d53acc7449df3941e80 +Subproject commit 2c99e5401d54542f1fa0ebb2f303eddee9d324be diff --git a/lib/fprime-baremetal b/lib/fprime-baremetal index 2be93a2..689f77d 160000 --- a/lib/fprime-baremetal +++ b/lib/fprime-baremetal @@ -1 +1 @@ -Subproject commit 2be93a2f3c116ef60e46e167462b87e0c805213d +Subproject commit 689f77dceeda6129b53d9c912dadc1b58f3e794e From 988e969300eb261c02ef1cfb56e5891bb8e1dcd2 Mon Sep 17 00:00:00 2001 From: Nathan Cheek Date: Sun, 4 Oct 2026 18:56:25 -0700 Subject: [PATCH 5/5] Sync project files with fprime-bootstrap --- .fpp-lsp | 1 + CMakeLists.txt | 6 +++--- docs/arduino-led-blinker.md | 3 +++ requirements.txt | 5 +++++ 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .fpp-lsp create mode 100644 requirements.txt diff --git a/.fpp-lsp b/.fpp-lsp new file mode 100644 index 0000000..c67a29f --- /dev/null +++ b/.fpp-lsp @@ -0,0 +1 @@ +buildCache: build-fprime-automatic-teensy41 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d0ab9e..3669b8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,10 @@ #### -# This sets up the build system for the 'arduino-led-blinker' project, including +# This sets up the build system for the 'LedBlinker' project, including # components and deployments from project.cmake. In addition, it imports the core F Prime components. #### -cmake_minimum_required(VERSION 3.13) -project(fprime-arduino-led-blinker C CXX) +cmake_minimum_required(VERSION 3.24.2) +project(LedBlinker C CXX) ### # F' Core Setup diff --git a/docs/arduino-led-blinker.md b/docs/arduino-led-blinker.md index 08a680e..7daa5f4 100644 --- a/docs/arduino-led-blinker.md +++ b/docs/arduino-led-blinker.md @@ -79,6 +79,9 @@ default_toolchain: teensy41 > [!NOTE] > If you would like to use a different board as your default toolchain, you may change `teensy41` to your desired board. The list of available boards in the `fprime-arduino` toolchain can be found [here](https://github.com/fprime-community/fprime-arduino/blob/main/docs/board-list.md). +> [!TIP] +> If you use the [FPP extension for VS Code](https://marketplace.visualstudio.com/items?itemName=jet-propulsion-laboratory.fpp), point it at your board's build cache: in `arduino-led-blinker/.fpp-lsp`, change `build-fprime-automatic-native` to `build-fprime-automatic-teensy41` (or your board). After `fprime-util generate`, the extension's **FPP: Select Locs file inside workspace** command can also do this for you. + Install `fprime-arduino` dependencies: ```sh # In arduino-led-blinker diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..13eeca3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +# Source tag requirements: +# -r https://raw.githubusercontent.com/nasa/fprime/refs/tags/v4.4.0/requirements.txt + +# Local requirements: +-r ./lib/fprime/requirements.txt