Skip to content

Commit aee2a8a

Browse files
Update Rust 1.94.1, crates to latest, fix API changes, add VS Code tasks
- rust-toolchain.toml: 1.87.0 → 1.94.1 - Dockerfile: rust:1.86.0-bullseye → rust:1.94.1-bookworm, flip-link 0.1.12 - Cargo.toml: defmt 1.0, defmt-rtt 1.1, panic-probe 1.0, rp2040-hal 0.12, critical-section 1.2, defmt-test 0.4; restructure features for embassy compat - multicore.rs: Use Stack::take() API (rp2040-hal 0.12 change) - adc_read.rs: Remove unused OneShot import - Embassy examples: Update run commands for --no-default-features - Add .vscode/tasks.json with build, format, size, objdump, elf2uf2 tasks Agent-Logs-Url: https://github.com/Baker-link-Lab/bakerlink_tutorial_template/sessions/88bc0208-29f6-4429-b876-6bc9f6e55e9a Co-authored-by: Baker-Tanaka <42606588+Baker-Tanaka@users.noreply.github.com>
1 parent 2134c36 commit aee2a8a

9 files changed

Lines changed: 102 additions & 18 deletions

File tree

.docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM rust:1.86.0-bullseye
1+
FROM rust:1.94.1-bookworm
22

33
RUN rustup target install thumbv6m-none-eabi
4-
RUN cargo install flip-link --version 0.1.10
4+
RUN cargo install flip-link --version 0.1.12
55
RUN rustup component add rustfmt
66
RUN rustup component add llvm-tools
77
RUN cargo install cargo-binutils

.vscode/tasks.json

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "cargo: build",
6+
"type": "shell",
7+
"command": "cargo build",
8+
"group": {
9+
"kind": "build",
10+
"isDefault": true
11+
},
12+
"problemMatcher": ["$rustc"]
13+
},
14+
{
15+
"label": "cargo: build (release)",
16+
"type": "shell",
17+
"command": "cargo build --release",
18+
"group": "build",
19+
"problemMatcher": ["$rustc"]
20+
},
21+
{
22+
"label": "cargo: build embassy example",
23+
"type": "shell",
24+
"command": "cargo build --no-default-features --features embassy --example ${input:embassyExample}",
25+
"group": "build",
26+
"problemMatcher": ["$rustc"]
27+
},
28+
{
29+
"label": "cargo: check",
30+
"type": "shell",
31+
"command": "cargo check",
32+
"group": "build",
33+
"problemMatcher": ["$rustc"]
34+
},
35+
{
36+
"label": "cargo fmt: format code",
37+
"type": "shell",
38+
"command": "cargo fmt",
39+
"problemMatcher": []
40+
},
41+
{
42+
"label": "cargo fmt: check format",
43+
"type": "shell",
44+
"command": "cargo fmt -- --check",
45+
"problemMatcher": []
46+
},
47+
{
48+
"label": "cargo size: show binary size",
49+
"type": "shell",
50+
"command": "cargo size --release -- -A",
51+
"problemMatcher": []
52+
},
53+
{
54+
"label": "cargo objdump: disassemble",
55+
"type": "shell",
56+
"command": "cargo objdump --release -- --disassemble",
57+
"problemMatcher": []
58+
},
59+
{
60+
"label": "elf2uf2: convert to UF2",
61+
"type": "shell",
62+
"command": "elf2uf2-rs target/thumbv6m-none-eabi/release/{{project-name}} target/{{project-name}}.uf2",
63+
"dependsOn": "cargo: build (release)",
64+
"problemMatcher": []
65+
},
66+
{
67+
"label": "cargo: clean",
68+
"type": "shell",
69+
"command": "cargo clean",
70+
"problemMatcher": []
71+
}
72+
],
73+
"inputs": [
74+
{
75+
"id": "embassyExample",
76+
"description": "Embassy example name",
77+
"type": "pickString",
78+
"options": [
79+
"embassy_blinky",
80+
"embassy_button",
81+
"embassy_multitask"
82+
],
83+
"default": "embassy_blinky"
84+
}
85+
]
86+
}

