File tree Expand file tree Collapse file tree 6 files changed +113
-0
lines changed Expand file tree Collapse file tree 6 files changed +113
-0
lines changed 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
+
7
+ project (gpio_async )
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 = " Test async gpios"
10
+ license = " Apache-2.0 or MIT"
11
+
12
+ [lib ]
13
+ crate-type = [" staticlib" ]
14
+
15
+ [dependencies ]
16
+ zephyr = { version = " 0.1.0" , features = [" time-driver" , " executor-zephyr" ] }
17
+ log = " 0.4.22"
18
+ static_cell = " 2.1"
19
+ heapless = " 0.8"
20
+
21
+ [dependencies .embassy-executor ]
22
+ version = " 0.7.0"
23
+ features = [
24
+ " log" ,
25
+ " task-arena-size-2048" ,
26
+ ]
27
+
28
+ [dependencies .embassy-futures ]
29
+ version = " 0.1.1"
30
+
31
+ [dependencies .embassy-sync ]
32
+ version = " 0.6.2"
33
+
34
+ [dependencies .embassy-time ]
35
+ version = " 0.4.0"
36
+ features = [" tick-hz-10_000" ]
37
+
38
+ [dependencies .critical-section ]
39
+ version = " 1.2"
40
+
41
+ [profile .dev ]
42
+ opt-level = 1
43
+
44
+ [profile .release ]
45
+ debug = true
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
+ # This board doesn't have a serial console, so use RTT.
5
+ CONFIG_UART_CONSOLE=n
6
+ CONFIG_RTT_CONSOLE=y
7
+ CONFIG_USE_SEGGER_RTT=y
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_DEBUG=y
5
+
6
+ # The default 1k stack isn't large enough for rust string formatting with logging.
7
+ CONFIG_MAIN_STACK_SIZE=4096
8
+
9
+ CONFIG_RUST=y
10
+
11
+ CONFIG_RUST_ALLOC=y
12
+ # CONFIG_LOG=y
13
+
14
+ CONFIG_LOG_BACKEND_RTT=n
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
+ # This board doesn't have a serial console, so use RTT.
5
+ CONFIG_UART_CONSOLE=n
6
+ CONFIG_RTT_CONSOLE=y
7
+ CONFIG_USE_SEGGER_RTT=y
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
+ extern crate alloc;
7
+
8
+ use zephyr:: embassy:: Executor ;
9
+
10
+ use embassy_executor:: Spawner ;
11
+ use log:: info;
12
+ use static_cell:: StaticCell ;
13
+
14
+ static EXECUTOR_MAIN : StaticCell < Executor > = StaticCell :: new ( ) ;
15
+
16
+ #[ no_mangle]
17
+ extern "C" fn rust_main ( ) {
18
+ unsafe {
19
+ zephyr:: set_logger ( ) . unwrap ( ) ;
20
+ }
21
+
22
+ let executor = EXECUTOR_MAIN . init ( Executor :: new ( ) ) ;
23
+ executor. run ( |spawner| {
24
+ spawner. spawn ( main ( spawner) ) . unwrap ( ) ;
25
+ } )
26
+ }
27
+
28
+ #[ embassy_executor:: task]
29
+ async fn main ( spawner : Spawner ) {
30
+ info ! ( "Hello world" ) ;
31
+ let _ = spawner;
32
+ }
You can’t perform that action at this time.
0 commit comments