Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
RISC-VボードでRustを動かす話
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Daniel
July 03, 2019
Technology
990
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
850
一年生へ
peshogo
1
88
炭酸飲料が飲めない学校で炭酸飲料を飲めるよにした話
peshogo
0
100
Other Decks in Technology
See All in Technology
今こそ知りたいAmplifyGen2
mkdev10
2
160
継続的なAIコスト最適化
bgpat
1
280
AI時代のPRレビューにどう向き合うか?
kairim0
1
170
Datadog の学び方 - あるいは、オブザーバビリティを学ぶとは何か
mananyuki
1
540
ゲームのリアルタイム通信から見た QUIC と MoQ
segadevtech
0
110
契約書画像からの情報抽出に特化した視覚接地モデルを育てる話
sansantech
PRO
1
160
組み立てて楽しむ AWS Blocks 入門
kmiya84377
0
230
DGX Spark でどこまでハッキングができるのか?
kash1064
0
250
IoTデバイスを繋げるプロトコルMatterをAndroidで使用する方法
harutiro
0
140
Claude Code本は、どのように執筆チームで書かれたか
oikon48
1
360
会社説明資料
persolserverworks
0
9.7k
FactoryBotアンチパターン / factory_bot anti-patterns
toshimaru
0
150
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Visualization
eitanlees
153
17k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.3k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
440
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Music & Morning Musume
bryan
48
7.4k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
700
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Designing for humans not robots
tammielis
254
26k
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