Skip to content

Conversation

@raphaelcoeffic
Copy link

When contiguous blocks add up to less than the configured payload size, it would produce blocks larger than the difference between start addresses in 2 payload blocks.

For example (output from readelf -l):

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x030000 0x90000000 0x700002b0 0x115ff0 0x115ff0 R E 0x10000
  LOAD           0x1462a0 0x701162a0 0x701162a0 0x000d8 0x000d8 R E 0x10000
  LOAD           0x155ff0 0x90115ff0 0x70116378 0x00008 0x00008 R   0x10000
  LOAD           0x160000 0x24000000 0x70116380 0x0044c 0x0044c RW  0x10000

In this case, elf2uf2 would produce these blocks (only relevant blocks shown):

Block 4706/4712 @0x70116200 (len=256), Family: ST STM32H7xx
Block 4707/4712 @0x70116300 (len=256), Family: ST STM32H7xx
Block 4708/4712 @0x70116380 (len=256), Family: ST STM32H7xx
Block 4709/4712 @0x70116480 (len=256), Family: ST STM32H7xx
Block 4710/4712 @0x70116580 (len=256), Family: ST STM32H7xx
Block 4711/4712 @0x70116680 (len=256), Family: ST STM32H7xx
Block 4712/4712 @0x70116780 (len=256), Family: ST STM32H7xx

This would cause block 4707 and 4708 to overlap, and thus not be flashed properly.

With this change, the payload is adjusted:

Block 4706/4712 @0x70116200 (len=256), Family: ST STM32H7xx
Block 4707/4712 @0x70116300 (len=128), Family: ST STM32H7xx
Block 4708/4712 @0x70116380 (len=256), Family: ST STM32H7xx
Block 4709/4712 @0x70116480 (len=256), Family: ST STM32H7xx
Block 4710/4712 @0x70116580 (len=256), Family: ST STM32H7xx
Block 4711/4712 @0x70116680 (len=256), Family: ST STM32H7xx
Block 4712/4712 @0x70116780 (len=76), Family: ST STM32H7xx

When contiguous blocks add up to less than the configured payload size, it would produce blocks larger than the difference between start addresses in 2 payload blocks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant