Skip to content

Commit b70fc1e

Browse files
pablogs9ralph-lange
authored andcommitted
Updates
1 parent 41e164e commit b70fc1e

1 file changed

Lines changed: 119 additions & 13 deletions

File tree

  • _docs/tutorials/core/first_application_rtos

‎_docs/tutorials/core/first_application_rtos/index.md‎

Lines changed: 119 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The build system's workflow is a four-step procedure:
5959

6060
Further information about micro-ROS build system can be found [here](https://github.com/micro-ROS/micro-ros-build/tree/dashing/micro_ros_setup)
6161

62-
## Creating a new firmware workspace
62+
## Step 1: Creating a new firmware workspace
6363

6464
In order to accomplish the first step, a new firmware workspace can be created using the following command. The created workspace is platform and RTOS specific.
6565

@@ -77,14 +77,15 @@ The options available here are:
7777

7878
Once the command is executed, a folder named `firmware` must be present in your workspace.
7979

80-
## Configuring the firmware
80+
## Step 2: Configuring the firmware
8181

8282
The configuration step will set up the main micro-ROS options and will select the required application. It can be executed with the following command:
8383

8484
```bash
8585
# Configure step
8686
ros2 run micro_ros_setup configure_firmware.sh [APP] [OPTIONS]
8787
```
88+
8889
The options available for this configuration step are:
8990
- `--transport` or `-t`: `udp`, `tcp`, `serial` or any hardware-specific transport label
9091
- `--dev` or `-d`: agent string descriptor in a serial-like transport
@@ -118,19 +119,19 @@ The files that a micro-ROS app are RTOS-dependent. The table below clarifies whi
118119
<tr>
119120
<td rowspan="4">Nuttx</td>
120121
<td >app.c</td>
121-
<td >micro-ROS app code.</span></td>
122+
<td >micro-ROS app code.</td>
122123
<td rowspan="4"><a href="https://github.com/micro-ROS/apps/tree/dashing/examples/uros_pingpong">Sample app</a></td>
123124
</tr>
124125
<tr>
125-
<td >Kconfig</span></a></td>
126+
<td >Kconfig</td>
126127
<td >Nuttx Kconfig configuration</td>
127128
</tr>
128129
<tr>
129-
<td>Make.defs</span></a></td>
130+
<td>Make.defs</td>
130131
<td>Nuttx build system definitios</td>
131132
</tr>
132133
<tr>
133-
<td >Makefile</span></a></td>
134+
<td >Makefile</td>
134135
<td >Nuttx specific app build script</td>
135136
</tr>
136137
<tr>
@@ -147,24 +148,129 @@ The files that a micro-ROS app are RTOS-dependent. The table below clarifies whi
147148
<tr>
148149
<td rowspan="4">Zephyr</td>
149150
<td >src/app.c</td>
150-
<td >micro-ROS app code.</span></td>
151+
<td >micro-ROS app code.</td>
151152
<td rowspan="4"><a href="https://github.com/micro-ROS/zephyr_apps/tree/dashing/apps/ping_pong">Sample app</a></td>
152153
</tr>
153154
<tr>
154-
<td >app-colcon.meta</span></a></td>
155+
<td >app-colcon.meta</td>
155156
<td >micro-ROS app specific colcon configuration. Detailed info <a href="https://micro-ros.github.io/docs/tutorials/core/microxrcedds_rmw_configuration/">here</a>.</td>
156157
</tr>
157158
<tr>
158-
<td>CMakeLists.txt</span></a></td>
159+
<td>CMakeLists.txt</td>
159160
<td>CMake file for Zephyr app building</td>
160161
</tr>
161162
<tr>
162-
<td >prj.conf</span></a></td>
163+
<td >prj.conf</td>
163164
<td >Zephyr specific app configuration</td>
164165
</tr>
165166
</table>
166167

167-
## Building the firmware
168+
The following steps are RTOS-specific commands for creating a new app once the firmware folder is created inside `microros_ws`:
169+
170+
### Nuttx
171+
172+
Create a new app:
173+
174+
```bash
175+
# Go to app folder inside firmware
176+
cd firmware/apps/examples
177+
178+
# Create your app folder and required files. Contents of these file can be found in column Sample app in table above
179+
mkdir uros_pingpong
180+
cd uros_pingpong
181+
touch Kconfig
182+
touch Makefile
183+
touch uros_pingpong_main.c
184+
touch Make.defs
185+
```
186+
187+
Create a specific configuration. We're going to start from an already existing one and modify it for our new application.
188+
189+
Execute the next command:
190+
```bash
191+
cd microros_ws
192+
ros2 run micro_ros_setup configure_firmware.sh uros
193+
```
194+
195+
This sets the Ethernet and micro-ROS required configuration. However, in order to add our application, we're going to modify it:
196+
197+
```bash
198+
cd firmware/NuttX
199+
make menuconfig
200+
```
201+
202+
This will open the NuttX menu config, which allows you to modify the configuration of the RTOS, including adding a new application.
203+
204+
205+
- On the menu, you need to follow the next path:
206+
``Application Configuration -> Examples ``
207+
![](imgs/nuttx_menuconfig.png)
208+
209+
- This will show a list of the available applications. You need to find: ``micro-ROS Ping-Pong`` and click ``y`` to add it.
210+
![](imgs/nuttx_examples.png)
211+
212+
- Now push three times the key ``ESC`` to close the menu. You will be asked if you want to save the save your new configuration, and you need to click ``Yes``.
213+
214+
215+
To save your configuration execute the following commands:
216+
217+
```bash
218+
cd uros_ws/firmware/NuttX
219+
make savedefconfig
220+
```
221+
222+
This will generate a file called ``defconfig`` inside of ``uros_ws/firmware/NuttX``. This file is a config profile with all the required configuration to run your specific configuration which includes your application.
223+
224+
Finally create a folder called ``uros_pingpong`` into ``uros_ws/firmware/NuttX/configs/olimex-stm32-e407`` and move the defconfig file to uros_pingpong folder so you can execute:
225+
226+
```bash
227+
# Configure step
228+
ros2 run micro_ros_setup configure_firmware.sh uros_pingpong
229+
```
230+
231+
### FreeRTOS
232+
233+
Create a new app:
234+
235+
```bash
236+
# Create your app folder and required files. Contents of these file can be found in column Sample app in table above
237+
pushd firmware/freertos_apps/apps
238+
mkdir ping_pong
239+
cd ping_pong
240+
touch app.c app-colcon.meta
241+
popd
242+
```
243+
244+
Now you are ready to call:
245+
246+
```bash
247+
# Configure step
248+
ros2 run micro_ros_setup configure_firmware.sh ping_pong [OPTIONS]
249+
```
250+
251+
### Zephyr
252+
253+
Create a new app:
254+
255+
```bash
256+
# Create your app folder and required files. Contents of these file can be found in column Sample app in table above
257+
pushd firmware/zephyr_apps/apps
258+
mkdir my_brand_new_app
259+
cd my_brand_new_app
260+
mkdir src
261+
touch src/app.c app-colcon.meta
262+
touch CMakeLists.txt prj.conf
263+
popd
264+
```
265+
266+
Now you are ready to call:
267+
268+
```bash
269+
# Configure step
270+
ros2 run micro_ros_setup configure_firmware.sh ping_pong [OPTIONS]
271+
```
272+
273+
## Step 3: Building the firmware
168274

169275
When the configuring step ends, just build the firmware:
170276

@@ -173,7 +279,7 @@ When the configuring step ends, just build the firmware:
173279
ros2 run micro_ros_setup build_firmware.sh
174280
```
175281

176-
## Flashing the firmware
282+
## Step 4: Flashing the firmware
177283

178284
Flashing the firmware into the platform may vary across hardware platforms. Regarding this tutorial's target platform (**[Olimex STM32-E407](https://www.olimex.com/Products/ARM/ST/STM32-E407/open-source-hardware)**), JTAG interface is going to be used to flash the firmware.
179285

@@ -206,7 +312,7 @@ colcon build
206312
source install/local_setup.bash
207313
```
208314

209-
Then, depending on the selected transport the board connection to the agent may differ:
315+
Then, depending on the selected transport and RTOS, the board connection to the agent may differ:
210316

211317
| RTOS | micro-ROS Client to Agent |
212318
| :------: | ------------------------- |

0 commit comments

Comments
 (0)