diff --git a/docs/Tutorials/HelloWorld/Deployments.md b/docs/Tutorials/HelloWorld/Deployments.md index b3193d53e7..96ee274801 100644 --- a/docs/Tutorials/HelloWorld/Deployments.md +++ b/docs/Tutorials/HelloWorld/Deployments.md @@ -22,7 +22,7 @@ ground control and data collection of the deployment. To create a deployment, run the following commands: ```bash -cd MyProject +# In: MyProject fprime-util new --deployment ``` This command will ask for some input. Respond with the following answers: @@ -30,7 +30,6 @@ This command will ask for some input. Respond with the following answers: ``` deployment_name [MyDeployment]: MyDeployment path_to_fprime [./fprime]: -author_name []: LeStarch ``` > For any other questions, select the default response. @@ -50,6 +49,13 @@ to `MyDeployment/CMakeLists.txt`. include("${FPRIME_PROJECT_ROOT}/project.cmake") ... ``` +> To build this new deployment generate a build cache and then build. +> ```bash +> # In: MyProject/MyDeployment +> fprime-util generate +> fprime-util build +> ``` +> > Notice `fprime-util generate` was used again. This is because this new deployment builds in a separate environment. In this section the `HelloWorld` component will be added to the `MyDeployment` deployment. This can be done by adding the component to the topology defined in `MyDeployment/Top`. @@ -62,12 +68,13 @@ specific configuration. In order to add a component to the topology, it must be added to the topology model. An instance definition and an instance initializer must both be added. -To add an instance definition, add `instance helloWorld` to the instance definition list in the `topology Ref` section +To add an instance definition, add `instance helloWorld` to the instance definition list in the `topology MyDeployment` section of `MyDeployment/Top/topology.fpp`. This is shown below. +Edit `MyDeployment/Top/topology.fpp`: ``` ... - topology Ref { + topology MyDeployment { # ---------------------------------------------------------------------- # Instances used in the topology # ---------------------------------------------------------------------- @@ -85,6 +92,7 @@ Next, an instance initializer must be added to topology instances defined in `My Since the `HelloWorld` component is an `active` component it should be added to the active components section and should define a priority and queue depth options. This is shown below. +Add to `MyDeploymment/Top/instances.fpp`: ``` ... # ---------------------------------------------------------------------- @@ -112,6 +120,7 @@ Finally, our new telemetry channel should be added to our telemetry packet speci channel can be ignored as the deployment will not use the telemetry packetizer. Add the following to the `ignore` section of `MyDeployment/Top/MyDeploymentPackets.xml`. +Update `MyDeployment/Top/MyDeploymentPackets.xml`: ``` ... @@ -123,15 +132,12 @@ Since this component has no custom ports nor does it require special configurati completed. The deployment can now be set up and built using the following commands: ``` -cd MyDeployment -fprime-util generate +# In: MyProject/MyDeployment fprime-util build -j4 ``` -Resolve any errors that occur before continuing to the testing section. +> Resolve any errors that occur before continuing to the running section. -> Notice `fprime-util generate` was used again. This is because this new deployment builds in a separate environment. - -## Testing With `fprime-gds` +## Running With `fprime-gds` It is now time to test the `HelloWorld` component by running the deployment created in this section. This can be accomplished by running the `fprime-gds` command in the deployment, verifying connection, sending the new SEND_HELLO diff --git a/docs/Tutorials/HelloWorld/HelloWorld.md b/docs/Tutorials/HelloWorld/HelloWorld.md index 527d08413e..b034509fdb 100644 --- a/docs/Tutorials/HelloWorld/HelloWorld.md +++ b/docs/Tutorials/HelloWorld/HelloWorld.md @@ -36,20 +36,22 @@ The next step is to create the new component. First, create a directory called ` components and change into that directory. ```bash -mkdir MyComponents +# In: MyProject +mkdir -p MyComponents cd MyComponents ``` Creating a new component is accomplished with the following command: ```bash +# In: MyProject/MyComponents fprime-util new --component ``` This command will ask for some input. You should respond with the following answers: ``` [INFO] Cookiecutter source: using builtin -component_name [MyComponent]: HelloWorld +component_name [MyComponent]: HelloWorld component_short_description [Example Component for F Prime FSW framework.]: Hello World Tutorial Component component_namespace [HelloWorld]: MyComponents Select component_kind: @@ -72,20 +74,21 @@ Choose from 1, 2 [1]: 1 Select enable_parameters: 1 - yes 2 - no -Choose from 1, 2 [1]: 2 +Choose from 1, 2 [1]: 1 [INFO] Found CMake file at 'MyProject/project.cmake' Add component MyComponents/HelloWorld to MyProject/project.cmake at end of file (yes/no)? yes -Generate implementation files (yes/no)? no +Generate implementation files (yes/no)? yes ``` > For any other questions, select the default response. This will create a new component called "HelloWorld" in the "MyProject" namespace. This new component will be able to -define commands, events, and telemetry channels. +define commands, events, telemetry channels, and parameters. We should navigate to the component's directory and look around: ```bash +# In: MyProject/MyComponents cd HelloWorld ls ``` @@ -104,21 +107,23 @@ To build this component run `fprime-util build` in the current folder. A component model defines the interface of the component with the rest of the F´ system and with the ground system F´ communicates with. In this case we intend to define a command, an event, and a telemetry channel as specified above. -Open the model file `HelloWorld.fpp` and add replace the line +Open the model file `HelloWorld.fpp` and add replace the line: -`async command TODO opcode 0` +``` +async command TODO opcode 0 +``` with the following: ``` @ Command to issue greeting with maximum length of 20 characters async command SAY_HELLO( - greeting: string size 20 @ Greeting to repeat in the Hello event + greeting: string size 20 @< Greeting to repeat in the Hello event ) @ Greeting event with maximum greeting length of 20 characters event Hello( - greeting: string size 20 @ Greeting supplied from the SAY_HELLO command + greeting: string size 20 @< Greeting supplied from the SAY_HELLO command ) severity activity high format "I say: {}" @ A count of the number of greetings issued @@ -130,6 +135,7 @@ telemetry GreetingCount: U32 With this step completed you can generate a basic implementation with the following command: ```bash +# In: MyProject/MyComponents/HelloWorld fprime-util impl ``` @@ -171,12 +177,15 @@ void HelloWorld:: SAY_HELLO_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw > private: > U32 m_greetingCount; > ``` +> Should be added inside the `class` definition in `HelloWorld.hpp`. +> > **HelloWorld.cpp: Updating Constructor** > ```c++ -> HelloWorld:: HelloWorld() : -> m_greetingCount(0), -> HelloWorldComponentBase(compName) { +> HelloWorld:: HelloWorld(const char *const compName) : HelloWorldComponentBase(compName), +> m_greetingCount(0) +> { > ``` +> Should be added to the `HelloWorld` constructor at the top of the file. The component should build without errors by running `fprime-util build`. Resolve any errors that occur before proceeding to the next section. diff --git a/docs/Tutorials/HelloWorld/NewProject.md b/docs/Tutorials/HelloWorld/NewProject.md index ba45857cd9..817bd81e24 100644 --- a/docs/Tutorials/HelloWorld/NewProject.md +++ b/docs/Tutorials/HelloWorld/NewProject.md @@ -42,9 +42,16 @@ Choose from 1, 2 [1]: 1 Use the default for anything not specified. This command will take a moment to run. The above command creates a new F´ project structure in a folder called `MyProject`, use the `devel` branch of F´ as -the basis for the project, and set up the matching tools in a new Virtual Environment. - -> Experienced F´ users may note that we have not yet created a deployment, but rather just the base project structure. +the basis for the project, and sets up the matching tools in a new Virtual Environment. + +> Load the tools for this project via the virtual environment. +> +> ```bash +> cd MyProject +> . venv/bin/activate +>``` +> +> Make sure to load these tools any time you are working with the this project. ## Building the New F´ Project