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
Daniel
July 03, 2019
Technology
1
940
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
790
一年生へ
peshogo
1
71
炭酸飲料が飲めない学校で炭酸飲料を飲めるよにした話
peshogo
0
92
Other Decks in Technology
See All in Technology
What's new in OpenShift 4.20
redhatlivestreaming
0
210
HonoとJSXを使って管理画面をサクッと型安全に作ろう
diggymo
0
180
ストレージエンジニアの仕事と、近年の計算機について / 第58回 情報科学若手の会
pfn
PRO
3
780
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
3
20k
Copilot Studio ハンズオン - 生成オーケストレーションモード
tomoyasasakimskk
0
220
OCIjp_Oracle AI World_Recap
shinpy
1
180
[VPoE Global Summit] サービスレベル目標による信頼性への投資最適化
satos
0
240
webpack依存からの脱却!快適フロントエンド開発をViteで実現する #vuefes
bengo4com
3
3.2k
ハノーファーメッセ2025で見た生成AI活用ユースケース.pdf
hamadakoji
1
460
Observability — Extending Into Incident Response
nari_ex
1
240
マルチエージェントのチームビルディング_2025-10-25
shinoyamada
0
140
OSSで50の競合と戦うためにやったこと
yamadashy
3
970
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
65
7.9k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.6k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
Automating Front-end Workflow
addyosmani
1371
200k
Agile that works and the tools we love
rasmusluckow
331
21k
We Have a Design System, Now What?
morganepeng
53
7.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Mobile First: as difficult as doing things right
swwweet
225
10k
It's Worth the Effort
3n
187
28k
Being A Developer After 40
akosma
91
590k
Become a Pro
speakerdeck
PRO
29
5.6k
The World Runs on Bad Software
bkeepers
PRO
72
11k
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