mynewt-mcumgr
mynewt-mcumgr copied to clipboard
Zephyr port: unnecessary flash alignment check
This relates to https://github.com/apache/mynewt-newtmgr/issues/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 https://github.com/apache/mynewt-newtmgr/issues/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:
https://github.com/apache/mynewt-mcumgr/blob/798f7fe28bb32335ba25d1c180808cd88d73a83c/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c#L571-L576
But then, buffered write is used in img_mgmt_impl_write_image_data
:
https://github.com/apache/mynewt-mcumgr/blob/798f7fe28bb32335ba25d1c180808cd88d73a83c/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c#L307
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?