raspberrypi / picotool

BSD 3-Clause "New" or "Revised" License
566 stars 100 forks source link

Add support for multi-family UF2s to picotool info #122

Closed will-v-pi closed 2 weeks ago

will-v-pi commented 2 weeks ago

This adds support for UF2s with multiple families to picotool info, and also throws a warning that it is only using the first family for other commands.

For example output from the sample hello_world.uf2

$ picotool info hello_world.uf2 
File hello_world.uf2 family ID 'rp2040':

Program Information
 name:                  hello_universal
 features:              UART stdin / stdout
                        USB stdin / stdout
 binary start:          0x10000000
 binary end:            0x10005dd0
 target chip:           RP2350
 image type:            ARM Secure
 rolling window delta:  0x00006000
 vector table:          0x10000000

-------------------------------------------
File hello_world.uf2 family ID 'absolute':

Program Information
 name:                  hello_universal
 features:              UART stdin / stdout
                        USB stdin / stdout
 binary start:          0x10000000
 binary end:            0x10005dd0
 target chip:           RP2350
 image type:            ARM Secure
 rolling window delta:  0x00006000
 vector table:          0x10000000
lurch commented 2 weeks ago

I have zero knowledge about this "universal" UF2 stuff, but why does the first part of your example above say both "family ID 'rp2040'" and "target chip: RP2350" ? :thinking:

will-v-pi commented 2 weeks ago

I have zero knowledge about this "universal" UF2 stuff, but why does the first part of your example above say both "family ID 'rp2040'" and "target chip: RP2350" ? 🤔

The actual "universal binary" (which is just duplicated twice in the "universal UF2" with different family IDs so it gets loaded onto rp2040 or rp2350) has metadata blocks for RP2040, RP2350-Arm and RP2350-RiscV - currently picotool info just displays information about the "best" block found, which will be the RP2350-Arm block. We should probably add support for displaying info about all metadata blocks, rather than just the "best" block it chooses, but that's a separate issue

lurch commented 2 weeks ago

BTW, on the current develop branch of picotool:

$ grep "[fF]amily id" main.cpp | wc -l
13
$ grep "[fF]amily ID" main.cpp | wc -l
3

For consistency, should those occurrences of "family id" be changed to "family ID" ?