Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
RISC-VボードでRustを動かす話
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Daniel
July 03, 2019
Technology
1
960
RISC-VボードでRustを動かす話
最近買ったRISC-VボードHifive1 RevBの上でRustを動かす話です。(時間の関係ではなせなかった部分が少し増えてます)
Daniel
July 03, 2019
Tweet
Share
More Decks by Daniel
See All by Daniel
Juliaで機械学習
peshogo
2
820
一年生へ
peshogo
1
76
炭酸飲料が飲めない学校で炭酸飲料を飲めるよにした話
peshogo
0
94
Other Decks in Technology
See All in Technology
Phase09_自動化_仕組み化
overflowinc
0
1.7k
【PHPerKaigi2026】OpenTelemetry SDKを使ってPHPでAPMを自作する
fendo181
1
190
Phase05_ClaudeCode入門
overflowinc
0
2.1k
Why we keep our community?
kawaguti
PRO
0
220
「AIエージェントで変わる開発プロセス―レビューボトルネックからの脱却」
lycorptech_jp
PRO
0
120
スピンアウト講座03_CLAUDE-MDとSKILL-MD
overflowinc
0
1.3k
Phase11_戦略的AI経営
overflowinc
0
1.5k
FlutterでPiP再生を実装した話
s9a17
0
160
Phase07_実務適用
overflowinc
0
1.8k
VSCode中心だった自分がターミナル沼に入門した話
sanogemaru
0
600
Windows ファイル共有(SMB)を再確認する
murachiakira
PRO
0
270
やさしいとこから始めるGitHubリポジトリのセキュリティ
tsubakimoto_s
0
430
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
18k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.5k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.4k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Into the Great Unknown - MozCon
thekraken
40
2.3k
Six Lessons from altMBA
skipperchong
29
4.2k
How to train your dragon (web standard)
notwaldorf
97
6.6k
First, design no harm
axbom
PRO
2
1.1k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
150
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
86
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
180
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Transcript
RISC-VボードでRustを動かす話
⾃⼰紹介 Self Self { { name name: : " ダニエル"
" ダニエル", , school school: : " 東京農⼯⼤学" " 東京農⼯⼤学", , twitter twitter: : "@daniel_program" "@daniel_program", , } }
RISC-V
RISC-Vとは… CPUのオープンソースな命令セット(ISA)の⼀種
HIFive RevB HIFive RevB のページ
HIFive RevB Hifive RV IMAC Rust riscv imac-unknown-none-elf このボード向けにコンパイルできるのでは?
やってみた C⾔語からRustを呼び出す Rust単体で実⾏する
Cから呼び出す rustから使いやすいようにCを書く rustを書く staticlib として書き出す cbindgenで.h ファイルを作る ⼀緒にコンパイルする
rustから使いやすいようにCを書く freedom-e-sdk void void led_on led_on( () ) { {.
.. .. .} } void void led_off led_off( () ) { {. .. .. .} } int int main main( () ) { { . .. .. . blink_rs blink_rs( () ); ; } }
rustを書く extern extern { { fn fn led_on led_on( ()
); ; fn fn led_off led_off( () ); ; } } #[no_mangle] #[no_mangle] pub pub extern extern fn fn blink_rs blink_rs( () ) { { loop loop { { unsafe unsafe{ { led_on led_on( () ); ; } } delay delay( () ); ; unsafe unsafe{ { led_off led_off( () ); ; } } delay delay( () ); ; } } } }
staticlib Cargo.toml [ [package package] ] name name = =
"blink" "blink" version version = = "0.1.0" "0.1.0" authors authors = = [ ["Daniel" "Daniel"] ] edition edition = = "2018" "2018" [ [lib lib] ] crate-type crate-type= =[ ["staticlib" "staticlib"] ] [ [dependencies dependencies] ]
cbindgen $ cargo $ cargo install install cbindgen cbindgen $
cbindgen $ cbindgen . . .. .... .. void blink_rs void blink_rs( (void void) ); ;
⼀緒にコンパイルする コンパイラにstaticlib も投げればコンパイルしてくれる。 今回はMakefile の依存関係に書くだけでコンパイルしてくれた。
Rust単体で実⾏する Github - riscv-rust-quickstart https://github.com/riscv-rust/riscv-rust-quickstart
"cargo run " で実⾏ができる!
Example leds_blinkでLチカができている
None
実⾏はしっかりできます
まとめ riscvボードでRustは動かせる。 Cとつなげるのは⾯倒くさい ライブラリ周りがまだしっかりしていない
ありがとうございます! @daniel_program