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
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
810
一年生へ
peshogo
1
73
炭酸飲料が飲めない学校で炭酸飲料を飲めるよにした話
peshogo
0
92
Other Decks in Technology
See All in Technology
データの整合性を保ちたいだけなんだ
shoheimitani
7
2.8k
SREのプラクティスを用いた3領域同時 マネジメントへの挑戦 〜SRE・情シス・セキュリティを統合した チーム運営術〜
coconala_engineer
2
560
Databricks Free Edition講座 データサイエンス編
taka_aki
0
290
あたらしい上流工程の形。 0日導入からはじめるAI駆動PM
kumaiu
5
750
CDKで始めるTypeScript開発のススメ
tsukuboshi
1
300
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
190
システムのアラート調査をサポートするAI Agentの紹介/Introduction to an AI Agent for System Alert Investigation
taddy_919
2
1.7k
GitLab Duo Agent Platform × AGENTS.md で実現するSpec-Driven Development / GitLab Duo Agent Platform × AGENTS.md
n11sh1
0
120
Azure Durable Functions で作った NL2SQL Agent の精度向上に取り組んだ話/jat08
thara0402
0
140
今日から始めるAmazon Bedrock AgentCore
har1101
4
380
GCASアップデート(202510-202601)
techniczna
0
250
プロポーザルに込める段取り八分
shoheimitani
0
160
Featured
See All Featured
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
110
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
110
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
63
HDC tutorial
michielstock
1
350
Scaling GitHub
holman
464
140k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
200
How to Talk to Developers About Accessibility
jct
2
120
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