Add load support for universal binaries#349
Conversation
Also adds supported family IDs to models, used to check if family is supported for SRAM loads (and RP2040 flash loads) This fixes picotool load for the universal binaries
New ones split the last RP2040 block after all the RP2350 blocks to prevent Windows errors, so fix build_rmap_uf2 to handle that
Add robustness for invalid UF2 files Allow loading BIN/ELF files into SRAM/RP2040 regardless of the guessed family ID, to match prior behaviour
Now it also ignores UF2 compatibility checks for RP2040 and SRAM binaries too
| std::find(family_ids.begin(), family_ids.end(), family_id) != family_ids.end() | ||
| && std::find(family_ids.begin(), family_ids.end(), family_id) + 1 == std::find(family_ids.begin(), family_ids.end(), block.file_size) |
There was a problem hiding this comment.
Maybe it makes sense to cache the values of std::find(family_ids.begin(), family_ids.end(), block.file_size) and std::find(family_ids.begin(), family_ids.end(), family_id), rather than computing them multiple times?
The runtime reduction would probably be fairly minimal, but it might make the code a bit more readable?
| if (std::find(available_family_ids.begin(), available_family_ids.end(), override_family_id) == available_family_ids.end()) { | ||
| fos << "WARNING: Requested family ID " << family_name(override_family_id) << " not found in UF2 file, "; | ||
| fos << "so loading the first family ID found in the UF2 file (" << family_name(available_family_ids[0]) << "), "; | ||
| fos << "into where family ID " << family_name(override_family_id) << " would go\n"; |
There was a problem hiding this comment.
Should the word "partition" appear between "into" and "where"?
There was a problem hiding this comment.
This could also apply on RP2040, or to SRAM binaries - although in those cases it’ll just error if --family isn’t compatible with the device, rather than placing it anywhere, so there might be a better way to word this? Basically it loads it as if it had the family specified by --family
There was a problem hiding this comment.
Perhaps "into the location where family ID XXXX would normally go." ?
This adds support to
picotool loadfor loading universal binaries, and other multi-family UF2sThe existing
--familyflag can be used to select which family to load from the UF2 - otherwise it picks using the partition table, or based on the supported families for the device for RP2040 or SRAM binaries (no partition table)Also fixes
picotool infoand other command support for 2.3.0 universal binaries, which have rearranged blocks that picotool was handling incorrectlyFixes #344