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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Daniel
July 03, 2019
Technology
980
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RISC-VボードでRustを動かす話
最近買ったRISC-VボードHifive1 RevBの上でRustを動かす話です。(時間の関係ではなせなかった部分が少し増えてます)
Daniel
July 03, 2019
More Decks by Daniel
See All by Daniel
Juliaで機械学習
peshogo
2
840
一年生へ
peshogo
1
82
炭酸飲料が飲めない学校で炭酸飲料を飲めるよにした話
peshogo
0
98
Other Decks in Technology
See All in Technology
20260608_Codexの可能性_ノンプログラマー向け_大城追記
doradora09
PRO
0
800
【CEDEC2026】『ウマ娘 プリティーダービー』 英語版のキャラクターの方言や口調をローカライズするための創造的アプローチ
cygames
PRO
2
740
モダンフロントエンド 開発研修
recruitengineers
PRO
4
630
ハーレムエンジニアリング
kazuma777777
0
150
制約理論(ToC)入門 2026版
recruitengineers
PRO
8
2.2k
Eight Engineering Unit 紹介資料
sansan33
PRO
3
8.2k
Bill One 開発エンジニア 紹介資料
sansan33
PRO
7
19k
ブラウザ研修 2026
recruitengineers
PRO
6
990
Goでデータパイプラインを作ろう
sansantech
PRO
1
450
2026-08-05 IBM Z開発最前線!IBM Bob Premium Package for Zって何がすごいの?
yutanonaka
0
110
クラウドセキュリティ入門 ~安全なクラウド利用のための基礎知識~
lhazy
13
8.7k
【CEDEC2026】Creative Approaches to Localizing the Dialects and Unique Speech of Umamusume: Pretty Derby Characters in English
cygames
PRO
3
17k
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
380
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Bash Introduction
62gerente
615
220k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
940
New Earth Scene 8
popppiees
3
2.5k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
430
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
390
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
370
Building an army of robots
kneath
306
46k
A Modern Web Designer's Workflow
chriscoyier
698
190k
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