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
KernelVM式 nommu Linux入門/introduce of nommu Linu...
Search
Toshifumi NISHINAGA
July 22, 2017
Programming
1.9k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
KernelVM式 nommu Linux入門/introduce of nommu Linux for KernelVM
2017年7月22日にKernelVM@東京13で発表した資料です。
STM32F746-discoveryマイコンボードでLinuxを動かす方法を紹介します。
Toshifumi NISHINAGA
July 22, 2017
More Decks by Toshifumi NISHINAGA
See All by Toshifumi NISHINAGA
マイコンでもRustのtestがしたい その2/KernelVM Tokyo 18
tnishinaga
2
2.7k
マイコンでもRustのtestがしたい/KernelVM Kansai 11
tnishinaga
1
1.9k
BareMetalで遊ぶRaspberry Pi 5 PCIe編/KernelVM Tokyo17
tnishinaga
2
3.9k
probe-rsの紹介と最近の貢献紹介/CELF-02-03
tnishinaga
1
860
SecurityCamp2023基板作るコース講義資料/Security Camp 2023 Lecture Materials
tnishinaga
8
2.8k
RP2040のPIOを使う話/KernelVM Hokuriku 6
tnishinaga
4
9.1k
JTAGでArmプロセッサをデバッグする方法のつづき/KernelVM_Tokyo16
tnishinaga
0
770
CMSIS-DAPの概要と使い方/KernelVM Online5
tnishinaga
1
2.5k
JTAGでarmプロセッサをデバッグする話/KernelVM Online4
tnishinaga
5
4k
Other Decks in Programming
See All in Programming
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
470
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
20
20k
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
0
290
速習iPhone Duo対応
yuukiw00w
2
930
mrbgem 三角測量 開発
ogom
0
170
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
380
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
260
JRuby: Past, Present, and Future
headius
0
220
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
520
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
270
App Intentsのビルドプロセスを支える技術
kntkymt
0
490
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5k
Six Lessons from altMBA
skipperchong
29
4.5k
How to Ace a Technical Interview
jacobian
280
24k
For a Future-Friendly Web
brad_frost
183
10k
Abbi's Birthday
coloredviolet
4
10k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
240
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.9k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
710
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
260
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
300
Transcript
Kernel/VM式 ARMマイコン入門 Toshifumi NISHINAGA
Kernel/VM式 nommu Linux入門 Toshifumi NISHINAGA
$ who @tnishinaga
一般的なLinuxの動くARM board
Linuxなどの現代の一般的なOSは 仮想メモリを必要とするため、 仮想メモリ制御を行う Memory Management Unit(MMU) が必要
MMUはCortex-Aファミリにのみ搭載されている Cortex-A Cortex-R Cortex-M CPU Clock 数百MHz 〜 数GHz よくしらない
数MHz 〜 数百MHz RAM 数百MB 〜 数GB よくしらない 数KB 〜 数MB MMU/MPU MMU MPU MPU 用途 スマートフォン等 のプロセッサ リアルタイム 機器用 マイコン
しかし、世の中にはマイコンで Linuxを動かしたい人が居る Cortex-A Cortex-R Cortex-M CPU Clock 数百MHz 〜 数GHz
よくしらない 数MHz 〜 数百MHz RAM 数百MB 〜 数GB よくしらない 数KB 〜 数MB MMU/MPU MMU MPU MPU 用途 スマートフォン等 のプロセッサ リアルタイム 機器用 マイコン
nommu Linux
mmuの無いプロセッサで動くLinux
マイコンで動くLinux
STM32F746G discovery board
• STM32F746NG ◦ Cortex-M7 ◦ 200MHz CPU clock ◦ 7-stage
pipeline ◦ Superscalar ◦ I&D cache available ◦ 1MB Flash
つよいCPU + 8MB SDRAM
= Linuxが動く
どうやって起動するか
ブートに必要なもの ブートローダー Linux Kernel (+ device tree blob) rootfs
ブートローダー 役割: • SDRAMの有効化 • SDRAMへのカーネル読み込み • カーネルの起動
役割: • 各種ペリフェラルの初期化 • OS基本機能の初期化 • rootfsのマウント • init処理の実行 Linux
Kernel
役割: • busyboxなどの実行バイナリを提 供する rootfs
SDRAM ブートの流れ STM32F746 ROM u-boot.bin Image root.cpio
U-Bootのビルド $ git git://git.denx.de/u-boot.git && cd u-boot $ curl https://gist.githubusercontent.com/tnishinaga/ea0180fc28227ad158d3092645ccb575/raw/76cbb90cf30a23
d3a59c860c7a887250b31a385b/disable_spl_stm32f7.diff | git apply U-Bootのソースをダウンロード.SPLを切るパッチを当てる $ make stm32f746-disco_defconfig $ make menuconfig STM32F746-disco用の設定からFITを有効化
FITを有効化 U-Bootのビルド
U-Bootのビルド $ make CROSS_COMPILE=arm-none-eabi- -j4
U-Bootのインストール $ sudo st-flash write u-boot.bin 0x08000000 st-flashで書き込む USB
Linux Kernelのビルド $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git stm32-linux $ cd stm32-linux
$ git checkout -b stm32-dt-for-v4.13 remotes/origin/stm32-dt-for-v4.13 ソースをダウンロード $ make ARCH=arm stm32_defconfig $ make ARCH=arm menuconfig STM32用の設定を取得して修正していく
RAMアドレスを0xC0000000に修正 (FLASH size も0x00100000(1MiB)に修正) Linux Kernelのビルド
XIPを無効化 Linux Kernelのビルド
Linux Kernelのビルド $ ARCH=arm CROSS_COMPILE=arm-none-eabi- make -j4 Image dtbs ビルドする
rootfsの用意 $ curl http://elinux.org/images/5/51/Stm32_mini_rootfs.cpio.bz2 | bzip2 -d > rootfs.cpio Cortex-M4用のrootfsをもらってくる
(後方互換があるのでCortex-M7でも動く)
rootfsの用意 $ curl http://elinux.org/images/5/51/Stm32_mini_rootfs.cpio.bz2 | bzip2 -d > rootfs.cpio Cortex-M4用のrootfsをもらってくる
(後方互換があるのでCortex-M7でも動く) 動かなかった
rootfsの用意 buildrootを使ってrootfsを作る(要パッチ) 今パッチ作ってるので少々お待ちください…… $ make stm32f746_disco_defconfig $ make CROSS_COMPILE=arm-none-eabi- -j4
起動用イメージの用意 $ curl -O https://gist.githubusercontent.com/tnishinaga/ea0180fc28227ad158d3092645ccb575/raw/cdab9f1bfd5488 d2ec180c383f0d142fb1f5200a/stm32f7_fit.its $ mkimage -f stm32f7_fit.its
stm32f7_fit.itb Image Tree Souce(stm32f7_fit.its)を持ってきて Image Tree Blob(stm32f7_fit.itb)を作成
起動イメージの転送 PC側でminicomを起動する $ minicom -D /dev/ttyACM0 -b 115200
起動イメージの転送
起動イメージの転送 PC側(minicom)はymodemよりFIT(*.itb)を送信 (Crtl + A, Sで開ける) U-Boot側はloadyで待受け U-Boot > loady
0xC0400000
起動イメージの転送
Linuxの起動 bootmでFITからLinux Kernelを読み込んで起動 U-Boot > bootm 0xC0400000
Demo: sl
今後の予定 • NIC使えるようにする • 画面使えるようにする • MINCS動かしてみる(?)