UF2 ファイル形式とは?
UF2 は USB Flashing Format の略で、Microsoft が 2017 年に MakeCode (PXT) プラットフォーム向けに作成したファイル形式です。USB マスストレージ経由でマイコンに書き込むために構築されています。ボードは通常のリムーバブルドライブとして表示され、他のファイルと同じようにファームウェアをコピーできます。仕様はオープンであり、Microsoft によって MIT ライセンスの下で公開されています。
.uf2 ファイルは、512 バイトのブロックが並んだフラットなシーケンスです。各ブロックは自己完結型です。マジックナンバー、ターゲットのフラッシュアドレス、ペイロード長、ブロックのインデックスと総数、ターゲットチップを識別するファミリー ID を含む 32 バイトのヘッダーがあり、その後に最大 476 バイトのファームウェアと末尾のマジックナンバーが続きます。この設計は現実的な問題を解決します。OS はコピーされたファイルのブロックを任意の順序で書き込む可能性があるため、各ブロックを独立させることで、ボードのブートローダーはファイルの一部しか届いていない状態でも、データが到着した瞬間にフラッシュメモリに書き込むことができます。
ほとんどの人は、ホビー用や教育用ボードをプログラミングする際に UF2 に出会います。Raspberry Pi Pico (RP2040)、BBC micro:bit、および多くの Adafruit、Arduino、Seeed ボードが UF2 を受け入れ、CircuitPython や MakeCode プロジェクトのインストールに使用されます。通常、MakeCode などのエディターからエクスポートするか、特定のボード用にビルド済みのファームウェアをダウンロードすることで .uf2 を入手します。関連するファームウェア形式には、生の .BIN イメージや Intel .HEX ファイルがあります。
セキュリティと安全性
リスク: MEDIUMA UF2 file is passive data and cannot run on your PC, but flashing firmware rewrites a board's program memory. Only flash a .uf2 that is built for your exact board, and only from a source you trust, since the wrong or malicious firmware can leave a board unusable until you reflash a known-good image.
形式の詳細
概要UF2 ファイルを開くプログラム
.uf2 file onto that drive. uf2conv.py firmware.bin -o firmware.uf2, or inspect a UF2 with uf2conv.py -i firmware.uf2. .uf2 file onto the removable drive the board presents in bootloader mode. .uf2 file onto it. python3 uf2conv.py firmware.bin -o firmware.uf2 to build or inspect UF2 files. 技術的詳細
詳細仕様| Encoding | binary |
| Byte order | little-endian (all 32-bit fields) |
| Container | flat sequence of independent 512-byte blocks |
| Typical size | a few KB to about 1 MB |
| Structure | A series of 512-byte blocks; each has a 32-byte header (magic numbers, target flash address, payload size, block index and count, family ID), up to 476 bytes of firmware payload, and a trailing magic number |
| Versioning | flags and 32-bit family-ID field identify the target chip (for example RP2040) |
| Integrity | three magic numbers per block (0x0A324655, 0x9E5D5157, 0x0AB16F30) validate each block; no CRC |
| Platforms | Windows, macOS, Linux, ChromeOS |
| Initial Release Full | 2017, with Microsoft MakeCode |
| Notes | You do not open a UF2 to view it; you copy it onto the board's USB drive to flash firmware. Because each 512-byte block is self-contained, the operating system can write the blocks in any order and the bootloader still flashes correctly. |
| リリース日 | 2017 (Microsoft MakeCode / PXT) |
| オープンスタンダード | はい · ロイヤリティフリー |
| 仕様書 | github.com |
UF2 の変換
コミュニティ Q&A
ユーザーからの質問まだ質問はありません。UF2 ファイルについて最初の質問をしてみましょう。
よくある質問
UF2 ファイルはどうやって開きますか?
.uf2 ファイルをドラッグしてください。ボードが書き込みを行い、再起動します。Raspberry Pi Pico をブートローダーモードにするには?
.uf2 をコピーすると、ボードは新しいファームウェアで再起動します。UF2 ファイルを BIN に変換できますか?
uf2conv.py を使い、uf2conv.py file.uf2 -c -o file.bin で生のバイナリを抽出できます。UF2 ヘッダーに保存されているフラッシュアドレスを忘れないようにしてください。