[File] [PATCH] Magdir/firmware RP2040 firmware

Alexandre IOOSS erdnaxe at crans.org
Fri Jun 28 10:09:03 UTC 2024


Hello,

I noticed a few days ago that file does not recognized Raspberry Pi Pico 
flash dumps. This board uses a RP2040 chip. This chip is ARM Cortex-M0+ 
and has a vector table, but required a prepended second stage bootloader.

PicoSDK also adds some binary info after the vector table. This enables 
`picotool` tool to extract some information about the firmware. However, 
not all firmware seems to include this structure.

Attached, you will find a patch that enables file to recognized RP2040 
firmware dumps.

I tested the patch using some samples from MicroPython, Meshtastic and 
some simpler firmware:
```
firmware-pico-2.3.13.83f5ba0.bin:  Raspberry Pi RP2040 firmware, initial 
SP at 0x20042000, reset at 0x100001e2, NMI at 0x100001c2, HardFault at 
0x100001c4, SVCall at 0x100001c6, PendSV at 0x100001c8
firmware-picow-2.3.13.83f5ba0.bin: Raspberry Pi RP2040 firmware, initial 
SP at 0x20042000, reset at 0x100001e2, NMI at 0x100001c2, HardFault at 
0x100001c4, SVCall at 0x100001c6, PendSV at 0x100001c8
flag.bin:                          Raspberry Pi RP2040 firmware, initial 
SP at 0x20042000, reset at 0x100001f6, NMI at 0x100001c2, HardFault at 
0x100001c4, SVCall at 0x100001c6, PendSV at 0x100001c8, with binary_info
glitch_detect.bin:                 Raspberry Pi RP2040 firmware, initial 
SP at 0x20042000, reset at 0x100001f6, NMI at 0x100001c2, HardFault at 
0x100001c4, SVCall at 0x100001c6, PendSV at 0x100001c8, with binary_info
hello.bin:                         Raspberry Pi RP2040 firmware, initial 
SP at 0x20042000, reset at 0x100001f6, NMI at 0x100001c2, HardFault at 
0x100001c4, SVCall at 0x100001c6, PendSV at 0x100001c8, with binary_info
RPI_PICO-20210202-v1.14.bin:       Raspberry Pi RP2040 firmware, initial 
SP at 0x20042000, reset at 0x100001f6, NMI at 0x100001c2, HardFault at 
0x100001c4, SVCall at 0x100001c6, PendSV at 0x100001c8, with binary_info
RPI_PICO-20210418-v1.15.bin:       Raspberry Pi RP2040 firmware, initial 
SP at 0x20042000, reset at 0x100001f6, NMI at 0x100001c2, HardFault at 
0x100001c4, SVCall at 0x100001c6, PendSV at 0x100001c8, with binary_info
RPI_PICO-20230426-v1.20.0.bin:     Raspberry Pi RP2040 firmware, initial 
SP at 0x20042000, reset at 0x100001f6, NMI at 0x100001c2, HardFault at 
0x100001c4, SVCall at 0x100001c6, PendSV at 0x10029fcc, with binary_info
RPI_PICO-20240602-v1.23.0.bin:     Raspberry Pi RP2040 firmware, initial 
SP at 0x20042000, reset at 0x100001f6, NMI at 0x100001c2, HardFault at 
0x100001c4, SVCall at 0x100001c6, PendSV at 0x1002b854, with binary_info
```

Thanks a lot,
Best regards,
-- 
Alexandre
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rp2040.diff
Type: text/x-patch
Size: 1632 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20240628/1138845c/attachment.bin>


More information about the File mailing list