Cargo.toml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[features]
9-
default = []
9+
default = ["hal-rt"]
10+
hal-rt = ["rp2040-hal/rt"]
1011
embassy = [
1112
"dep:embassy-executor",
1213
"dep:embassy-time",
@@ -19,12 +20,12 @@ cortex-m = "0.7"
1920
cortex-m-rt = "0.7"
2021
embedded-hal = { version = "1.0.0" }
2122
embedded_hal_0_2 = { package = "embedded-hal", version = "0.2.5", features = ["unproven"] }
22-
defmt = "0.3"
23-
defmt-rtt = "0.4"
24-
panic-probe = { version = "0.3", features = ["print-defmt"] }
25-
rp2040-hal = { version = "0.10", features = ["rt", "critical-section-impl"] }
23+
defmt = "1.0"
24+
defmt-rtt = "1.1"
25+
panic-probe = { version = "1.0", features = ["print-defmt"] }
26+
rp2040-hal = { version = "0.12", features = ["critical-section-impl"] }
2627
rp2040-boot2 = "0.3"
27-
critical-section = "1.0.0"
28+
critical-section = "1.2"
2829
fugit = "0.3"
2930

3031
# Embassy dependencies (optional, enabled via "embassy" feature)
@@ -34,7 +35,7 @@ embassy-rp = { version = "0.10", features = ["defmt", "rp2040", "time-driver", "
3435
embassy-sync = { version = "0.8", features = ["defmt"], optional = true }
3536

3637
[dev-dependencies]
37-
defmt-test = "0.3"
38+
defmt-test = "0.4"
3839

3940
[[test]]
4041
name = "example_test"

examples/adc_read.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ use hal::pac;
1717

1818
use embedded_hal::delay::DelayNs;
1919

20-
// rp2040-hal のADCは embedded-hal 0.2 の OneShot トレイトを使用
21-
use embedded_hal_0_2::adc::OneShot;
22-
2320
#[link_section = ".boot2"]
2421
#[used]
2522
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;

examples/embassy_blinky.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Embassy非同期フレームワークを使ったLED点滅の基本例です。
44
// async/awaitにより、ブロッキングなしでタイマーを待機できます。
55
//
6-
// 実行方法: cargo run --example embassy_blinky --features embassy
6+
// 実行方法: cargo run --no-default-features --features embassy --example embassy_blinky
77

88
#![no_std]
99
#![no_main]

examples/embassy_button.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// - GPIO20: Red LED
1010
// - GPIO23: Button(プルアップ、押すとLOW)
1111
//
12-
// 実行方法: cargo run --example embassy_button --features embassy
12+
// 実行方法: cargo run --no-default-features --features embassy --example embassy_button
1313

1414
#![no_std]
1515
#![no_main]

examples/embassy_multitask.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// - red_led_task: GPIO20の赤LEDを2秒間隔で点滅
99
// - logger_task: 5秒ごとにステータスをログ出力
1010
//
11-
// 実行方法: cargo run --example embassy_multitask --features embassy
11+
// 実行方法: cargo run --no-default-features --features embassy --example embassy_multitask
1212

1313
#![no_std]
1414
#![no_main]

examples/multicore.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;
2727
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
2828

2929
// Core1用のスタック領域
30-
static mut CORE1_STACK: Stack<4096> = Stack::new();
30+
static CORE1_STACK: Stack<4096> = Stack::new();
3131

3232
// Core1で実行される関数
3333
fn core1_task() {
@@ -99,7 +99,7 @@ fn main() -> ! {
9999
let core1 = &mut cores[1];
100100
core1
101101
.spawn(
102-
unsafe { &mut *core::ptr::addr_of_mut!(CORE1_STACK.mem) },
102+
CORE1_STACK.take().unwrap(),
103103
core1_task,
104104
)
105105
.unwrap();

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "1.87.0"
2+
channel = "1.94.1"
33
targets = ["thumbv6m-none-eabi"]
44
components = ["rustfmt", "llvm-tools"]

0 commit comments

Comments
 (0)