You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/guides/rust_tutorials/create_project.mdx
+14-15Lines changed: 14 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,15 +15,15 @@ import Contact from '@components/contact.astro';
15
15
Now that we have added RIOT as a submodule to our project, we can start writing our hello world program.
16
16
You can use any text editor to create this file. We will use Visual Studio Code in this example. To open Visual Studio Code in the directory, you can use the following command:
17
17
18
-
```bash
18
+
```bash title="Open Visual Studio Code"
19
19
code .
20
20
```
21
21
22
22
## Step 2: Initialize Rust
23
23
24
24
Now that Visual Studio Code is open, we need to tell Rust what kind of project we want to create. We do this by running the following command in the terminal:
25
25
26
-
```bash
26
+
```bash title="Create a new Rust project"
27
27
cargo new hello_world --lib
28
28
```
29
29
@@ -45,7 +45,7 @@ You should now have 3 new files within your project directory:
45
45
46
46
Now that we have created our hello world program, we need to create a Makefile to build our program. The Makefile is a build automation tool that allows us to define how our program should be built. We create a new file called `Makefile` in the root directory of our project and add the following code:
47
47
48
-
```makefile
48
+
```makefile title="Makefile"
49
49
# name of your application
50
50
APPLICATION = hello-world
51
51
@@ -66,17 +66,16 @@ DEVELHELP ?= 1
66
66
# Change this to 0 show compiler invocation lines by default:
67
67
QUIET ?= 1
68
68
69
-
# Tell the build system to use the Rust crate here
70
-
FEATURES_REQUIRED += rust_target
71
69
# Make sure this matches the name of the Rust crate
72
70
APPLICATION_RUST_MODULE = hello_world
73
-
BASELIBS += $(APPLICATION_RUST_MODULE).module
74
71
75
72
include$(RIOTBASE)/Makefile.include
76
73
```
77
74
78
75
:::note
79
-
The `BUILD_IN_DOCKER=1` flag tells the build system to use the docker image provided by RIOT to build our program. This ensures that we have all the necessary dependencies to build our program. If you have already built RIOT on your system, you can omit this flag and the build system will use the toolchain installed on your system.
76
+
The `BUILD_IN_DOCKER=1` flag tells the build system to use the docker image provided by RIOT to build our program.
77
+
This ensures that we have all the necessary dependencies to build our program.
78
+
If you have already built RIOT on your system, you can omit this flag and the build system will use the toolchain installed on your system.
80
79
:::
81
80
82
81
Now RIOT knows that you want to build a Rust application and will use the `hello_world` crate as the main module.
@@ -87,7 +86,7 @@ Now RIOT knows that you want to build a Rust application and will use the `hello
0 commit comments