Skip to content

Commit de6433a

Browse files
committed
Switch to using cargo for Rust build
1 parent b15d2e6 commit de6433a

File tree

10 files changed

+48
-19
lines changed

10 files changed

+48
-19
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[build]
2+
target = "wasm32-unknown-unknown"
3+
rustflags = [
4+
"-C", "link-args=-zstack-size=2048 -s",
5+
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Cargo.lock
2+
target/
3+
*.wat
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "app"
3+
version = "0.1.0"
4+
authors = ["Volodymyr Shymanskyy <[email protected]>"]
5+
edition = "2018"
6+
7+
[lib]
8+
path = "src/app.rs"
9+
crate-type = ["cdylib"]
10+
11+
[dependencies]
12+
13+
[profile.dev]
14+
panic = "abort"
15+
16+
[profile.release]
17+
panic = "abort"
18+
opt-level = "s"
19+
codegen-units = 1
20+
lto = true
21+
#debug = true
Binary file not shown.

examples_pio/Wasm_Advanced/wasm_apps/rust/app.wasm.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@ unsigned char app_wasm[] = {
22
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x11, 0x04, 0x60,
33
0x02, 0x7f, 0x7f, 0x00, 0x60, 0x00, 0x00, 0x60, 0x01, 0x7f, 0x00, 0x60,
44
0x00, 0x01, 0x7f, 0x02, 0x5e, 0x05, 0x07, 0x61, 0x72, 0x64, 0x75, 0x69,
5-
0x6e, 0x6f, 0x05, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x00, 0x02, 0x07, 0x61,
6-
0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x07, 0x70, 0x69, 0x6e, 0x4d, 0x6f,
7-
0x64, 0x65, 0x00, 0x00, 0x07, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f,
8-
0x0c, 0x64, 0x69, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x57, 0x72, 0x69, 0x74,
9-
0x65, 0x00, 0x00, 0x07, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x09,
10-
0x67, 0x65, 0x74, 0x50, 0x69, 0x6e, 0x4c, 0x45, 0x44, 0x00, 0x03, 0x07,
11-
0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x05, 0x70, 0x72, 0x69, 0x6e,
12-
0x74, 0x00, 0x00, 0x03, 0x02, 0x01, 0x01, 0x05, 0x03, 0x01, 0x00, 0x01,
5+
0x6e, 0x6f, 0x05, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x00, 0x00, 0x07, 0x61,
6+
0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x09, 0x67, 0x65, 0x74, 0x50, 0x69,
7+
0x6e, 0x4c, 0x45, 0x44, 0x00, 0x03, 0x07, 0x61, 0x72, 0x64, 0x75, 0x69,
8+
0x6e, 0x6f, 0x07, 0x70, 0x69, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x00, 0x00,
9+
0x07, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x0c, 0x64, 0x69, 0x67,
10+
0x69, 0x74, 0x61, 0x6c, 0x57, 0x72, 0x69, 0x74, 0x65, 0x00, 0x00, 0x07,
11+
0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x05, 0x64, 0x65, 0x6c, 0x61,
12+
0x79, 0x00, 0x02, 0x03, 0x02, 0x01, 0x01, 0x05, 0x03, 0x01, 0x00, 0x01,
1313
0x06, 0x0d, 0x02, 0x7f, 0x00, 0x41, 0x90, 0x10, 0x0b, 0x7f, 0x00, 0x41,
1414
0x90, 0x10, 0x0b, 0x07, 0x2e, 0x04, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72,
1515
0x79, 0x02, 0x00, 0x0a, 0x5f, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x65,
1616
0x6e, 0x64, 0x03, 0x00, 0x0b, 0x5f, 0x5f, 0x68, 0x65, 0x61, 0x70, 0x5f,
1717
0x62, 0x61, 0x73, 0x65, 0x03, 0x01, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72,
1818
0x74, 0x00, 0x05, 0x0a, 0x38, 0x01, 0x36, 0x01, 0x01, 0x7f, 0x41, 0x81,
19-
0x10, 0x41, 0x0f, 0x10, 0x04, 0x41, 0x80, 0x10, 0x41, 0x01, 0x10, 0x04,
20-
0x10, 0x03, 0x22, 0x00, 0x41, 0x01, 0x10, 0x01, 0x03, 0x40, 0x20, 0x00,
21-
0x41, 0x01, 0x10, 0x02, 0x41, 0xe4, 0x00, 0x10, 0x00, 0x20, 0x00, 0x41,
22-
0x00, 0x10, 0x02, 0x41, 0x84, 0x07, 0x10, 0x00, 0x0c, 0x00, 0x0b, 0x00,
19+
0x10, 0x41, 0x0f, 0x10, 0x00, 0x41, 0x80, 0x10, 0x41, 0x01, 0x10, 0x00,
20+
0x10, 0x01, 0x22, 0x00, 0x41, 0x01, 0x10, 0x02, 0x03, 0x40, 0x20, 0x00,
21+
0x41, 0x01, 0x10, 0x03, 0x41, 0xe4, 0x00, 0x10, 0x04, 0x20, 0x00, 0x41,
22+
0x00, 0x10, 0x03, 0x41, 0x84, 0x07, 0x10, 0x04, 0x0c, 0x00, 0x0b, 0x00,
2323
0x0b, 0x0b, 0x17, 0x01, 0x00, 0x41, 0x80, 0x10, 0x0b, 0x10, 0x0a, 0x52,
2424
0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x72, 0x75, 0x6e, 0x6e, 0x69,
2525
0x6e, 0x67

examples_pio/Wasm_Advanced/wasm_apps/rust/build.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Compile
2-
rustc -O --crate-type=cdylib \
3-
--target=wasm32-unknown-unknown \
4-
-C link-arg=-zstack-size=2048 \
5-
-C link-arg=-s \
6-
-o app.wasm app.rs
2+
cargo build --release
3+
cp ./target/wasm32-unknown-unknown/release/app.wasm ./
74

85
# Optimize (optional)
96
wasm-opt -O3 app.wasm -o app.wasm

examples_pio/Wasm_Advanced/wasm_apps/rust/app.rs renamed to examples_pio/Wasm_Advanced/wasm_apps/rust/src/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#![feature(core_intrinsics)]
21
#![no_std]
2+
#![feature(core_intrinsics)]
33

44
mod arduino;
55
use arduino::*;

wasm_apps/rust/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Cargo.lock
2+
target/
3+
*.wat

wasm_apps/rust/src/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#![feature(core_intrinsics)]
21
#![no_std]
2+
#![feature(core_intrinsics)]
33

44
mod arduino;
55
use arduino::*;

0 commit comments

Comments
 (0)