Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
01001fa
Add an example of extract and enumerate partition table information
oyama Mar 17, 2025
a0ceb2b
update comments
oyama Mar 17, 2025
d2883d1
Remove redundant attribute specifiers
oyama Mar 17, 2025
1015067
Rename structs, specify partition family, remove magic numbers
oyama Mar 19, 2025
8b87449
Changed partition table reads to be split into fixed-length field sec…
oyama Mar 19, 2025
c5aa4c1
Update flash/partition_info/partition_info.c
oyama Mar 21, 2025
2496fe7
panic if the table cannot be retrieved
oyama Mar 21, 2025
5681d71
fixed TYPO `patitions`
oyama Mar 21, 2025
0f96a36
rename to match the partition struct
oyama Mar 21, 2025
9bdba25
remove WORD_SIZE
oyama Mar 21, 2025
7d9edfa
update comment
oyama Mar 21, 2025
87eddec
remove unused define
oyama Mar 21, 2025
bbb1656
remove unused defined WORD_SIZE
oyama Mar 21, 2025
8f3564d
Name unified to flags_and_permissions
oyama Mar 21, 2025
ee6d8d6
Unify pico-sdk header file includes to ""
oyama Mar 25, 2025
b463a69
Fix typo in comment: change "Reads a fixed size fields" to "Reads fix…
oyama Mar 25, 2025
555ded5
Rename the position field in the partition table to “pos"
oyama Mar 25, 2025
9bce48c
Changed function names to prevent misleading as if they were SDK APIs.
oyama Mar 25, 2025
b5c2fbe
Initialize `pt->partition_count = 0`
oyama Mar 25, 2025
0889622
The fields of the partition table read are added `assert()`
oyama Mar 25, 2025
8dd6b0e
Check the return code of `open_partition_table`
oyama Mar 26, 2025
b53dfbc
Define and use SECTOR_SIZE
oyama Mar 26, 2025
4822ae3
Fix partition name work buffer length
oyama Mar 26, 2025
c5fd635
Mask the first bit of the partition name length field
oyama Mar 26, 2025
c88a23c
Add `has_partition` flag
oyama Mar 26, 2025
869bf75
rename `open_partition_table` to `read_partition_table`
oyama Mar 26, 2025
4005c6f
Use the predefined `FLASH_SECTOR_SIZE`
oyama Mar 26, 2025
8d1d467
rename `has_partition` to `has_partition_table`
oyama Mar 26, 2025
ce5b409
Skip printing empty partitions
oyama Mar 26, 2025
d9909f9
Added printing of extra family IDs
oyama Mar 27, 2025
ce6dda8
Add `p->has_name`
oyama Mar 27, 2025
7edee22
Changed default_family to be registered at `new`
oyama Mar 27, 2025
1066f75
Unify alloc/free hierarchy
oyama Mar 27, 2025
b118961
Move `PARTITION_EXTRA_FAMILY_ID_MAX` to uf2_family_ids.h
oyama Mar 27, 2025
c37dcbe
Change `pos` to `pos_` in the block to avoid conflicts
oyama Mar 27, 2025
9c19b3c
Fixed typo from `extra_family_id_and_name` to `extra_family_ids_and_n…
oyama Mar 27, 2025
cda403e
Removed redundant brackets
oyama Mar 27, 2025
a0e81bd
Move comment for `PARTITION_NAME_MAX`
oyama Mar 28, 2025
ff8d2b4
Utilize `p->has_name`. Add `p->has_id`
oyama Mar 28, 2025
9eb7c33
Add sample extra family id to `pt.json`
oyama Mar 28, 2025
7559d39
Apply suggestions from code review
kilograham Jul 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions flash/partition_info/partition_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ typedef struct {
uint32_t last_sector;
uint32_t flags_and_permissions;
uint64_t partition_id;
bool has_name;
char name[PARTITION_NAME_MAX + 1]; // name length is indicated by 7 bits
uint32_t extra_family_id_count;
uint32_t extra_family_ids[PARTITION_EXTRA_FAMILY_ID_MAX];
Expand Down Expand Up @@ -107,7 +108,8 @@ bool read_next_partition(pico_partition_table_t *pt, pico_partition_t *p) {

p->extra_family_id_count = (p->flags_and_permissions & PICOBIN_PARTITION_FLAGS_ACCEPTS_NUM_EXTRA_FAMILIES_BITS)
>> PICOBIN_PARTITION_FLAGS_ACCEPTS_NUM_EXTRA_FAMILIES_LSB;
if (p->extra_family_id_count | (p->flags_and_permissions & PICOBIN_PARTITION_FLAGS_HAS_NAME_BITS)) {
p->has_name = p->flags_and_permissions & PICOBIN_PARTITION_FLAGS_HAS_NAME_BITS;
if (p->extra_family_id_count | p->has_name) {
// Read variable length fields
uint32_t extra_family_id_and_name[PARTITION_EXTRA_FAMILY_ID_MAX + (((PARTITION_NAME_MAX + 1) / sizeof(uint32_t)) + 1)];
uint32_t flags = PT_INFO_SINGLE_PARTITION | PT_INFO_PARTITION_FAMILY_IDS | PT_INFO_PARTITION_NAME;
Expand All @@ -124,14 +126,14 @@ bool read_next_partition(pico_partition_table_t *pt, pico_partition_t *p) {
p->extra_family_ids[i] = extra_family_id_and_name[pos];
}

if (p->flags_and_permissions & PICOBIN_PARTITION_FLAGS_HAS_NAME_BITS) {
if (p->has_name) {
uint8_t *name_buf = (uint8_t *)&extra_family_id_and_name[pos];
uint8_t name_length = *name_buf++ & 0x7F;
memcpy(p->name, name_buf, name_length);
p->name[name_length] = '\0';
}
}
if (!(p->flags_and_permissions & PICOBIN_PARTITION_FLAGS_HAS_NAME_BITS))
if (!(p->has_name))
p->name[0] = '\0';

pt->current_partition++;
Expand Down