Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zephyr port: unnecessary flash alignment check #122

Open
sw opened this issue May 6, 2021 · 0 comments
Open

Zephyr port: unnecessary flash alignment check #122

sw opened this issue May 6, 2021 · 0 comments

Comments

@sw
Copy link

sw commented May 6, 2021

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:

rem_bytes = req->data_len % flash_area_align(fa);
flash_area_close(fa);
if (rem_bytes) {
action->write_bytes -= rem_bytes;
}

But then, buffered write is used in img_mgmt_impl_write_image_data:

rc = flash_img_buffered_write(ctx, (void *)data, num_bytes, last);

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?

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

No branches or pull requests

1 participant