Skip to content

Clarification about blockNo and numBlocks #91

@microbit-carlos

Description

@microbit-carlos

From the File format description:

  • blockNo: Sequential block number; starts at 0
  • numBlocks : Total number of blocks in file

And the File containers section concurs in that this should be the block number and count for the entire file:

The fields blockNo and numBlocks refer to the entire UF2 file, not the current file.

But, then the Family ID description suggest that multiple UF2 can be concatenated, and each file will have a different total of numBlocks and duplicated blockNo values:

If the familyID doesn't match, the bootloader should disregard the entire block, including blockNo and numBlocks fields. [...] This also allows for several files with different familyID to be simply concatenated together, and the whole resulting file to be copied to the device with only one actually being written to flash.

And we also have this unmerged PR for joining UF2 files, which does change the blockNo and numBlocks, but it keeps a different count for each Family ID. So joining 3 UF2 files for 2 families, will end up with two different numBlocks (the same family are merged, the other family kept separated):

So we seem to have to contradictory definitions, unless the definition is meant to be:

  • When the file container flag is used blockNo and numBlocks refer to the entire UF2 file
  • Otherwise the blockNoandnumBlocksrefer to the blocks for each individualfamilyID`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions