Add uf2 combine command#313
Conversation
Combines 2 UF2s into 1, modifying the block numbers (and giving them same family ID)
Allows placing second uf2 at offset, or in a partition defined in the first uf2
I think @peterharperuk also said that it'd be nice if some of the pico-examples were also installable with a single UF2 file? |
|
Could / should this PR also contain code to do raspberrypi/pico-examples#746 (comment) in order to remove the Unix-only limitation? Or is that outside the scope of what this PR is doing? |
| ).force_expand_help(true) % "UF2 Family options" + | ||
| ( | ||
| option("--platform") & platform_model("platform").set(settings.model) % "optional platform for memory verification (eg rp2040, rp2350)" | ||
| option("--platform") % "Optional platform for memory verification" & |
There was a problem hiding this comment.
What does "memory verification" mean? Is it actually verifying the memory of the RP2350, or is it just checking that addresses are in the right ranges? If the latter, perhaps "Optional platform for memory-address validation" would be better? 🤷
There was a problem hiding this comment.
It's just checking that addresses are in the right ranges
| option("--platform") % "Optional platform for memory verification" & | |
| option("--platform") % "Optional platform for memory-address validation" & |
| } | ||
|
|
||
| bool uf2_combine_command::execute(device_map &devices) { | ||
| if (get_file_type_idx(0) != filetype::uf2 || get_file_type_idx(1) != filetype::uf2 || get_file_type_idx(0) != filetype::uf2) { |
There was a problem hiding this comment.
| if (get_file_type_idx(0) != filetype::uf2 || get_file_type_idx(1) != filetype::uf2 || get_file_type_idx(0) != filetype::uf2) { | |
| if (get_file_type_idx(0) != filetype::uf2 || get_file_type_idx(1) != filetype::uf2) { |
Or do you just want to be extra sure that the first file is a UF2? 😆
This is similar but separate, as they are different methods of combining UF2 files - that would be a separate |
Hmm, so from my limited understanding of picotool and UF2 files, would the idea then be that |
Yes, that is generally correct:
|
Now I'm slightly confused again - in the previous comment you said |
They're both true - you can use:
1 is for writing everything, as it writes to absolute addresses, ignoring the partitions already on the device 2 is for updates, as it uses the bootrom to place the UF2s into the correct partitions as per their family IDs Currently, you have to do 2, which involves loading the partition table onto the device, rebooting, then loading the concatenated UF2 onto the device. This PR allows you to do 1, which loads the partition table and partition data with a single |
|
Thanks William, I wasn't very familiar with how partitions / partition tables work on RP2350. But what you've written makes sense. |
This combines 2 UF2s into 1, modifying the block numbers, and giving them same family ID, so it can be loaded as a single UF2 file. Can be called repeatedly to combine more UF2s.
Main use case is for combining partition tables with their partitions for loading as a single UF2 file. This will make running pico-examples that use partition tables easier, as a single UF2 can be generated for loading.
I think this was requested by @timg236, and it also fixes #169