pico-examples icon indicating copy to clipboard operation
pico-examples copied to clipboard

Add a sample to read the partition table

Open oyama opened this issue 10 months ago • 7 comments

Add a sample that reads the partition table from runtime.

I would appreciate comments on the partition table operation procedure itself, as I did not know the correct way to do it and coded it by trial and error.

oyama avatar Mar 17 '25 07:03 oyama

@oyama You might find some useful partition-related code in https://github.com/raspberrypi/picotool ? :man_shrugging:

lurch avatar Mar 17 '25 17:03 lurch

@lurch Thank you for the pointer! It looks like the relevant code is around here: https://github.com/raspberrypi/picotool/blob/de8ae5ac334e1126993f72a5c67949712fd1e1a4/bintool/metadata.h#L227 – I'll take a look. However, my goal is to implement a file system that respects both partitions and permissions, so it seems I'll also need to create a separate read/write example using rom_flash_op().

oyama avatar Mar 18 '25 02:03 oyama

Based on the comments, the read process of the partition table was divided and organized into a fixed-length field portion and a variable-length field portion.

oyama avatar Mar 19 '25 10:03 oyama

Thanks suggestions. Very helpful.

oyama avatar Mar 21 '25 16:03 oyama

@oyama I'd just like to say thank you very much for putting up with all my niggly comments. I sometimes get a bit carried away when reviewing code :laughing:

lurch avatar Mar 27 '25 12:03 lurch

@lurch Thank you so much for your detailed feedback, it was incredibly helpful and inspiring. I truly appreciate your attention to every little detail, and your comments have motivated me to improve further. Thanks again for your support!

oyama avatar Mar 27 '25 13:03 oyama

Now that you've added all the code to display extra family IDs, perhaps it's worth exercising that code by putting an extra family ID in your pt.json ? :thinking:

lurch avatar Mar 27 '25 18:03 lurch

LGTM, but should probably add support for the new cyw43-firmware family (added in raspberrypi/pico-sdk#1969) - this can be done with the following changes

Also pinging @kilograham again about whether any of the defines from this example should be moved into the SDK? (I think specifically PARTITION_LOCATION_AND_FLAGS_SIZE, PARTITION_ID_SIZE, PARTITION_NAME_MAX, and possibly add #defines for family names)

can you add an sdk issue for me to do that

kilograham avatar Jul 22 '25 15:07 kilograham