diff options
-rw-r--r-- | doc/usage/dfu.rst | 5 | ||||
-rw-r--r-- | drivers/dfu/dfu_mmc.c | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/doc/usage/dfu.rst b/doc/usage/dfu.rst index 68cacbbef66..8845a71df36 100644 --- a/doc/usage/dfu.rst +++ b/doc/usage/dfu.rst @@ -121,6 +121,11 @@ mmc with + offset + is the offset in the device (hexadecimal without "0x") + size + is the size of the access area (hexadecimal without "0x") + or 0 which means whole device partid being the GPT or DOS partition index, num diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index cdb3c18b01d..12c54e90ef7 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -387,6 +387,16 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char **argv, int a dfu->data.mmc.lba_blk_size = mmc->read_bl_len; /* + * In case the size is zero (i.e. mmc raw 0x10 0), + * assume the user intends to use whole device. + */ + if (third_arg == 0) { + struct blk_desc *blk_dev = mmc_get_blk_desc(mmc); + + dfu->data.mmc.lba_size = blk_dev->lba; + } + + /* * Check for an extra entry at dfu_alt_info env variable * specifying the mmc HW defined partition number */ |