バックナンバーはこちら。
https://www.simulationroom999.com/blog/In-vehicle-external-storage-backnumber/
はじめに
FatFsの取得の話。
登場人物
博識フクロウのフクさん

イラストACにて公開の「kino_k」さんのイラストを使用しています。
https://www.ac-illust.com/main/profile.php?id=iKciwKA9&area=1
エンジニア歴8年の太郎くん

イラストACにて公開の「しのみ」さんのイラストを使用しています。
https://www.ac-illust.com/main/profile.php?id=uCKphAW2&area=1
FatFsの取得

まずはともあれ、FatFsをDownloadしてこよう。

ここから落としてくれば良いのかな?

あー、なんか日本語ページの方は大分前から更新されてないっぽいんだよねー。
というわけで英語ページから落としてくることになる。

該当ページの一番下に、
- Download: FatFs R0.14a
- Download: FatFs sample projects for various platforms
ってのがあると思うが、
「Download: FatFs R0.14a」
の方はFatFs単体で
「Download: FatFs sample projects for various platforms」
の方は様々な環境(マイコン等)で動作さえることを前提としたサンプルが含まれている。

どっちを落とせばよいの?

「Download: FatFs sample projects for various platforms」
の方だね。
この中にWindows上で動作させるサンプルもあるんで、
それをベースに使うことになる。

あ、最初からWindows上で動作するのがあるって言ってたね。
それのことか。

FatFs sample projects for various platformsの中身

とりあえず、落として、zip解凍したよ。

中身はこうなってるはずだ。


このavrとかfm3とかstm32フォルダが並んでいるのは?

各マイコン別のサンプルだね。

ほー。
本当にいろんなのに対応してるのかー。

SDカードへアクセス手段はSPIで実施するものがほとんどだが、
LPC23xxはマイコン内蔵のSDホストコントローラを使用したサンプルになってる。
SPIモードではなく、SDモードの通信のサンプルを見たい場合は
LPC23xxの実装を参照すると良いだろう。
STマイクロのSTM32CubeMX、STM32CubeIDEなんかのSDKドライバこれを参考にしてるんじゃないかな。

となると、
今回はwin32ってのが目的のサンプルになるのかな?

その通り。
FatFs sample projects for various platforms Win32の中身

win32フォルダの中はこんなんだね。


Visual Studioのソリューションファイルがあるから、そのまま使えるのかな?
いや、Visual Studioもいろいろversionがあるから、手元のVisual Studio 2017 expressで動く保証はないのか?

サンプルのソリューションはVisual Studio 2008のモノのようだね。
事前に確認したが、Visual Studio 2017 expressにupgradeしても動作しそうな感じだった。

ならとりあえずは安心かな。

次回はとりあえず、動かしてみるってところかな。
まとめ

まとめだよ。
- FatFsをDownloadしてきた。
- 日本語サイトではなく、英語サイトから。
- FatFs sample projects for various platformsの方を落とす。
- FatFs sampleの中身確認。
- 様々なマイコン向けのサンプルあり。(avr,stm32,lpc23xx)
- win32がWindows向けのサンプル。
- 様々なマイコン向けのサンプルあり。(avr,stm32,lpc23xx)
バックナンバーはこちら。
コメント