2 #------------------------------------------------------------------------------
3 # $File: uf2,v 1.3 2021/04/28 01:00:31 christos Exp $
4 # uf2: file(1) magic for UF2 firmware image files
6 # https://github.com/microsoft/uf2
8 # Created by Blake Ramsdell <blaker@gmail.com>
10 0 string UF2\n UF2 firmware image
12 # This is for checking the other magic numbers, do we want to do that?
13 #>4 lelong 0x9E5D5157 howdy
14 #>>508 lelong 0x0AB16F30 doody
15 >8 lelong &0x0001 \b, not main flash
16 >8 lelong &0x1000 \b, file container
17 >8 lelong &0x2000 \b, family
19 # To update the UF2 family data, use this fine command
22 # https://raw.githubusercontent.com/microsoft/uf2/master/utils/uf2families.json \
23 # | jq -r '.[] | ">>28\tlelong\t\(.id)\t\(.description)"' | sort -n -k 3` && \
25 # "s/(### BEGIN UF2 FAMILIES\\n).*(\\n### END UF2 FAMILIES)/\$1$families\$2/s" \
28 ### BEGIN UF2 FAMILIES
29 >>28 lelong 0x00ff6919 ST STM32L4xx
30 >>28 lelong 0x04240bdf ST STM32L5xx
31 >>28 lelong 0x16573617 Microchip (Atmel) ATmega32
32 >>28 lelong 0x1851780a Microchip (Atmel) SAML21
33 >>28 lelong 0x1b57745f Nordic NRF52
34 >>28 lelong 0x1c5f21b0 ESP32
35 >>28 lelong 0x1e1f432d ST STM32L1xx
36 >>28 lelong 0x202e3a91 ST STM32L0xx
37 >>28 lelong 0x21460ff0 ST STM32WLxx
38 >>28 lelong 0x2abc77ec NXP LPC55xx
39 >>28 lelong 0x300f5633 ST STM32G0xx
40 >>28 lelong 0x31d228c6 GD32F350
41 >>28 lelong 0x4c71240a ST STM32G4xx
42 >>28 lelong 0x4fb2d5bd NXP i.MX RT10XX
43 >>28 lelong 0x53b80f00 ST STM32F7xx
44 >>28 lelong 0x55114460 Microchip (Atmel) SAMD51
45 >>28 lelong 0x57755a57 ST STM32F401
46 >>28 lelong 0x5a18069b Cypress FX2
47 >>28 lelong 0x5d1a0a2e ST STM32F2xx
48 >>28 lelong 0x5ee21072 ST STM32F103
49 >>28 lelong 0x647824b6 ST STM32F0xx
50 >>28 lelong 0x68ed2b88 Microchip (Atmel) SAMD21
51 >>28 lelong 0x6b846188 ST STM32F3xx
52 >>28 lelong 0x6d0922fa ST STM32F407
53 >>28 lelong 0x6db66082 ST STM32H7xx
54 >>28 lelong 0x70d16653 ST STM32WBxx
55 >>28 lelong 0x7eab61ed ESP8266
56 >>28 lelong 0x7f83e793 NXP KL32L2x
57 >>28 lelong 0x8fb060fe ST STM32F407VG
58 >>28 lelong 0xada52840 Nordic NRF52840
59 >>28 lelong 0xbfdd4eee ESP32-S2
60 >>28 lelong 0xc47e5767 ESP32-S3
61 >>28 lelong 0xd42ba06c ESP32-C3
62 >>28 lelong 0xe48bff56 Raspberry Pi RP2040
67 >8 lelong&0x2000 0 \b, file size
69 >8 lelong &0x4000 \b, MD5 checksum present
70 >8 lelong &0x8000 \b, extension tags present
71 >12 lelong x \b, address %#08x
72 >24 lelong x \b, %u total blocks