File tree Expand file tree Collapse file tree 6 files changed +64
-0
lines changed Expand file tree Collapse file tree 6 files changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Cargo drops lock files in projects to capture resolved dependencies.
2
+ # We don't want to record these.
3
+ Cargo.lock
4
+
5
+ # Cargo encourates a .cargo/config.toml file to symlink to a generated
6
+ # file. Don't save these.
7
+ .cargo /
Original file line number Diff line number Diff line change
1
+ # SPDX-License-Identifier: Apache-2.0
2
+
3
+ cmake_minimum_required (VERSION 3.20.0 )
4
+
5
+ find_package (Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} )
6
+ project (hello_world )
7
+
8
+ rust_cargo_application ()
Original file line number Diff line number Diff line change
1
+ # Copyright (c) 2024 Linaro LTD
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ [package ]
5
+ # This must be rustapp for now.
6
+ name = " rustapp"
7
+ version = " 0.1.0"
8
+ edition = " 2021"
9
+ description = " A sample hello world application in Rust"
10
+ license = " Apache-2.0 or MIT"
11
+
12
+ [lib ]
13
+ crate-type = [" staticlib" ]
14
+
15
+ [dependencies ]
16
+ zephyr = " 0.1.0"
Original file line number Diff line number Diff line change
1
+ # Copyright (c) 2024 Linaro LTD
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ CONFIG_RUST=y
Original file line number Diff line number Diff line change
1
+ sample :
2
+ description : Hello world, but in Rust
3
+ name : hello rust
4
+ common :
5
+ harness : console
6
+ harness_config :
7
+ type : one_line
8
+ regex :
9
+ - " Hello world from Rust on (.*)"
10
+ filter : CONFIG_RUST_SUPPORTED
11
+ tests :
12
+ sample.rust.hellorust :
13
+ tags : introduction
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2024 Linaro LTD
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ #![ no_std]
5
+
6
+ use zephyr:: printkln;
7
+
8
+ // Reference the Zephyr crate so that the panic handler gets used. This is only needed if no
9
+ // symbols from the crate are directly used.
10
+ extern crate zephyr;
11
+
12
+ #[ no_mangle]
13
+ extern "C" fn rust_main ( ) {
14
+ printkln ! ( "Hello world from Rust on {}" ,
15
+ zephyr:: kconfig:: CONFIG_BOARD ) ;
16
+ }
You can’t perform that action at this time.
0 commit comments