電子工作シリーズ。SH2 マイコンに SDカード(MMC) I/F を用意した。MP3 デコーダを付けてから、表向きはあまり進展のなかったのだけど、gcc/gdb 開発環境の準備などに手間取っていた次第。
SD カードのテストには「フラッシュ・メモリ・カードの徹底活用」掲載サンプルプログラムを gdb モニタ用に小修正したものを使った。SH2 基板上の RS232C(SCI1) はデバッグモニタで使用するため、ターゲットプログラムでの入出力用のシリアルインターフェース SCI0 を引き出している。残った SCI2 を SD カード入出力に使う。
テストに用いた 512M SD カードでは次のような情報が得られた。
MMC Access sample program CID = 04 53 44 53 44 35 31 32 24 00 E0 1A 27 00 67 9D Manufacturer ID : 04h OEM/Application ID : 5344h Product Name : 'SD512$' Product Revision : 00h Product Serial Number : E01A2700h Manufacturing Date : 67h CRC : 9Dh CSD = 00 5D 00 32 1B 59 83 CC F6 DB 41 BF 16 40 00 2D MMC Spec Verison = 0 C_SIZE_MULT = 6 C_SIZE = 3891 MULT = 256 BLOCK_LEN = 512 MAX LBA = 996352
セクタ 0 の内容。FAT ファイルシステムについては「FAT FS フォーマットの実装についての覚え書き」[KabaVM System] に詳しい。
LBA=0~0 Read Sector Count = 1 +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F | ---- ASCII ----- 000h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 010h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 020h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 030h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 040h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 050h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 060h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 070h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 080h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 090h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 0A0h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 0B0h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 0C0h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 0D0h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 0E0h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 0F0h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 100h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 110h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 120h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 130h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 140h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 150h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 160h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 170h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 180h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 190h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 1A0h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 1B0h 00 00 00 00 00 00 00 00 - 7A 90 03 06 00 00 00 03 | ........z....... 1C0h 2F 00 0B 07 C7 DC EB 00 - 00 00 15 33 0F 00 00 00 | /..........3.... 1D0h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 1E0h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 1F0h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 55 AA | ..............U.
で、こちらが最初のパーティションの BPB (Boot Parameter Block)。当初、セクタ 0 に BPB があるものだと思い込んでいて悩んでしまった。組込み用の汎用 FAT ファイルシステムを載せる場合に、パーティション管理は自前でおこなう必要がある。
Posted by masato at 07:25 AMLBA=235~235 Read Sector Count = 1 +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F | ---- ASCII ----- 000h EB 58 90 4D 53 44 4F 53 - 35 2E 30 00 02 08 22 00 | .X.MSDOS5.0...". 010h 02 00 00 00 00 F8 00 00 - 3F 00 FF 00 EB 00 00 00 | ........?....... 020h 15 33 0F 00 CB 03 00 00 - 00 00 00 00 02 00 00 00 | .3.............. 030h 01 00 06 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 040h 00 00 29 D1 57 B6 F8 4E - 4F 20 4E 41 4D 45 20 20 | ..).W..NO NAME 050h 20 20 46 41 54 33 32 20 - 20 20 33 C9 8E D1 BC F4 | FAT32 3..... 060h 7B 8E C1 8E D9 BD 00 7C - 88 4E 02 8A 56 40 B4 08 | {......|.N..V@.. 070h CD 13 73 05 B9 FF FF 8A - F1 66 0F B6 C6 40 66 0F | ..s......f...@f. 080h B6 D1 80 E2 3F F7 E2 86 - CD C0 ED 06 41 66 0F B7 | ....?.......Af.. 090h C9 66 F7 E1 66 89 46 F8 - 83 7E 16 00 75 38 83 7E | .f..f.F..~..u8.~ 0A0h 2A 00 77 32 66 8B 46 1C - 66 83 C0 0C BB 00 80 B9 | *.w2f.F.f....... 0B0h 01 00 E8 2B 00 E9 48 03 - A0 FA 7D B4 7D 8B F0 AC | ...+..H...}.}... 0C0h 84 C0 74 17 3C FF 74 09 - B4 0E BB 07 00 CD 10 EB | ..t.<.t......... 0D0h EE A0 FB 7D EB E5 A0 F9 - 7D EB E0 98 CD 16 CD 19 | ...}....}....... 0E0h 66 60 66 3B 46 F8 0F 82 - 4A 00 66 6A 00 66 50 06 | f`f;F...J.fj.fP. 0F0h 53 66 68 10 00 01 00 80 - 7E 02 00 0F 85 20 00 B4 | Sfh.....~.... .. 100h 41 BB AA 55 8A 56 40 CD - 13 0F 82 1C 00 81 FB 55 | A..U.V@........U 110h AA 0F 85 14 00 F6 C1 01 - 0F 84 0D 00 FE 46 02 B4 | .............F.. 120h 42 8A 56 40 8B F4 CD 13 - B0 F9 66 58 66 58 66 58 | B.V@......fXfXfX 130h 66 58 EB 2A 66 33 D2 66 - 0F B7 4E 18 66 F7 F1 FE | fX.*f3.f..N.f... 140h C2 8A CA 66 8B D0 66 C1 - EA 10 F7 76 1A 86 D6 8A | ...f..f....v.... 150h 56 40 8A E8 C0 E4 06 0A - CC B8 01 02 CD 13 66 61 | V@............fa 160h 0F 82 54 FF 81 C3 00 02 - 66 40 49 0F 85 71 FF C3 | ..T.....f@I..q.. 170h 4E 54 4C 44 52 20 20 20 - 20 20 20 00 00 00 00 00 | NTLDR ..... 180h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 190h 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ 1A0h 00 00 00 00 00 00 00 00 - 00 00 00 00 0D 0A 52 65 | ..............Re 1B0h 6D 6F 76 65 20 64 69 73 - 6B 73 20 6F 72 20 6F 74 | move disks or ot 1C0h 68 65 72 20 6D 65 64 69 - 61 2E FF 0D 0A 44 69 73 | her media....Dis 1D0h 6B 20 65 72 72 6F 72 FF - 0D 0A 50 72 65 73 73 20 | k error...Press 1E0h 61 6E 79 20 6B 65 79 20 - 74 6F 20 72 65 73 74 61 | any key to resta 1F0h 72 74 0D 0A 00 00 00 00 - 00 AC CB D8 00 00 55 AA | rt............U.
おそらく携帯電話等からは投稿できません。日本語文字列を含まないコメントやトラックバック、および当サイトへの言及を含まないトラックバックは御遠慮いただいております。また、90日以上経過した記事へのコメントはできません。