Description
This relates to apache/mynewt-newtmgr#185
There is a performance problem when using mcumgr CLI to upload firmware images to a Zephyr system. There is an overhead of up to 4x in the data transmitted on the serial port.
On the one hand, this is due to sub-optimal frame handling in mcumgr CLI as reported in apache/mynewt-newtmgr#185
But I suspect the MCU side could also be improved.
img_mgmt_impl_upload_inspect
rounds the data length down to a multiple of the flash write block size:
mynewt-mcumgr/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
Lines 571 to 576 in 798f7fe
But then, buffered write is used in img_mgmt_impl_write_image_data
:
According to the documentation of flash_img_buffered_write
, this function will store non-complete blocks in RAM until it is called with flush == true
. So a length that is not a multiple of the flash write block size should not pose a problem.
My suggestion would be to remove the length truncation in img_mgmt_impl_upload_inspect
.
Or is there some special case that this would break?